Fun.py 文件源码

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

项目:TwentyTwo 作者: EPITECH-2022 项目源码 文件源码
def emoji(self, context):
        ''' Sends a text and replace letters with regional indicators '''
        from unidecode   import unidecode
        content = self.bot.get_text(context)
        if content in [None, '', ' '] or context.invoked_with == 'riz' and not self.bot.is_owner(context.message.author):
            return
        msg = ''
        if context.invoked_with in ['ri', 'bi']:
            msg += '`{}`: '.format(context.message.author)
        for c in content:
            if c.isalpha():
                b = context.invoked_with == 'bi' and c in ['b', 'B', 'p', 'P']
                if b:
                    msg += ':b:'
                else:
                    msg += ':regional_indicator_{}:'.format(unidecode(c.lower()))
            else:
                msg += c
        await self.bot.say(msg)
        await self.bot.replied(context)
        if context.invoked_with in ['ri', 'riz', 'bi']:
            try:
                await self.bot.delete_message(context.message)
            except discord.errors.Forbidden:
                pass
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号