Minimal Reproducible Code
Precondition: Your bot has 1 or more commands registered already.
import discord
import os
bot = discord.Bot()
@bot.event
async def on_ready():
print(f"Logged in as {bot.user}")
await bot.sync_commands(delete_existing=False)
bot.auto_sync_commands = False
bot.run(os.environ['DISCORD_TOKEN'])
Result
Ignoring exception in on_ready
Traceback (most recent call last):
File "...\discord\client.py", line 465, in _run_event
await coro(*args, **kwargs)
File "...\PycordTesting\stand_alone_main.py", line 206, in on_ready
await bot.sync_commands(delete_existing=False)
File "...\discord\bot.py", line 766, in sync_commands
registered_commands = await self.register_commands(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "...\discord\bot.py", line 619, in register_commands
data = [cmd["command"].to_dict() for cmd in filtered_deleted]
^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Command' object has no attribute 'to_dict'
This error is pretty self explanatory and will likely be resolved by creating a simple wrapper class for the deleted commands instead of the namedtuple.
Minimal Reproducible Code
Precondition: Your bot has 1 or more commands registered already.
Result
This error is pretty self explanatory and will likely be resolved by creating a simple wrapper class for the deleted commands instead of the namedtuple.