utility.presence: use author field for custom emotes

This commit is contained in:
Cynthia Foxwell 2023-01-16 11:38:27 -07:00
parent c5825aed4d
commit bbc7a505e4

View file

@ -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}**`,