nextcord.py bot has no attribute slash_command

Viewed 36

This used to work before but now it has started displaying this error

@bot.slash_command(name="ping", description="Shows the ping", guild_ids=[988865437272010762])
AttributeError: 'Bot' object has no attribute 'slash_command'
1 Answers

Just use these lines of code

tree = bot.tree
@tree.command(name="ping", description="Shows the ping", guild_ids=[988865437272010762])

Of course, no need to redefine tree for each command.

Related