#error: AttributeError: 'NoneType' object has no attribute 'send'

1 messages · Page 1 of 1 (latest)

brave slate
#

Hi, I want to implement the usual logs in my bot, but so that the ID of the channel to which the message should be sent is taken from the database. I get an error in the event handler while trying to send a message to the channel I need. I have tried a lot - nothing helps, I will be grateful for the help. Screenshots of the code and errors attached.

warm tiger
#

Bot.get_channel may return None if the channel wasn't found in the bot's cache

#

and that happens because you probably don't have the guilds intent enabled, and thus the channels are not being cached

brave slate
warm tiger
#

can you give the full traceback please?

warm tiger
#

okay so can you debug what's result1 before you get the channel?

barren pebble
#

solved

brave slate
#

Solved the problem by replacing self.bot.get_channel() with await self.bot.fetch_channel()