modlog.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:dogbot 作者: slice 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号