bot.py 文件源码

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

项目:dogbot 作者: slice 项目源码 文件源码
def tick(self, tick_type: str, *, raw: bool = False, guild: Guild = None) -> str:
        """
        Returns a custom tick emoji.

        Args:
            tick_type: The tick type to return. Either "green" or "red".
            raw: Specifies whether the returned tick shouldn't be in emoji message formatting form.
            guild: Specifies the guild that this reaction will be used in. Used in checking if we can actually use the
                   ticks. If not, we return the unicode alternatives instead.

        Returns: The tick.
        """
        raw_tick = '\U00002705' if tick_type == 'green' else '\U0000274c'

        # use raw ticks if we can't use external emoji, or we want to
        if guild and not guild.me.guild_permissions.external_emojis:
            return raw_tick

        try:
            # fetch tick from config
            custom_tick = self.cfg['bot']['emoji'][tick_type + '_tick']
            return custom_tick if raw else f'<:{custom_tick}>'
        except KeyError:
            return raw_tick
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号