D
D
Dream2021-07-25 16:20:24
Python
Dream, 2021-07-25 16:20:24

How to make one command transfer the user to another command?

Is it possible to make it so that with one command it transfers the user to another command? For example, use this in the balance: the command shows the balance and the message has a top-up button - clicking on it redirects to the top-up command

Answer the question

In order to leave comments, you need to log in

1 answer(s)
X
x4zx, 2021-07-25
@x4zx

Here is a code example with replacing one embed with another as you need. You can make your changes so that the function works as you need.

@bot.command()
async def balance(ctx, member: discord.Member = None):
    
    if member is None:
        member = ctx.author
      
    a = discord.Embed(title = f'Баланс пользователя - {member}', description = 'Баланс пользователя исходя уже из вашего кода', colour = 0x2F3136)
    c = await ctx.send(
        embed = a,
        components = [
            Button(style = ButtonStyle.gray, label = 'Пополнить', emoji = '')
        ]
    )

    b = discord.Embed(title = 'Пополнить баланс', description = 'Чтобы пополнить баланс сделайте...', colour = 0x2F3136)

    res = await bot.wait_for('button_click')
    if res.component.label == 'Пополнить':
            await res.respond(type = 6)
            await c.edit(embed = b)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question