简体   繁体   中英

Discord.py ctx commands not responding

None of my ctx commands work. Here I'll give an example. When I say p!test I want it to print hi and say test , but it's not responding. Can someone help?

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

If you're using a on_message event, you have to 'process commands' in the last line of the event. Otherwise, your commands won't work.

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

Reference

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM