简体   繁体   中英

Deleted messages logging not working discord.py

I want to create an event which prints any deleted message

here is my code

@client.event
async def on_message_delete(message):
    print(message)

This doesn't print anything and there aren't any errors

Maybe this has something to do with intents?

The correct way to make the deleted message get printed would be:

@client.event
async def on_message_delete(message):
    print(message.content)

message.content contains the content of the message which gets printed upon deletion of the message.

If the message is not found in the internal message cache, then this event will not be called. This means that your bot must be running before the message that will be removed is sent.

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