簡體   English   中英

Discord.py ctx 命令沒有響應

[英]Discord.py ctx commands not responding

我的 ctx 命令都不起作用。 這里我舉個例子。 當我說p!test我希望它打印hi並說test ,但它沒有響應。 有人可以幫忙嗎?

@client.command()
async def test(ctx):
    print('hi')
    await ctx.channel.send('test')

如果您使用on_message事件,則必須在事件的最后一行“處理命令”。 否則,您的命令將不起作用。

@client.event
async def on_message(message):
    ...
    await client.process_commands(message)

參考

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM