Update StaffTag.plugin.js

This commit is contained in:
Mirco Wittrien 2022-08-31 12:54:06 +02:00
parent f36873cf15
commit 086327956f
1 changed files with 24 additions and 7 deletions

View File

@ -2,7 +2,7 @@
* @name StaffTag
* @author DevilBro
* @authorId 278543574059057154
* @version 1.5.4
* @version 1.5.5
* @description Adds a Crown/Tag to Server Owners (or Admins/Management)
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
@ -17,13 +17,8 @@ module.exports = (_ => {
"info": {
"name": "StaffTag",
"author": "DevilBro",
"version": "1.5.4",
"version": "1.5.5",
"description": "Adds a Crown/Tag to Server Owners (or Admins/Management)"
},
"changeLog": {
"improved": {
"Custom Title Option": "Using the crown icons and changing the custom titles, will now also change the title in the tooltip text"
}
}
};
@ -100,6 +95,7 @@ module.exports = (_ => {
MessageUsername: "default",
VoiceUser: "render",
NameTag: "default",
UsernameSection: "default",
UserPopoutInfo: "UserPopoutInfo"
}
};
@ -304,10 +300,15 @@ module.exports = (_ => {
inject = this.settings.tagPlaces.userPopout;
tagClass = BDFDB.disCNS.userpopoutheaderbottag + BDFDB.disCN.bottagnametag;
}
else if (e.instance.props.className.indexOf(BDFDB.disCN.userpopoutusernametagnonickname) > -1) {
inject = this.settings.tagPlaces.userPopout;
tagClass = BDFDB.disCNS.userpopoutusernamebottag + BDFDB.disCN.bottagnametag;
}
else if (e.instance.props.className.indexOf(BDFDB.disCN.userprofilenametag) > -1) {
inject = this.settings.tagPlaces.userProfile;
tagClass = BDFDB.disCNS.userprofilebottag + BDFDB.disCN.bottagnametag;
}
console.log(e);
if (inject) this.injectStaffTag(e.returnvalue.props.children, e.instance.props.user, userType, 2, {
tagClass: tagClass,
useRem: e.instance.props.useRemSizes,
@ -317,6 +318,22 @@ module.exports = (_ => {
}
}
processUsernameSection (e) {
if (e.instance.props.user && this.settings.tagPlaces.userPopout) {
let userType = this.getUserType(e.instance.props.user, e.instance.props.channel && e.instance.props.channel.id);
if (userType) {
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {props: [["className", BDFDB.disCN.userpopoutusernamenickname]]});
if (index > -1) {
if (!BDFDB.ArrayUtils.is(children[index].props.children)) children[index].props.children = [children[index].props.children].flat(10);
this.injectStaffTag(children[index].props.children, e.instance.props.user, userType, 2, {
tagClass: BDFDB.disCNS.userpopoutheaderbottag + BDFDB.disCN.bottagnametag,
inverted: typeof e.instance.getMode == "function" && e.instance.getMode() !== "Normal"
});
}
}
}
}
processUserPopoutInfo (e) {
if (e.instance.props.user && this.settings.tagPlaces.userPopout) {
let userType = this.getUserType(e.instance.props.user, e.instance.props.channel && e.instance.props.channel.id);