def is_publicly_visible(bot: Dogbot, channel: discord.TextChannel) -> bool:
"""
Returns whether a text channel should be considered as "publicly visible".
If the guild has been configured to log all message events, this will always return True.
Args:
bot: The bot instance.
channel: The channel to check for.
Returns:
Whether the text channel is considered "publicly visible".
"""
# guild is configured to log all message events
if await bot.config_is_set(channel.guild, 'log_all_message_events'):
return True
# find the @everyone overwrite for the channel
everyone_overwrite = discord.utils.find(lambda t: t[0].name == '@everyone', channel.overwrites)
return everyone_overwrite is None or everyone_overwrite[1].read_messages is not False
评论列表
文章目录