This commit is contained in:
Mirco Wittrien 2023-11-04 11:55:04 +01:00
parent 280770f612
commit 2e8a1ac805
3 changed files with 14 additions and 20 deletions

View File

@ -84,7 +84,7 @@ module.exports = (_ => {
this.modulePatches = {
before: [
"MessageHeader",
"MessageUsername",
"NameContainer"
],
after: [
@ -387,14 +387,12 @@ module.exports = (_ => {
BDFDB.MessageUtils.rerenderAll();
}
processMessageHeader (e) {
processMessageUsername (e) {
if (!e.instance.props.message) return;
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;
let index = e.instance.props.compact ? 1 : 0;
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");
if (!BDFDB.ArrayUtils.is(e.instance.props.decorations[index])) e.instance.props.decorations[index] = [e.instance.props.decorations[index]].filter(n => n);
this.injectBadges(e.instance.props.decorations[index], author, (BDFDB.LibraryStores.ChannelStore.getChannel(e.instance.props.message.channel_id) || {}).guild_id, "chat");
}
processNameContainer (e) {

View File

@ -91,7 +91,7 @@ module.exports = (_ => {
this.modulePatches = {
before: [
"MessageHeader",
"MessageUsername",
"NameContainer"
],
after: [
@ -271,15 +271,13 @@ module.exports = (_ => {
}
}
processMessageHeader (e) {
processMessageUsername (e) {
if (!e.instance.props.message || !this.settings.tagPlaces.chat) 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) 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, {
if (!BDFDB.ArrayUtils.is(e.instance.props.decorations[0])) e.instance.props.decorations[0] = [e.instance.props.decorations[0]].filter(n => n);
this.injectStaffTag(e.instance.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

View File

@ -77,7 +77,7 @@ module.exports = (_ => {
this.modulePatches = {
before: [
"MessageHeader",
"MessageUsername",
"NameContainer"
],
after: [
@ -175,22 +175,20 @@ module.exports = (_ => {
});
}
processMessageHeader (e) {
processMessageUsername (e) {
if (!e.instance.props.message) return;
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;
let index = e.instance.props.compact ? 1 : 0;
if (!BDFDB.ArrayUtils.is(username.props.decorations[index])) username.props.decorations[index] = [username.props.decorations[index]].filter(n => n);
if (this.settings.general.addUserId && this.settings.general.userIdFirst) this.injectIdTag(username.props.decorations[index], author, "chat", {
if (!BDFDB.ArrayUtils.is(e.instance.props.decorations[index])) e.instance.props.decorations[index] = [e.instance.props.decorations[index]].filter(n => n);
if (this.settings.general.addUserId && this.settings.general.userIdFirst) this.injectIdTag(e.instance.props.decorations[index], author, "chat", {
tagClass: e.instance.props.compact ? BDFDB.disCN.messagebottagcompact : BDFDB.disCN.messagebottagcozy,
useRem: true
});
if (this.settings.places.chat) this.injectRoleTag(username.props.decorations[index], author, "chat", -1, {
if (this.settings.places.chat) this.injectRoleTag(e.instance.props.decorations[index], author, "chat", -1, {
tagClass: e.instance.props.compact ? BDFDB.disCN.messagebottagcompact : BDFDB.disCN.messagebottagcozy,
useRem: true
});
if (this.settings.general.addUserId && !this.settings.general.userIdFirst) this.injectIdTag(username.props.decorations[index], author, "chat", {
if (this.settings.general.addUserId && !this.settings.general.userIdFirst) this.injectIdTag(e.instance.props.decorations[index], author, "chat", {
tagClass: e.instance.props.compact ? BDFDB.disCN.messagebottagcompact : BDFDB.disCN.messagebottagcozy,
useRem: true
});