Answer the question
In order to leave comments, you need to log in
Why did the bot suddenly stop getting channel id in discord.py?
Hello. There is a code for getting a channel ID and sending a message:
channel = bot.get_channel(787656357670420500)
await channel.send(embed=embed1)
AttributeError: 'NoneType' object has no attribute 'send'
Answer the question
In order to leave comments, you need to log in
You may be trying to get a channel when the bot has not yet connected to the Discord system, as a result, the bot is trying to fetch the channel from the cache.
Correctly
class MyBot(commands.Bot):
async def on_ready(self):
channel = self.get_channel(787656357670420500)
class MyBot(commands.Bot):
def __init__(self):
channel = self.get_channel(787656357670420500)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question