Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
crypto-chat/logic/help.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
73 lines (62 sloc)
2.64 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from logic.coin import Coin | |
from logic.currency import Currency | |
import time | |
class Help: | |
funcList = [ | |
{"action": "get all currency", "details": "This gives you details about all the currency we support"}, { | |
"action": "set currency [currency symbol]", "details": "You can use this command to set a default currency to your account profile eg 'set currency usd'"}, | |
{"action": "get all coin", | |
"details": "You can get all the coins we currently support"}, | |
{"action": "get coin [coin symbol]", | |
"details": "This gives you information about the specific coin eg 'get coin bitcoin'"} | |
] | |
def howItWorks(self): | |
print( | |
"\n \033[1;3mPlease read the following steps to guide you on how this platform works \033[0m") | |
# time.sleep(2) | |
print( | |
"\033[1;3mWe've created a shortcut list of commands you can input to get up to speed fast \033[0m\n") | |
# time.sleep(2) | |
print( | |
"\033[1;3mPlease enter the following command below to get started. Goodluck...\033[0m \n") | |
for x in self.funcList: | |
print("* \033[1;3m" + x["action"] + "\033[0m") | |
print(x["details"]) | |
print("\n") | |
def callFunc(self): | |
print("\n") | |
time.sleep(1) | |
# get an action from the user | |
action = input("Please enter your command to get started: ") | |
# split the command and convert it to lower case | |
cmd = action.lower().split() | |
# if we want the program to continue | |
cund = False | |
# So we're | |
newCoin = Coin() | |
newCurrency = Currency() | |
if cmd[0] == "get": | |
if cmd[1] == "all": | |
if cmd[2] == "coin": | |
cund = newCoin.getAllCoin() | |
elif cmd[2] == "currency": | |
cund = newCurrency.getAllCurrency() | |
else: | |
print( | |
"The command you provided isn't recornized. Review \033[1;3m how it works \033[0m for better understanding.") | |
print("Enter \033[1;3mExit\033[0m to quit the program") | |
self.callFunc() | |
if cmd[1] == "coin": | |
cund = newCoin.getCoin(cmd[2]) | |
elif (["set", "currency"] and cmd) == cmd and len(cmd) == 3: | |
cund = newCurrency.setCurrency(cmd[2]) | |
elif cmd[0] == "exit": | |
exit() | |
else: | |
print( | |
"The command you provided isn't recornized. Review \033[1;3m how it works \033[0m for better understanding.") | |
print("Enter \033[1;3mExit\033[0m to quit the program") | |
self.howItWorks() | |
self.callFunc() | |
if cund: | |
self.callFunc() |