check message.server discord.py code example
Example 1: discord.py fetch channel
await client.fetch_channel(channelId)
Example 2: get guild from a channel discord py
channel.guild
await client.fetch_channel(channelId)
channel.guild