How do I close a discord bots dms
h
DrSovietSoviet (0)

Recently my bot has been used by people it's not supposed to be used by via dms how would I disable it's dms as a quick work around?

You are viewing a single comment. View All
Answered by InvisibleOne (3263) [earned 5 cycles]
View Answer
xfinnbar (211)

Override the default on_message event and check if the channel is a DM before processing commands. If you are using bot instead of client for discordpy, then change client to bot: