I'm trying to make an embed with a button, and when you click on the button creates a channel and the bot DM you with a embed, but i got an error trying to get the channel by bot.get_channel(channel_id)
This is my code:
try:
server = await bot.fetch_guild(server_id)
channel = server.get_channel(channel_id)
view = View()
except Exception as e:
print(f"Error: {e}")
else:
embed.set_author(name=server.name, icon_url=server.icon.url)
await interaction.response.defer()
await channel.send(embed=embed, view=view)
Also i try debug it using
print(channel)
print(channel.id)
Output:
None129
129xxxxxxxxxxxx6
OBS: I use interaction.response.defer() for the command, because it is log and have a delay to send.
Try to use fetch_channel() method