Json 我试图检查数据库中是否存在不一致的用户ID,但该命令仅在用户不一致时运行。python @commands.command() async def withdraw(self, ctx, account: discord.User, money):

Json 我试图检查数据库中是否存在不一致的用户ID,但该命令仅在用户不一致时运行。python @commands.command() async def withdraw(self, ctx, account: discord.User, money): ,json,python-3.x,discord.py,bots,Json,Python 3.x,Discord.py,Bots,我试图检查数据库中是否存在不一致的用户ID,但该命令仅在用户不一致时运行。python @commands.command() async def withdraw(self, ctx, account: discord.User, money): users = await self.get_bank_data() if not await self.check_if_exists(str(account.id)): print('here')

我试图检查数据库中是否存在不一致的用户ID,但该命令仅在用户不一致时运行。python
 @commands.command()
async def withdraw(self, ctx, account: discord.User, money):
    users = await self.get_bank_data()
    if not await self.check_if_exists(str(account.id)):
        print('here')
        bankteller = discord.Embed(
            description='Hey {usr}, i wanted to inform you there was a banking error, i cannot transfer fund because {sendto} do not have an account on file with us.'.format(
                usr=ctx.author.name, sendto=account),
            color=0xbf9626)
        bankteller.set_author(name='Automated Bank Teller System')
        bankteller.set_thumbnail(url='https://pays.host/uploads/bad83582-0b90-40ef-90f5-dd23b0ddbd42/T1cJqj6B.png')
        await ctx.author.send(embed=bankteller)

    elif not str(ctx.author.id) in users:
        bankteller = discord.Embed(
            description='Hey {usr}, it seems you are trying to transfer funds but we do not have an account on file for you, not a problem to create an account use &db create_account.'.format(
                usr=ctx.author.name, sendto=account),
            color=0xbf9626)
        bankteller.set_author(name='Automated Bank Teller System')
        bankteller.set_thumbnail(url='https://pays.host/uploads/bad83582-0b90-40ef-90f5-dd23b0ddbd42/T1cJqj6B.png')
        await ctx.author.send(embed=bankteller)
    elif int(money) < 0:
        bankteller = discord.Embed(
            description='Hey {usr}, when transferring funds to another account you must use positive numbers only.'.format(
                usr=ctx.author.name),
            color=0xbf9626)
        bankteller.set_author(name='Automated Bank Teller System')
        bankteller.set_thumbnail(url='https://pays.host/uploads/bad83582-0b90-40ef-90f5-dd23b0ddbd42/T1cJqj6B.png')
        await ctx.author.send(embed=bankteller)
    elif int(money) > users[str(ctx.author.id)]['wallet']:
        bankteller = discord.Embed(
            description='Hey {usr}, i wanted to let you know that you wanted to transfer {trans} but you only have {current} in your account, so i can now process your transfer request right now'.format(
                trans=money, current=users[str(ctx.author.id)]['wallet'], usr=ctx.author),
            color=0xbf9626)
        bankteller.set_author(name='Automated Bank Teller System')
        bankteller.set_thumbnail(url='https://pays.host/uploads/bad83582-0b90-40ef-90f5-dd23b0ddbd42/T1cJqj6B.png')
        await ctx.author.send(embed=bankteller)
    else:
        users[str(ctx.author.id)]['wallet'] -= int(money)
        users[str(account.id)]['wallet'] += int(money)

        with open(my_file, 'w') as f:
            json.dump(users, f)


        bankteller = discord.Embed(
            description='Hey {usr}, i just wanted to let you know that someone initiated a transfer of funds into your account and that i finished proccessing it, the details can be found below, have a blessed day!'.format(
                usr=account),
            color=0xbf9626)
        bankteller.add_field(name='Payee:', value='{sender}'.format(sender=ctx.author))
        bankteller.add_field(name='Amount:', value='{money} (Dc)'.format(money=money))
        bankteller.add_field(name='Current Balance:', value='{money} (Dc)'.format(
            money=users[str(str(account.id))]['wallet']))
        bankteller.set_author(name='Automated Bank Teller System')
        bankteller.set_thumbnail(url='https://pays.host/uploads/bad83582-0b90-40ef-90f5-dd23b0ddbd42/T1cJqj6B.png')
        await account.send(embed=bankteller)
    async def check_if_exists(self, userid):
    users = await self.get_bank_data()
    if userid in users:
        return True
    else:
        return False