From 2eb189049a23767383f5e2ba5915b1e0f010052d Mon Sep 17 00:00:00 2001 From: Mirco Wittrien Date: Sat, 4 Nov 2023 11:36:41 +0100 Subject: [PATCH] stuff --- Plugins/ShowBadgesInChat/ShowBadgesInChat.plugin.js | 5 +++-- Plugins/StaffTag/StaffTag.plugin.js | 8 +++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Plugins/ShowBadgesInChat/ShowBadgesInChat.plugin.js b/Plugins/ShowBadgesInChat/ShowBadgesInChat.plugin.js index b78fee5ed7..04cf726522 100644 --- a/Plugins/ShowBadgesInChat/ShowBadgesInChat.plugin.js +++ b/Plugins/ShowBadgesInChat/ShowBadgesInChat.plugin.js @@ -392,8 +392,9 @@ module.exports = (_ => { let username = BDFDB.ReactUtils.findChild(e.instance.props.username, {filter: n => n && n.props && n.props.decorations}); if (!username) return; const author = e.instance.props.userOverride || e.instance.props.message.author; - if (!BDFDB.ArrayUtils.is(username.props.decorations[1])) username.props.decorations[1] = [username.props.decorations[1]].filter(n => n); - this.injectBadges(username.props.decorations[1], author, (BDFDB.LibraryStores.ChannelStore.getChannel(e.instance.props.message.channel_id) || {}).guild_id, "chat"); + let index = e.instance.props.cozy ? 0 : 1; + if (!BDFDB.ArrayUtils.is(username.props.decorations[index])) username.props.decorations[index] = [username.props.decorations[index]].filter(n => n); + this.injectBadges(username.props.decorations[index], author, (BDFDB.LibraryStores.ChannelStore.getChannel(e.instance.props.message.channel_id) || {}).guild_id, "chat"); } processNameContainer (e) { diff --git a/Plugins/StaffTag/StaffTag.plugin.js b/Plugins/StaffTag/StaffTag.plugin.js index 472ff98e91..04d161d57c 100644 --- a/Plugins/StaffTag/StaffTag.plugin.js +++ b/Plugins/StaffTag/StaffTag.plugin.js @@ -273,11 +273,13 @@ module.exports = (_ => { processMessageHeader (e) { if (!e.instance.props.message || !this.settings.tagPlaces.chat) return; - let [children, index] = BDFDB.ReactUtils.findParent(e.instance.props.username, {filter: n => n && n.props && typeof n.props.renderPopout == "function"}); - if (index == -1) return; const author = e.instance.props.userOverride || e.instance.props.message.author; let userType = this.getUserType(author, e.instance.props.message.channel_id); - if (userType) this.injectStaffTag(children, author, userType, e.instance.props.compact ? index : (index + 2), { + if (!userType) return; + let username = BDFDB.ReactUtils.findChild(e.instance.props.username, {filter: n => n && n.props && n.props.decorations}); + if (!username) return; + if (!BDFDB.ArrayUtils.is(username.props.decorations[0])) username.props.decorations[0] = [username.props.decorations[0]].filter(n => n); + this.injectStaffTag(username.props.decorations[0], author, userType, 0, { channelId: e.instance.props.message.channel_id, tagClass: e.instance.props.compact ? BDFDB.disCN.messagebottagcompact : BDFDB.disCN.messagebottagcozy, useRem: true