Reputation: 13
On startup it should write a message in one of the text channels.
Error: 'NoneType' object has no attribute 'send'
channel = client.get_channel(111111111) #I have the real id
message = ("Wow")
@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))
await client.change_presence(status=discord.Status.online, activity=game)
await channel.send(message)
Upvotes: 0
Views: 990
Reputation: 4225
Bot
can get channel once it ready, that means before the bot is not ready you can't get a channel. And as you can see you are doing get_channel()
before on_ready()
event, i.e. Before the bot is ready.
Get the channel in on_ready
event and that should be good to go.
@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))
await client.change_presence(status=discord.Status.online, activity=game) #game is not defined make sure to define it
channel = client.get_channel(channel_id)
await channel.send("Wow")
Upvotes: 2