Attached images shows up in embed

This commit is contained in:
Jeremy Zhang 2017-04-08 15:32:28 -07:00
parent f056b303f8
commit 1a0f6a6089

View File

@ -258,6 +258,18 @@ function parse_message_time(message) {
return message; return message;
} }
function parse_message_attachments(message) {
for (var i = 0; i < message.attachments.length; i++) {
var attach = "";
if (message.content.length != 0) {
attach = " ";
}
attach += message.attachments[i].url;
message.content += attach;
}
return message;
}
function fill_discord_messages(messages, jumpscroll) { function fill_discord_messages(messages, jumpscroll) {
if (messages.length == 0) { if (messages.length == 0) {
return last_message_id; return last_message_id;
@ -270,6 +282,7 @@ function fill_discord_messages(messages, jumpscroll) {
message = replace_message_mentions(message); message = replace_message_mentions(message);
message = format_bot_message(message); message = format_bot_message(message);
message = parse_message_time(message); message = parse_message_time(message);
message = parse_message_attachments(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": message.content}); 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": message.content});
$("#chatcontent").append(rendered); $("#chatcontent").append(rendered);
last = message.id; last = message.id;