Now parsing custom emoji

This commit is contained in:
JustMaffie
2017-05-28 23:45:58 +02:00
parent 5607d1ad92
commit 82bccb7188
2 changed files with 23 additions and 2 deletions

View File

@ -1,7 +1,26 @@
from titanembeds.utils import discord_api
import re
def parseEmoji(textToParse, guild_id):
_endpoint = "/guilds/{guild_id}".format(guild_id=guild_id)
_method = "GET"
return ""
response = discord_api.request(_method, _endpoint)
emojis = []
emojis = re.findall(":(.*?):", textToParse)
newText = textToParse
for emoji in response['emojis']:
name = emoji['name']
emojiId = emoji['id']
for emoji2 in emojis:
if name.lower is emoji2.replace(":", "").lower():
newText = newText.replace(":{}:".format(name), "<img src='https://cdn.discordapp.com/emojis/{}.png'></img>".format(id))
return newText
#Default emoji object here
#{
#"require_colons": true,
#"managed": false,
#"name": "sh",
#"roles": [],
#"id": "318499652175396866"
#}