From 7782efa70657657728a34b69e30f02c1326b6d0e Mon Sep 17 00:00:00 2001 From: Cynthia Foxwell Date: Wed, 14 Aug 2024 00:03:11 -0600 Subject: [PATCH] userinfo: uninline hacks, color fallback --- src/modules/utility/userinfo.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/modules/utility/userinfo.js b/src/modules/utility/userinfo.js index bed3e11..6fbba8f 100644 --- a/src/modules/utility/userinfo.js +++ b/src/modules/utility/userinfo.js @@ -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);