utility.presence: add image texts

This commit is contained in:
Cynthia Foxwell 2023-01-12 23:44:53 -07:00
parent 7cecf20a9d
commit c5825aed4d

View file

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