mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2024-12-25 06:27:03 +01:00
Fixed emoji parser
This commit is contained in:
parent
47015330de
commit
25da43263e
@ -5,7 +5,7 @@ def parseEmoji(textToParse, guild_id):
|
|||||||
_endpoint = "/guilds/{guild_id}".format(guild_id=guild_id)
|
_endpoint = "/guilds/{guild_id}".format(guild_id=guild_id)
|
||||||
_method = "GET"
|
_method = "GET"
|
||||||
response = discord_api.request(_method, _endpoint)
|
response = discord_api.request(_method, _endpoint)
|
||||||
if 'code' not in response['content']:
|
if not response.get("success", False):
|
||||||
return textToParse
|
return textToParse
|
||||||
emojis = []
|
emojis = []
|
||||||
emojis = re.findall("<:(.*?):(.*)?>", textToParse)
|
emojis = re.findall("<:(.*?):(.*)?>", textToParse)
|
||||||
@ -14,6 +14,6 @@ def parseEmoji(textToParse, guild_id):
|
|||||||
name = emoji['name']
|
name = emoji['name']
|
||||||
emojiId = emoji['id']
|
emojiId = emoji['id']
|
||||||
for emoji2 in emojis:
|
for emoji2 in emojis:
|
||||||
if name.lower is emoji2.replace(":", "").lower():
|
if name.lower() == emoji2[0].lower():
|
||||||
newText = newText.replace("<:{}}:{}>".format(name, emojiId), "<img src='https://cdn.discordapp.com/emojis/{}.png'></img>".format(emojiId))
|
newText = newText.replace("<:{}:{}>".format(name, emojiId), "<img src='https://cdn.discordapp.com/emojis/{}.png'></img>".format(emojiId))
|
||||||
return newText
|
return newText
|
||||||
|
Loading…
Reference in New Issue
Block a user