Skip to content
Discussion options

You must be logged in to vote

Hello, the Bot and AutoShardedBot classes already come with a CommandTree attached that you can add commands to:

bot = commands.Bot(...)

@bot.tree.command()
async def example(interaction: discord.Interaction) -> None:
    ...

Commands inside Cogs also work out of the box and are added and removed with the cog:

class Example(commands.Cog):
    @discord.app_commands.command()
    async def example(self, interaction: discord.Interaction) -> None:
        ...

async def setup(bot: commands.Bot) -> None:
    await bot.add_cog(Example())  # Commands are added to bot.tree, can be used and synced to Discord by you

Syncing the tree to Discord is still your responsibility when using the commands e…

Replies: 7 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by Rapptz
Comment options

You must be logged in to vote
1 reply
@LostLuma
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@LostLuma
Comment options

Comment options

You must be logged in to vote
1 reply
@LostLuma
Comment options

Comment options

You must be logged in to vote
1 reply
@LostLuma
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants