mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2024-11-14 18:11:23 +01:00
Animated Emoji Support, Closes #85
This commit is contained in:
parent
b61d249fe6
commit
63979835ab
@ -44,7 +44,8 @@ def get_emojis_list(guildemojis):
|
||||
"require_colons": emote.require_colons,
|
||||
"managed": emote.managed,
|
||||
"roles": list_role_ids(emote.roles),
|
||||
"url": emote.url
|
||||
"url": emote.url,
|
||||
"animated": emote.animated
|
||||
})
|
||||
return emojis
|
||||
|
||||
|
@ -21,7 +21,11 @@ def parse_emoji(textToParse, guild_id):
|
||||
for gemoji in guild_emojis:
|
||||
emoji_name = gemoji["name"]
|
||||
emoji_id = gemoji["id"]
|
||||
textToParse = textToParse.replace(":{}:".format(emoji_name), "<:{}:{}>".format(emoji_name, emoji_id))
|
||||
emoji_animated = gemoji["animated"]
|
||||
if emoji_animated:
|
||||
textToParse = textToParse.replace(":{}:".format(emoji_name), "<a:{}:{}>".format(emoji_name, emoji_id))
|
||||
else:
|
||||
textToParse = textToParse.replace(":{}:".format(emoji_name), "<:{}:{}>".format(emoji_name, emoji_id))
|
||||
return textToParse
|
||||
|
||||
|
||||
|
@ -212,7 +212,7 @@
|
||||
Mustache.parse(template);
|
||||
for (var i = 0; i < emoji_store.length; i++) {
|
||||
var emoji = emoji_store[i];
|
||||
var rendered = Mustache.render(template, {"id": emoji.id, "name": emoji.name}).trim();
|
||||
var rendered = Mustache.render(template, {"id": emoji.id, "name": emoji.name, "animated": emoji.animated}).trim();
|
||||
var jqueryed = $(rendered);
|
||||
jqueryed.click(function () {
|
||||
var emote_name = $(this).attr("data-tooltip");
|
||||
@ -995,8 +995,13 @@
|
||||
Mustache.parse(template);
|
||||
for (var i = 0; i < emoji_store.length; i++) {
|
||||
var emoji = emoji_store[i];
|
||||
var emoji_format = "<:" + emoji.name + ":" + emoji.id + ">";
|
||||
var rendered = Mustache.render(template, {"id": emoji.id, "name": emoji.name}).trim();
|
||||
var emoji_format = "";
|
||||
if (emoji.animated) {
|
||||
emoji_format = "<a:" + emoji.name + ":" + emoji.id + ">";
|
||||
} else {
|
||||
emoji_format = "<:" + emoji.name + ":" + emoji.id + ">";
|
||||
}
|
||||
var rendered = Mustache.render(template, {"id": emoji.id, "name": emoji.name, "animated": emoji.animated}).trim();
|
||||
message.content = message.content.replaceAll(emoji_format, rendered);
|
||||
}
|
||||
var rendered = Mustache.render(template, {"id": "$2", "name": "$1"}).trim();
|
||||
|
@ -322,7 +322,7 @@
|
||||
</script>
|
||||
|
||||
<script id="mustache_message_emoji" type="text/template">
|
||||
<img class="message_emoji tooltipped" src='https://cdn.discordapp.com/emojis/{{id}}.png' data-position="top" data-delay="200" data-tooltip=":{{name}}:" alt=":{{name}}:" />
|
||||
<img class="message_emoji tooltipped" src='https://cdn.discordapp.com/emojis/{{id}}{{#animated}}.gif{{/animated}}{{^animated}}.png{{/animated}}' data-position="top" data-delay="200" data-tooltip=":{{name}}:" alt=":{{name}}:" />
|
||||
</script>
|
||||
|
||||
<script id="mustache_discordmention" type="text/template">
|
||||
|
Loading…
Reference in New Issue
Block a user