diff --git a/funcs/games/hangman.py b/funcs/games/hangman.py index a88ba08..b659913 100644 --- a/funcs/games/hangman.py +++ b/funcs/games/hangman.py @@ -1,4 +1,4 @@ -import json, urllib, random, datetime, string +import json, urllib, datetime, string from . import hangmanDraw, money from funcs import getName, logThis diff --git a/funcs/games/invest.py b/funcs/games/invest.py index dc4f29c..22d3b6a 100644 --- a/funcs/games/invest.py +++ b/funcs/games/invest.py @@ -1,4 +1,4 @@ -import finnhub, json +import json from funcs import getName from .money import checkBalance, addMoney @@ -13,7 +13,7 @@ def getPrice(symbol : str,finnhubClient): def getPortfolio(user : str,finnhubClient): with open("resources/games/investments.json") as f: data = json.load(f) - + if user not in data or data[user] == {}: return f"{getName(user)} does not have a stock portfolio." else: @@ -56,9 +56,8 @@ def buyStock(user : str, stock : str, buyAmount : int,finnhubClient): with open("resources/games/investments.json", "w") as f: json.dump(data,f,indent=4) - - return f"{getName(user)} bought {buyAmount} GwendoBucks worth of {stock} stock" + return f"{getName(user)} bought {buyAmount} GwendoBucks worth of {stock} stock" else: return f"{stock} is not traded on the american market." else: @@ -70,9 +69,9 @@ def sellStock(user : str, stock : str, sellAmount : int,finnhubClient): if sellAmount > 0: with open("resources/games/investments.json", "r") as f: data = json.load(f) - + stock = stock.upper() - + if user in data and stock in data[user]: value = data[user][stock] stockPrice = getPrice(stock,finnhubClient) @@ -89,7 +88,7 @@ def sellStock(user : str, stock : str, sellAmount : int,finnhubClient): with open("resources/games/investments.json", "w") as f: json.dump(data,f,indent=4) - + return f"{getName(user)} sold {sellAmount} GwendoBucks worth of {stock} stock" else: return f"You don't have enough {stock} stocks to do that" @@ -120,7 +119,7 @@ def parseInvest(content: str, user : str,finnhubClient): return "The command must be given as \"!invest buy [stock] [amount of GwendoBucks to purchase with]\"" else: return "You must give both a stock name and an amount of gwendobucks you wish to spend." - + elif content.startswith("sell"): commands = content.split(" ") if len(commands) == 3: