#You have few possibilities.
#If you want to find the system_channel (Discord's welcome messages gets send here):
@client.event
async def on_ready():
for guild in client.guilds:
channel = guild.system_channel #getting system channel
if channel.permissions_for(guild.me).send_messages: #making sure you have permissions
await channel.send("I'm online!")
#This way you will find the first channel to which you have permissions:
@client.event
async def on_ready():
for guild in client.guilds:
for channel in guild.text_channels: #getting only text channels
if channel.permissions_for(guild.me).send_messages: #checking if you have permissions
await channel.send("I'm online!")
break #breaking so you won't send messages to multiple channels
# code by RiveN (stack overflow User:14048071/riven)