1 回答
TA贡献1797条经验 获得超6个赞
覆盖提供的默认值on_message会禁止运行任何额外的命令。要解决此问题,请client.process_commands(message)在on_message.
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content.startswith('>hello'):
msg = 'Hello, {0.author.mention}!'.format(message)
await message.channel.send(msg)
await client.process_commands(message) # <----
@client.command(name="pomodoro")
async def _pomodoro(ctx):
await ctx.channel.send("Let's grab some tomatoes! For how many minutes?")
def check(msg):
return msg.author == ctx.author and msg.channel == ctx.channel and \
type(msg.content) == int
msg = await client.wait_for("message", check=check)
添加回答
举报