@bot.event
async def on_command(ctx):
channel = bot.get_channel(msg_dump_channel)
server = ctx.guild.name
user = ctx.author
command = ctx.command
await channel.send('{} used {} in {}'.format(user, command, server))
我尝试在 ctx.command 中使用 if "command_name": 但我得到 TypeError: 'Command' 类型的参数不可迭代
答案 0 :(得分:0)
列出您要记录的命令集并检查用户的命令是否在该集合中:
commands_to_log = {'command1','command2'}
if ctx.command.name in commands_to_log:
await channel.send("Your log message")