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
评论列表
文章目录