#๐ help me, I can't list slash commands.
33 messages ยท Page 1 of 1 (latest)
@timber ruin
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.
I am trying to make a slash command with discord.py I have tried a lot of stuff it doesn't seem to be working. Help would be appreciated.
You need to create tree of slash commands
did you sync
@app_commands.command(...) already does that for you
you can set a guild id to make the sync regional
so sync in only 1 server
but if left out, it's rolled out to all servers
Thanks for pointing that out
await sync(*, guild=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Syncs the application commands to Discord.
This also runs the translator to get the translated strings necessary for feeding back into Discord.
This must be called for the application commands to show up.
anyways
@timber ruin most likely you need to sync your command tree
which you can do with this
welp
@bot.command()
async def sync(ctx):
await ctx.tree.sync() # sync to all servers
await ctx.reply("Synced all commands!")
this is the absolute minimum of a sync command
i'll get you a professional one in a second
so I use cogs to load commands could this be causing this slashs command synchronization error?
because I have another command called list and it is listing on discord.
do note that since you're on PC, you'll need to refresh your client with Ctrl+R
probably just forgot to sync
try syncing first
I curated and created a pretty full-featured command for syncing your CommandTree, you can see it here:
Apparently, what I understand is that the synchronization is correct. so on discord itself it doesn't list the command when you type /
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.