mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2024-11-15 02:21:21 +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,
|
"require_colons": emote.require_colons,
|
||||||
"managed": emote.managed,
|
"managed": emote.managed,
|
||||||
"roles": list_role_ids(emote.roles),
|
"roles": list_role_ids(emote.roles),
|
||||||
"url": emote.url
|
"url": emote.url,
|
||||||
|
"animated": emote.animated
|
||||||
})
|
})
|
||||||
return emojis
|
return emojis
|
||||||
|
|
||||||
|
@ -21,6 +21,10 @@ def parse_emoji(textToParse, guild_id):
|
|||||||
for gemoji in guild_emojis:
|
for gemoji in guild_emojis:
|
||||||
emoji_name = gemoji["name"]
|
emoji_name = gemoji["name"]
|
||||||
emoji_id = gemoji["id"]
|
emoji_id = gemoji["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))
|
textToParse = textToParse.replace(":{}:".format(emoji_name), "<:{}:{}>".format(emoji_name, emoji_id))
|
||||||
return textToParse
|
return textToParse
|
||||||
|
|
||||||
|
@ -212,7 +212,7 @@
|
|||||||
Mustache.parse(template);
|
Mustache.parse(template);
|
||||||
for (var i = 0; i < emoji_store.length; i++) {
|
for (var i = 0; i < emoji_store.length; i++) {
|
||||||
var emoji = emoji_store[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);
|
var jqueryed = $(rendered);
|
||||||
jqueryed.click(function () {
|
jqueryed.click(function () {
|
||||||
var emote_name = $(this).attr("data-tooltip");
|
var emote_name = $(this).attr("data-tooltip");
|
||||||
@ -995,8 +995,13 @@
|
|||||||
Mustache.parse(template);
|
Mustache.parse(template);
|
||||||
for (var i = 0; i < emoji_store.length; i++) {
|
for (var i = 0; i < emoji_store.length; i++) {
|
||||||
var emoji = emoji_store[i];
|
var emoji = emoji_store[i];
|
||||||
var emoji_format = "<:" + emoji.name + ":" + emoji.id + ">";
|
var emoji_format = "";
|
||||||
var rendered = Mustache.render(template, {"id": emoji.id, "name": emoji.name}).trim();
|
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);
|
message.content = message.content.replaceAll(emoji_format, rendered);
|
||||||
}
|
}
|
||||||
var rendered = Mustache.render(template, {"id": "$2", "name": "$1"}).trim();
|
var rendered = Mustache.render(template, {"id": "$2", "name": "$1"}).trim();
|
||||||
|
@ -322,7 +322,7 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script id="mustache_message_emoji" type="text/template">
|
<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>
|
||||||
|
|
||||||
<script id="mustache_discordmention" type="text/template">
|
<script id="mustache_discordmention" type="text/template">
|
||||||
|
Loading…
Reference in New Issue
Block a user