为什么on_message停止命令工作?
基本上,一切似乎工作正常并启动,但由于某种原因我不能调用任何命令。我一直在寻找一个小时,看着示例/观看视频,我不能为我的生活弄清楚出了什么问题。代码如下:
import discordimport asynciofrom discord.ext import commands bot = commands.Bot(command_prefix = '-')@bot.event async def on_ready(): print('Logged in as') print(bot.user.name) print(bot.user.id) print('------')@bot.event async def on_message(message): if message.content.startswith('-debug'): await message.channel.send('d')@bot.command(pass_context=True)async def ping(ctx): await ctx.channel.send('Pong!')@bot.command(pass_context=True)async def add(ctx, *, arg): await ctx.send(arg)
我在on_message中的调试输出实际上工作并响应,并且整个机器人运行没有任何异常,但它只是不会调用命令。
芜湖不芜
相关分类