How to avoid 403 Forbidden errors with fetch_channel()? #9814
-
I've got a piece of code that accepts a async def foo(client: discord.Client, guild: discord.Guild, channel_id: int):
if not guild.me.guild_permissions.read_messages:
return None
return client.fetch_channel(channel_id) But every now and then, I do get the occasional 403 Forbidden error from this code:
Just wondering if I can maybe prevent this from happening by making a different permissions check? AFAIK I should only need |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You're checking for guild permissions but channel permissions can forbid someone from viewing a channel. |
Beta Was this translation helpful? Give feedback.
You're checking for guild permissions but channel permissions can forbid someone from viewing a channel.