【发布时间】:2018-09-25 00:40:56
【问题描述】:
当我的代码中有on_message() 时,它会停止所有其他@bot.command 命令的工作。我试过await bot.process_commands(message),但这也不起作用。这是我的代码:
@bot.event
@commands.has_role("Owner")
async def on_message(message):
if message.content.startswith('/lockdown'):
await bot.process_commands(message)
embed = discord.Embed(title=":warning: Do you want to activate Lock Down?", description="Type 'confirm' to activate Lock Down mode", color=0xFFFF00)
embed.add_field(name="\u200b", value="Lock Down mode is still in early development, expect some issues")
channel = message.channel
await bot.send_message(message.channel, embed=embed)
msg = await bot.wait_for_message(author=message.author, content='confirm')
embed = discord.Embed(title=":white_check_mark: Lock Down mode successfully activated", description="To deactivate type '/lockdownstop'", color=0x00ff00)
embed.add_field(name="\u200b", value="Lock Down mode is still in early development, expect some issues")
await bot.send_message(message.channel, embed=embed)
【问题讨论】:
-
如果您使用的是
commands扩展,为什么要处理on_message中的命令?
标签: python discord.py