From bbc7a505e4fe8b52cec2111a03b326caf9b0e019 Mon Sep 17 00:00:00 2001 From: Cynthia Foxwell Date: Mon, 16 Jan 2023 11:38:27 -0700 Subject: [PATCH] utility.presence: use author field for custom emotes --- src/modules/utility.js | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/modules/utility.js b/src/modules/utility.js index b1eaa2d..c4a4206 100644 --- a/src/modules/utility.js +++ b/src/modules/utility.js @@ -725,20 +725,26 @@ presence.callback = async function (msg, line) { for (const index in target.presence.activities) { const activity = target.presence.activities[index]; if (activity.type == 4) { - let emote = ""; + const embed = {}; + if (activity.emoji) { if (activity.emoji.id) { - emote = `<${activity.emoji.animated ? "a" : ""}:${ - activity.emoji.name - }:${activity.emoji.id}>`; + const url = `https://cdn.dicordapp.com/emojis/${ + activity.emoji.id + }.${activity.emoji.animated ? "gif" : "png"}`; + embed.author = { + url, + icon_url: url, + name: activity.state ?? "", + }; } else { - emote = activity.emoji.name; + embed.title = `${activity.emoji.name} ${activity.state ?? ""}`; } + } else { + embed.title = activity.state ?? ""; } - embeds.push({ - title: `${emote} ${activity.state ?? ""}`, - }); + embeds.push(embed); } else { const embed = { title: `${PRESENCE_TYPES[activity.type]} **${activity.name}**`,