mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2024-11-15 02:21:21 +01:00
Emoji icons showing up in embed
This commit is contained in:
parent
5610197041
commit
a4ed38e59d
@ -241,6 +241,14 @@ a {
|
|||||||
width: 305px;
|
width: 305px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.message_emoji {
|
||||||
|
height: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.message_emoji:hover {
|
||||||
|
height: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: Whitney;
|
font-family: Whitney;
|
||||||
font-style: light;
|
font-style: light;
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
var last_message_id; // last message tracked
|
var last_message_id; // last message tracked
|
||||||
var selected_channel = guild_id; // user selected channel, defaults to #general channel
|
var selected_channel = guild_id; // user selected channel, defaults to #general channel
|
||||||
var guild_channels = {}; // all server channels used to highlight channels in messages
|
var guild_channels = {}; // all server channels used to highlight channels in messages
|
||||||
|
var emoji_store = {}; // all server emojis
|
||||||
var times_fetched = 0; // kept track of how many times that it has fetched
|
var times_fetched = 0; // kept track of how many times that it has fetched
|
||||||
var fetch_error_count = 0; // Number of errors fetch has encountered
|
var fetch_error_count = 0; // Number of errors fetch has encountered
|
||||||
var priority_query_guild = false; // So you have selected a channel? Let's populate it.
|
var priority_query_guild = false; // So you have selected a channel? Let's populate it.
|
||||||
@ -275,6 +276,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function prepare_guild(guildobj) {
|
function prepare_guild(guildobj) {
|
||||||
|
emoji_store = guildobj.emojis;
|
||||||
fill_channels(guildobj.channels);
|
fill_channels(guildobj.channels);
|
||||||
fill_discord_members(guildobj.discordmembers);
|
fill_discord_members(guildobj.discordmembers);
|
||||||
fill_authenticated_users(guildobj.embedmembers.authenticated);
|
fill_authenticated_users(guildobj.embedmembers.authenticated);
|
||||||
@ -519,6 +521,18 @@
|
|||||||
}
|
}
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function parse_emoji_in_message(message) {
|
||||||
|
var template = $('#mustache_message_emoji').html();
|
||||||
|
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();
|
||||||
|
message.content = message.content.replace(emoji_format, rendered);
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
function fill_discord_messages(messages, jumpscroll) {
|
function fill_discord_messages(messages, jumpscroll) {
|
||||||
if (messages.length == 0) {
|
if (messages.length == 0) {
|
||||||
@ -534,7 +548,9 @@
|
|||||||
message = parse_message_time(message);
|
message = parse_message_time(message);
|
||||||
message = parse_message_attachments(message);
|
message = parse_message_attachments(message);
|
||||||
message = parse_channels_in_message(message);
|
message = parse_channels_in_message(message);
|
||||||
var rendered = Mustache.render(template, {"id": message.id, "full_timestamp": message.formatted_timestamp, "time": message.formatted_time, "username": message.author.username, "discriminator": message.author.discriminator, "content": nl2br(escapeHtml(message.content))});
|
message.content = escapeHtml(message.content);
|
||||||
|
message = parse_emoji_in_message(message);
|
||||||
|
var rendered = Mustache.render(template, {"id": message.id, "full_timestamp": message.formatted_timestamp, "time": message.formatted_time, "username": message.author.username, "discriminator": message.author.discriminator, "content": nl2br(message.content)});
|
||||||
$("#chatcontent").append(rendered);
|
$("#chatcontent").append(rendered);
|
||||||
last = message.id;
|
last = message.id;
|
||||||
handle_last_message_mention();
|
handle_last_message_mention();
|
||||||
|
@ -186,6 +186,10 @@
|
|||||||
<script id="mustache_memberrole" type="text/template">
|
<script id="mustache_memberrole" type="text/template">
|
||||||
<li><a class="subheader role-title">{{name}}</a></li>
|
<li><a class="subheader role-title">{{name}}</a></li>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<script id="mustache_message_emoji" type="text/template">
|
||||||
|
<img class="message_emoji" src='https://cdn.discordapp.com/emojis/{{id}}.png' title=":{{name}}:" />
|
||||||
|
</script>
|
||||||
{% endraw %}
|
{% endraw %}
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
Loading…
Reference in New Issue
Block a user