為什么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中的調試輸出實際上工作并響應,并且整個機器人運行沒有任何異常,但它只是不會調用命令。
添加回答
舉報
0/150
提交
取消