I tried syncing with ctx.bot.tree.sync(), but I always get an error that the Bot object has no attribute tree
Main.py (sync command)
@bot.slash_command(name="sync")
async def sync(ctx):
await ctx.defer(ephemeral=True)
cmds = await ctx.bot.tree.sync()
await ctx.send(f"succesfully synced {len(cmds)} commands global")
Syncing commands in Pycord
The way you sync commands for discord.py and Pycord are different because of how they're structured. In the docs, this is how you sync for Pycord:
See here
This should be done automatically if you didn't override
on_connect. There's also a warning under on_connect that says:To check if the bot connects, use a listener instead.
Example code: