1 回答

TA貢獻(xiàn)1797條經(jīng)驗(yàn) 獲得超6個(gè)贊
覆蓋提供的默認(rèn)值on_message會(huì)禁止運(yùn)行任何額外的命令。要解決此問(wèn)題,請(qǐng)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)
添加回答
舉報(bào)