From 27ab89b5b6ac7fc8f2fc1f4160121bb9e5b80c46 Mon Sep 17 00:00:00 2001 From: NikolajDanger Date: Sun, 1 Nov 2020 18:41:07 +0100 Subject: [PATCH] :screwdriver: Fixed swroll bug --- cogs/SwCog.py | 2 +- funcs/swfuncs/swchar.py | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/cogs/SwCog.py b/cogs/SwCog.py index f048147..4e63fac 100644 --- a/cogs/SwCog.py +++ b/cogs/SwCog.py @@ -11,7 +11,7 @@ class SwCog(commands.Cog): # Rolls star wars dice @commands.command() - async def swroll(self, ctx, *, content): + async def swroll(self, ctx, *, content = ""): command = cap(content) newMessage = self.client.swroll.parseRoll("#"+str(ctx.message.author.id),command) messageList = newMessage.split("\n") diff --git a/funcs/swfuncs/swchar.py b/funcs/swfuncs/swchar.py index a590406..de8150c 100644 --- a/funcs/swfuncs/swchar.py +++ b/funcs/swfuncs/swchar.py @@ -11,7 +11,7 @@ class SwChar(): logThis("Getting name for "+self.bot.funcs.getName(user)+"'s character") userCharacter = self.bot.database["swcharacters"].find_one({"_id":user}) - if user != None: + if userCharacter != None: logThis("Name is "+userCharacter["Name"]) return userCharacter["Name"] else: @@ -496,16 +496,13 @@ class SwChar(): with open("resources/starWars/swtemplates.json", "r") as f: templates = json.load(f) newChar = templates["Character"] - print("yeet") newChar["_id"] = user - print("yeet") self.bot.database["swcharacters"].insert_one(newChar) - print("yeet") return "", "Character for " + self.bot.funcs.getName(user) + " created" else: if cmd == "Purge": logThis("Deleting "+self.bot.funcs.getName(user)+"'s character") - self.bot.database["swcharacters"].remove_one({newChar}) + self.bot.database["swcharacters"].delete_one({"_id":user}) return "", "Character for " + self.bot.funcs.getName(user) + " deleted" else: return "", self.replaceWithSpaces(str(self.charData(user,cmd)))