Skip to content
Advertisement

Discord.py Making the bot not interact with DM channels

I am writing a small message logging program, I want the bot to only log messages from a specific Guild and for that, I check for the message.guild.id. This, however, raises a problem when there is a message sent in a DM Channel. I want the bot to ignore the Dm channel completely but I did not have much luck in that

The Code:

JavaScript
JavaScript

Advertisement

Answer

You can just do

JavaScript

That’s it. There’s no need of checking for types.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement