D
D
Denis QSTER2020-05-02 16:30:24
Python
Denis QSTER, 2020-05-02 16:30:24

How to make code that does something like a discord.py bank?

I have a code (it will be at the very end) that gives something like a salary and I want to make a code that makes a command balanceand this command shows how much I have in my account, but I don’t know how to do it
Code:

@client.command()
@commands.cooldown(1, 30, commands.BucketType.user)
async def bonus(ctx):
    amount = random.randint(10, 50)
    embed=discord.Embed(title="Зарплата", description="Вы можете получить зарплату каждый день!", color=0xff8040)
    embed.add_field(name="Вы получили зарплату в размере ", value=f"{amount} тысяч", inline=False)
    await ctx.send(embed = embed)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nitagas_r, 2020-07-06
@Nitagas_r

Here is the finished code for you, you can also ask questions on the discord servers, for example: https:// discord.gg /NfTf9JD remove spaces

@client.command()
async def balance(ctx, member: discord.Member = None):
    await ctx.channel.purge( limit = 1 )
    if member is None:
        await ctx.author.send(embed = discord.Embed(
            description = f"""**{ctx.author}** ваш баланс составляет **{cursor.execute("SELECT cash From users WHERE id = {}".format(ctx.author.id)).fetchone()[0]} :dollar:**"""
        ))
        
        
    
    else:
        await ctx.author.send(embed = discord.Embed(
            description = f"""Баланс пользователя **{member}** составляет **{cursor.execute("SELECT cash From users WHERE id = {}".format(member.id)).fetchone()[0]} :dollar:**"""
        ))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question