def charinfo(self, ctx, *, chars):
"""Get unicode character info."""
if not chars:
return
chars = unicodedata.normalize('NFC', chars)
if len(chars) > 25:
await ctx.send('Too many emoji.')
return
embed = discord.Embed()
for char in chars:
uc = hex(ord(char))[2:]
name = unicodedata.name(char, 'unknown')
if name in {'SPACE', 'EM QUAD', 'EN QUAD'} or ' SPACE' in name:
char = '" "'
short = len(uc) <= 4
code = f'`\\{"u" if short else "U"}{uc.lower().zfill(4 if short else 8)}`'
embed.add_field(name=name,
value=f'{char} [{code}](http://www.fileformat.info/info/unicode/char/{uc}/index.htm)')
await ctx.send(embed=embed)
评论列表
文章目录