userinfo: uninline hacks, color fallback

This commit is contained in:
Cynthia Foxwell 2024-08-14 00:03:11 -06:00
parent b104dc7e3b
commit 7782efa706

View file

@ -16,7 +16,7 @@ const {
Icons,
} = require("@util/constants.js");
const {formatUsername, getDefaultAvatar} = require("@util/misc.js");
const {formatUsername, getDefaultAvatar, getTopColor, pastelize} = require("@util/misc.js");
const {snowflakeToTimestamp} = require("@util/time.js");
const ONE_MONTH = 2628000;
@ -289,7 +289,7 @@ userinfo.callback = async function (msg, line) {
}
const embed = {
color: user.accent_color,
color: getTopColor(msg, id, user.accent_color ?? pastelize(id)),
thumbnail: {
url: avatar,
},
@ -361,6 +361,14 @@ userinfo.callback = async function (msg, line) {
},
};
if (embed.fields.length == 2) {
// assumed created + images
embed.fields[1].inline = false;
} else if (embed.fields.length == 3) {
// assumed created + clan + images
embed.fields[2].inline = false;
}
return {embeds: [embed]};
};
hf.registerCommand(userinfo);