【发布时间】:2023-03-12 22:52:01
【问题描述】:
我正在尝试制作一个记录未知命令的日志系统:
@client.event
async def on_command_error(ctx, error):
channel = client.get_channel(test)
await channel.send(f"**{ctx.author.mention} **SEND COMMAND: ** `{ctx.prefix}{ctx.command.name}` **IN CHANNEL: ** {ctx.channel.mention}!")
但是发送None,有什么想法吗?
【问题讨论】:
-
"但是发送
None" -- 因为命令没有被执行 -
我知道,我要求修复
-
if isinstance(error, CommandNotFound):如果找不到命令,则会记录错误。 -
但是我可以打印吗?我之前试过
-
查看这篇文章,如果它有帮助stackoverflow.com/questions/52900101/…
标签: python discord.py