utility.py 文件源码

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

项目:goldmine 作者: Armored-Dragon 项目源码 文件源码
def charinfo(self, ctx, *, uchars: str):
        """Get the Unicode info for a character or characters.
        Usage: charinfo [character(s)]"""
        no_preview = [
            '\u0020',
            '\uFEFF'
        ]
        cinfo = commands.Paginator(prefix='', suffix='', max_size=(1999 if self.bot.selfbot else 2000))
        for char in list(uchars.replace('\n', '')):
            hexp = str(hex(ord(char))).replace('0x', '').upper()
            while len(hexp) < 4:
                hexp = '0' + hexp
            preview = f' (`{char}`)'
            cinfo.add_line(f'U+{hexp} {unicodedata.name(char)} {char}' + (preview if char not in no_preview else ''))
        if len(cinfo.pages) > 5:
            await ctx.send('Too long, trimming to 5 pages.')
        for page in cinfo.pages[0:5]:
            await ctx.send(page)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号