🪛 Fixed swroll bug

This commit is contained in:
NikolajDanger
2020-11-01 18:41:07 +01:00
parent 9ba9a7b86c
commit 27ab89b5b6
2 changed files with 3 additions and 6 deletions

View File

@ -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")

View File

@ -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)))