#πŸ”’ Help command

97 messages Β· Page 1 of 1 (latest)

tawdry crater
#
@bot.slash_command(name="help", description="See all avaiable bot commands")
async def help(ctx):
    with open('config.json') as f:
        config = json.load(f)
    bot_invite_link = config['bot_invite_link']

    embed = nextcord.Embed(title="Command List", color=0x00ff00)
    button1 = nextcord.ui.Button(style=nextcord.ButtonStyle.blurple, label="】 Developer", emoji="πŸ§‘β€πŸ’»")
    button2 = nextcord.ui.Button(style="link", url=bot_invite_link, label="】 Invite Me", emoji="🧷")
    view = nextcord.ui.View()
    view.add_item(button1)
    view.add_item(button2)

    embed.add_field(name="", value="
ping, help, purge, embed
", inline=False)
    embed.set_footer(text="Made by: 479u", icon_url="https://cdn3.emoji.gg/emojis/4205-orange-discord-pfp.png")
    await ctx.send(embed=embed, view=view)
    dev = await bot.wait_for("button_click", timeout=10)
    if dev.custom_id == "button2":
        await ctx.message.send("Bot Developer: `479u`", ephemeral=True)```


it doesnt send message when button2 clicked. please help me
merry reefBOT
#

@tawdry crater

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

tawdry crater
#

it doesnt send message when button2 clicked. please help me

sinful scroll
#

of course it is a link

tawdry crater
#

???

tawdry crater
#

i mean when i click it i want to it send message

#

but it doesnt

sinful scroll
#

full code

#

send error

tawdry crater
#

no error

#
@bot.slash_command(name="help", description="See all avaiable bot commands")
async def help(ctx):
    with open('config.json') as f:
        config = json.load(f)
    bot_invite_link = config['bot_invite_link']

    embed = nextcord.Embed(title="Command List", color=0x00ff00)
    button1 = nextcord.ui.Button(style=nextcord.ButtonStyle.blurple, label="】 Developer", emoji="πŸ§‘β€πŸ’»")
    button2 = nextcord.ui.Button(style="link", url=bot_invite_link, label="】 Invite Me", emoji="🧷")
    view = nextcord.ui.View()
    view.add_item(button1)
    view.add_item(button2)

    embed.add_field(name="", value="
ping, help, purge, embed
", inline=False)
    embed.set_footer(text="Made by: 479u", icon_url="https://cdn3.emoji.gg/emojis/4205-orange-discord-pfp.png")
    await ctx.send(embed=embed, view=view)
    dev = await bot.wait_for("button_click", timeout=10)
    if dev.custom_id == "button2":
        await ctx.message.send("Bot Developer: `479u`", ephemeral=True)```


it doesnt send message when button2 clicked. please help me
#

@sinful scroll

#

everything works

#

no errors

#

but i made it

#

and i wanted it after clicking button to send this message

#

but it doesnt

sinful scroll
#

ah

#

use the defualt callback

tawdry crater
#

wym?

#

i dont understand

#
Traceback (most recent call last):
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1264.0_x64__qbz5n2kfra8p0\Lib\asyncio\tasks.py", line 520, in wait_for
    return await fut
           ^^^^^^^^^
asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\Radek\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\nextcord\application_command.py", line 918, in invoke_callback_with_hooks
    await self(interaction, *args, **kwargs)
  File "c:\Users\Radek\Desktop\Pliki\Python\Discord Bot\main.py", line 36, in help
    dev = await bot.wait_for("button_click", timeout=10)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1264.0_x64__qbz5n2kfra8p0\Lib\asyncio\tasks.py", line 519, in wait_for
    async with timeouts.timeout(timeout):
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1264.0_x64__qbz5n2kfra8p0\Lib\asyncio\timeouts.py", line 115, in __aexit__
    raise TimeoutError from exc_val
TimeoutError

The above exception was the direct cause of the following exception:

nextcord.errors.ApplicationInvokeError: Command raised an exception: TimeoutError:```
#

i get this

#

@sinful scroll

sinful scroll
#

send now code

tawdry crater
#

its the same

#
@bot.slash_command(name="help", description="See all avaiable bot commands")
async def help(ctx):
    with open('config.json') as f:
        config = json.load(f)
    bot_invite_link = config['bot_invite_link']

    embed = nextcord.Embed(title="Command List", color=0x00ff00)
    button1 = nextcord.ui.Button(style=nextcord.ButtonStyle.blurple, label="】 Developer", emoji="πŸ§‘β€πŸ’»")
    button2 = nextcord.ui.Button(style="link", url=bot_invite_link, label="】 Invite Me", emoji="🧷")
    view = nextcord.ui.View()
    view.add_item(button1)
    view.add_item(button2)

    embed.add_field(name="", value="ping, help, purge, embed", inline=False)
    embed.set_footer(text="Made by: 479u", icon_url="https://cdn3.emoji.gg/emojis/4205-orange-discord-pfp.png")
    await ctx.send(embed=embed, view=view)
    dev = await bot.wait_for("button_click", timeout=10)
    if dev.custom_id == "button2":
        await ctx.message.send("Bot Developer: `479u`", ephemeral=True)```
tawdry crater
pliant lotus
tawdry crater
pliant lotus
tawdry crater
#

i did 100

#

and still doesnt work

#

it doesnt send this message

pliant lotus
#

It would be better if you make a separate class for the view and buttons and can handle the interactions there.

tawdry crater
#

i dont understand that much

#

im just starting

#

idk how to make it ;/

pliant lotus
tawdry crater
#

nextcord

#

its easier to use

pliant lotus
tawdry crater
#

how to do it?

#

here are docs

#

i dont rly know much abt using

#

just basics

pliant lotus
tawdry crater
#

still doesnt work ;/

#
@bot.slash_command(name="help", description="See all avaiable bot commands")
async def help(ctx):
    with open('config.json') as f:
        config = json.load(f)
    bot_invite_link = config['bot_invite_link']

    embed = nextcord.Embed(title="Command List", color=0x00ff00)
    button1 = nextcord.ui.Button(style=nextcord.ButtonStyle.blurple, label="】 Developer", emoji="πŸ§‘β€πŸ’»")
    button2 = nextcord.ui.Button(style="link", url=bot_invite_link, label="】 Invite Me", emoji="🧷")
    view = nextcord.ui.View()
    view.add_item(button1)
    view.add_item(button2)

    embed.add_field(name="", value="ping, help, purge, embed", inline=False)
    embed.set_footer(text="Made by: 479u", icon_url="https://cdn3.emoji.gg/emojis/4205-orange-discord-pfp.png")
    await ctx.send(embed=embed, view=view)
    dev = await bot.wait_for("button_click", timeout=100)
    if dev.custom_id == "button2":
        await ctx.respond("Bot Developer: `479u`", ephemeral=True)
pliant lotus
#

How do you have your bot instance defined?

tawdry crater
pliant lotus
#

The Client object only contains events, if you want to use commands you must use the Bot object

tawdry crater
tawdry crater
#

i want use my bot globally

#

so without this guild it

#

i have it on 3 servers

#

so what schould i change here?

pliant lotus
tawdry crater
#

alr

#

sec

#

i changed

#

but still it doesnt

#

send me anything when i click

#

button ;/

pliant lotus
#

Remove the command buttons and make a separate class. There are examples in the repository.

tawdry crater
#
Traceback (most recent call last):
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1264.0_x64__qbz5n2kfra8p0\Lib\asyncio\tasks.py", line 520, in wait_for
    return await fut
           ^^^^^^^^^
asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\Radek\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\nextcord\application_command.py", line 918, in invoke_callback_with_hooks
    await self(interaction, *args, **kwargs)
  File "c:\Users\Radek\Desktop\Pliki\Python\Discord Bot\main.py", line 36, in help
    dev = await bot.wait_for("button_click", timeout=100)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1264.0_x64__qbz5n2kfra8p0\Lib\asyncio\tasks.py", line 519, in wait_for
    async with timeouts.timeout(timeout):
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1264.0_x64__qbz5n2kfra8p0\Lib\asyncio\timeouts.py", line 115, in __aexit__
    raise TimeoutError from exc_val
TimeoutError

The above exception was the direct cause of the following exception:

nextcord.errors.ApplicationInvokeError: Command raised an exception: TimeoutError:```
tawdry crater
#

idk how

#

but ill try firure out

pliant lotus
#

Try simple things, don't try to do complex things yet

tawdry crater
#

alr

#

can u send me link to example?

#

and i wont bother you again πŸ˜‰

tawdry crater
#

which one?

pliant lotus
#

explore all examples and practice

tawdry crater
#

but what exactly

#

idk what i am looking for

#

i just want my button to respond when clicked

tawdry crater
#

oo

#

lemme try it

merry reefBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.