Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_emojize_name_only():
for name in emoji.EMOJI_UNICODE.keys():
actual = emoji.emojize(name, False)
expected = emoji.EMOJI_UNICODE[name]
assert expected == actual, "%s != %s" % (expected, actual)
def test_emojize_name_only():
for name in emoji.EMOJI_UNICODE.keys():
actual = emoji.emojize(name, False)
expected = emoji.EMOJI_UNICODE[name]
assert expected == actual, "%s != %s" % (expected, actual)
Example:
# Get information of the emoji ":Kappa:"
;emote :Kappa:
"""
try: # If emote given is custom emote
emote = await roxbot.converters.Emoji().convert(ctx, emote)
em = discord.Embed(title=emote.name, colour=roxbot.EmbedColours.blue)
em.add_field(name="ID", value=str(emote.id), inline=False)
if isinstance(emote, discord.Emoji):
em.add_field(name="Guild", value=str(emote.guild), inline=False)
em.add_field(name="Created At", value=roxbot.datetime.format(emote.created_at), inline=False)
em.set_image(url=emote.url)
return await ctx.send(embed=em)
except commands.errors.BadArgument: # unicode emoji
title = emoji.demojize(emote)
if not emoji.EMOJI_UNICODE.get(title):
raise commands.BadArgument("Could not convert input to either unicode emoji or Discord custom emote.")
emojis = []
for char in emote:
emojis.append(hex(ord(char))[2:])
if len(emojis) > 1:
svg_url = "https://twemoji.maxcdn.com/2/svg/{0}-{1}.svg".format(*emojis)
png_url = "https://twemoji.maxcdn.com/2/72x72/{0}-{1}.png".format(*emojis)
else:
svg_url = "https://twemoji.maxcdn.com/2/svg/{0}.svg".format(*emojis)
png_url = "https://twemoji.maxcdn.com/2/72x72/{0}.png".format(*emojis)
em = discord.Embed(title=title, colour=roxbot.EmbedColours.blue)
em.description = "[SVG Link]({0})\n[PNG Link]({1})".format(svg_url, png_url)
em.set_image(url=png_url)
NotSyncingError,
ParseError,
IncompleteLoginError )
from .parsers import ( slack_markdown_to_hangups,
hangups_markdown_to_slack )
from .utils import ( _slackrtms,
_slackrtm_conversations_set,
_slackrtm_conversations_get )
logger = logging.getLogger(__name__)
# fix for simple_smile support
emoji.EMOJI_UNICODE[':simple_smile:'] = emoji.EMOJI_UNICODE[':smiling_face:']
emoji.EMOJI_ALIAS_UNICODE[':simple_smile:'] = emoji.EMOJI_UNICODE[':smiling_face:']
class SlackMessage(object):
def __init__(self, slackrtm, reply):
self.text = None
self.user = None
self.username = None
self.username4ho = None
self.realname4ho = None
self.tag_from_slack = None
self.edited = None
self.from_ho_id = None
self.sender_id = None
self.channel = None
self.file_attachment = None