@bot.event
@addLogger
async def on_ready():
logger.info(f'{bot.user.name} has connected to Discord!')
try :
synced = await bot.tree.sync()
print(f"Synced {len(synced)} command")
except Exception as e:
print(e)
但不在
list_cogs
我已经试图返回
@addLogger
@bot.tree.command(name="list_cogs", description="list all cogs")
async def list_cogs(interaction):
await interaction.response.send_message(f"{cogList}")
而不是commands.check(add_logger)
add_logger
,但最终完全不工作
您需要在
@addLogger
线之后拥有
@bot.tree.command()
。因此,正确的代码将为@bot.tree.command(name="list_cogs", description="list all cogs")
@addLogger
async def list_cogs(interaction):
await interaction.response.send_message(f"{cogList}")