Most Efficient Way of Monitoring Messages in Specific Guild #396
-
Im working on a program that uses self tokens to monitor server messages for specific items being dropped and then will automatically redeem them with selenium, and I have a working method, but Im not sure if its the best (I will occasionally get errors about it when). The check for messages in specific guild code I have right now is as follows:
The error I usually get is: "AttributeError: 'NoneType' object has no attribute 'id'" and Im unsure how, or if I can fix it, or if there is a better way to monitor just one server. EDIT: This error appears even if there are no new messages being sent in the server. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
That's because @bot.event
async def on_message(message):
if message.guild and message.guild.id == GUILDID: |
Beta Was this translation helpful? Give feedback.
That's because
on_message
event also catches direct messages. Try with