T
T
Telmor2021-10-14 17:50:30
Python
Telmor, 2021-10-14 17:50:30

How to make 10 buttons in discord_components?

I have a message that needs 10 buttons. I do everything without cogs (there are reasons). In cogs I can, but not without. Please help me figure out how to do it.
My trial code:

@bot.command()
async def buttons(ctx):
    emb=discord.Embed(
        title='Кнопки',
        description=f'Нажмите цифру.'
    )
    await ctx.send(embed=emb,
                   components=[
                     [
                        Button(style=ButtonStyle.gray, label='1', custom_id='1'),
                        Button(style=ButtonStyle.gray, label='2', custom_id='2'),
                        Button(style=ButtonStyle.gray, label='3', custom_id='3'),
                        Button(style=ButtonStyle.gray, label='4', custom_id='4'),
                        Button(style=ButtonStyle.gray, label='5', custom_id='5')
                               ],
                   [
                        Button(style=ButtonStyle.gray, label='6', custom_id='6'),
                        Button(style=ButtonStyle.gray, label='7', custom_id='7')
                             ]
                   ] )
    responce = await bot.wait_for('button_click')
    if responce.component.custom_id == '1':
        await ctx.send('1')
    elif responce.component.custom_id == '2':
        await ctx.send('2')
    elif responce.component.custom_id == '3':
        await ctx.send('3')
    elif responce.component.custom_id == '4':
        await ctx.send('4')
    elif responce.component.custom_id == '5':
        await ctx.send('5')
    elif responce.component.custom_id == '6':
        await ctx.send('7')
    elif responce.component.custom_id == '7':
        await ctx.send('7')

Imports:
import discord
from discord.ext import commands
from discord_components import *
from dislash import *


This is not all, but which are active in the file.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
RieldaBot, 2021-10-21
@RieldaBot

Seems like it's impossible

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question