This commit is contained in:
Mirco Wittrien 2022-12-08 18:26:45 +01:00
parent bfcdc02077
commit cefe1260f2
2 changed files with 8 additions and 11 deletions

View File

@ -2,7 +2,7 @@
* @name ShowBadgesInChat * @name ShowBadgesInChat
* @author DevilBro * @author DevilBro
* @authorId 278543574059057154 * @authorId 278543574059057154
* @version 1.9.4 * @version 1.9.5
* @description Displays Badges (Nitro, Hypesquad, etc...) in the Chat/MemberList/DMList * @description Displays Badges (Nitro, Hypesquad, etc...) in the Chat/MemberList/DMList
* @invite Jx3TjNS * @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien * @donate https://www.paypal.me/MircoWittrien
@ -75,11 +75,9 @@ module.exports = (_ => {
specialFlag = BDFDB.NumberUtils.generateId() + "SPECIALFLAG"; specialFlag = BDFDB.NumberUtils.generateId() + "SPECIALFLAG";
this.modulePatches = { this.modulePatches = {
before: [
"MessageHeader"
],
after: [ after: [
"MemberListItem", "MemberListItem",
"MessageUsername",
"PrivateChannel", "PrivateChannel",
"UserBadges" "UserBadges"
] ]
@ -92,6 +90,9 @@ module.exports = (_ => {
} }
this.css = ` this.css = `
${BDFDB.dotCN.messageheadertext} {
display: inline-flex !important;
}
${BDFDB.dotCN._showbadgesinchatbadges} { ${BDFDB.dotCN._showbadgesinchatbadges} {
display: inline-flex !important; display: inline-flex !important;
justify-content: center; justify-content: center;
@ -125,10 +126,6 @@ module.exports = (_ => {
position: static; position: static;
margin: 0; margin: 0;
} }
${BDFDB.dotCN._showbadgesinchatbadgeschat} {
position: relative;
top: 4px;
}
${BDFDB.dotCNS.messagerepliedmessage + BDFDB.dotCN._showbadgesinchatbadgeschat} { ${BDFDB.dotCNS.messagerepliedmessage + BDFDB.dotCN._showbadgesinchatbadgeschat} {
top: 0; top: 0;
} }
@ -307,9 +304,9 @@ module.exports = (_ => {
BDFDB.MessageUtils.rerenderAll(); BDFDB.MessageUtils.rerenderAll();
} }
processMessageHeader (e) { processMessageUsername (e) {
if (!e.instance.props.message) return; if (!e.instance.props.message) return;
let [children, index] = BDFDB.ReactUtils.findParent(e.instance.props.username, {filter: n => n && n.props && typeof n.props.renderPopout == "function"}); let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {filter: n => n && n.props && typeof n.props.renderPopout == "function"});
if (index == -1) return; if (index == -1) return;
const author = e.instance.props.userOverride || e.instance.props.message.author; const author = e.instance.props.userOverride || e.instance.props.message.author;
this.injectBadges(children, author, (BDFDB.LibraryStores.ChannelStore.getChannel(e.instance.props.message.channel_id) || {}).guild_id, "chat"); this.injectBadges(children, author, (BDFDB.LibraryStores.ChannelStore.getChannel(e.instance.props.message.channel_id) || {}).guild_id, "chat");

View File

@ -355,7 +355,7 @@ module.exports = (_ => {
children: _this.defaults.buttons[this.props.type] && _this.defaults.buttons[this.props.type].icons ? (_this.defaults.buttons[this.props.type].icons[this.props.icon] || _this.defaults.buttons[this.props.type].icons[0]) : "?", children: _this.defaults.buttons[this.props.type] && _this.defaults.buttons[this.props.type].icons ? (_this.defaults.buttons[this.props.type].icons[this.props.icon] || _this.defaults.buttons[this.props.type].icons[0]) : "?",
onClick: this.props.disabled ? _ => {} : this.props.onClick, onClick: this.props.disabled ? _ => {} : this.props.onClick,
onContextMenu: this.props.disabled ? _ => {} : this.props.onContextMenu, onContextMenu: this.props.disabled ? _ => {} : this.props.onContextMenu,
}), "active", "disabled", "renderPopout", "icon", "type")); }), "active", "disabled", "renderPopout", "icon", "type", "player"));
return !this.props.disabled && typeof this.props.renderPopout == "function" ? BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.PopoutContainer, { return !this.props.disabled && typeof this.props.renderPopout == "function" ? BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.PopoutContainer, {
children: button, children: button,
animation: BDFDB.LibraryComponents.PopoutContainer.Animation.SCALE, animation: BDFDB.LibraryComponents.PopoutContainer.Animation.SCALE,