!give command now adds people to database 🐛

This commit is contained in:
NikolajDanger
2020-12-02 21:50:55 +01:00
parent 4e978d5194
commit 01553d5ffc

View File

@@ -23,13 +23,16 @@ class GamesCog(commands.Cog):
@commands.command() @commands.command()
async def give(self, ctx, *, content): async def give(self, ctx, *, content):
commands = content.split(" ") commands = content.split(" ")
if len(commands) == 2: amount = int(commands[-1])
amount = int(commands[1]) username = " ".join(commands[:-1])
response = self.client.money.giveMoney("#"+str(ctx.message.author.id),commands[0],amount) if self.client.funcs.getID(username) == None:
await ctx.send(response) async for member in ctx.guild.fetch_members(limit=None):
else: if member.display_name.lower() == username.lower():
logThis("I didn't understand that (error code 1222)",str(ctx.message.channel.id)) username = member.display_name
await ctx.send("I didn't understand that (error code 1222)") userID = "#" + str(member.id)
self.client.database["users"].insert_one({"_id":userID,"user name":username,"money":0})
response = self.client.money.giveMoney("#"+str(ctx.message.author.id),username,amount)
await ctx.send(response)
# Invest GwendoBucks in the stock market # Invest GwendoBucks in the stock market
@commands.command(aliases=["i"]) @commands.command(aliases=["i"])