utility.presence: add image texts

This commit is contained in:
Cynthia Foxwell 2023-01-12 23:44:53 -07:00
parent 7cecf20a9d
commit c5825aed4d
1 changed files with 12 additions and 8 deletions

View File

@ -742,6 +742,7 @@ presence.callback = async function (msg, line) {
} else { } else {
const embed = { const embed = {
title: `${PRESENCE_TYPES[activity.type]} **${activity.name}**`, title: `${PRESENCE_TYPES[activity.type]} **${activity.name}**`,
fields: [],
}; };
const descLines = []; const descLines = [];
if (activity.type == 2) { if (activity.type == 2) {
@ -788,15 +789,18 @@ presence.callback = async function (msg, line) {
} }
} }
if (activity.buttons && activity.metadata?.button_urls) { if (activity.assets?.large_text && activity.type != 2) {
const buttons = []; embed.fields.push({
for (let i = 0; i < activity.buttons.length; i++) { name: "Large Text",
buttons.push( value: activity.assets.large_text,
`[${activity.buttons[i]}](${activity.metadata.button_urls[i]})` });
); }
}
descLines.push(buttons.join(" | ")); if (activity.assets?.small_text) {
embed.fields.push({
name: "Small Text",
value: activity.assets.small_text,
});
} }
embed.description = descLines.join("\n"); embed.description = descLines.join("\n");