'How do i send a message in a specific channel when my bot start

I would like to send a message in a channel when my bot starts here is my code

@client.event
async def on_ready():
    print("Bot is running")
    activity = discord.Game(name="!test", type=3)
    await client.change_presence(status=discord.Status.idle, activity=activity)
    #issue starts here
    client.getchannel(944607968211652631)
    await client.channel.send("I am online")

I have tried a different way aswell

async def on_ready():
    print("Bot is running")
    activity = discord.Game(name="!test", type=3)
    await client.change_presence(status=discord.Status.idle, activity=activity)
    on = client.getchannel(944607968211652631)
    await on.channel.send("I am online")

but this also has not worked



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source