This commit is contained in:
Mirco Wittrien 2020-10-07 10:20:55 +02:00
parent 9162c7e1d8
commit 0f34080202
4 changed files with 54 additions and 47 deletions

View File

@ -5,8 +5,13 @@ module.exports = (_ => {
"info": {
"name": "BadgesEverywhere",
"author": "DevilBro",
"version": "1.6.0",
"version": "1.6.1",
"description": "Displays Badges (Nitro, HypeSquad, etc...) in the chat/memberlist/userpopout."
},
"changeLog": {
"fixed": {
"Chat": "Works again in chat"
}
}
};
return !window.BDFDB_Global || (!window.BDFDB_Global.loaded && !window.BDFDB_Global.started) ? class {
@ -48,7 +53,7 @@ module.exports = (_ => {
this.patchedModules = {
after: {
MemberListItem: "render",
MessageHeader: "default",
MessageUsername: "default",
UserPopout: "render"
}
};
@ -372,10 +377,9 @@ module.exports = (_ => {
}
}
processMessageHeader (e) {
processMessageUsername (e) {
if (e.instance.props.message && settings.showInChat) {
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue.props.children.slice(1), {name: "Popout", props: [["className", BDFDB.disCN.messageusername]]});
if (index > -1) this.injectBadges(e.instance, children, e.instance.props.message.author, "chat");
this.injectBadges(e.instance, e.returnvalue.props.children, e.instance.props.message.author, "chat");
}
}

View File

@ -5,12 +5,12 @@ module.exports = (_ => {
"info": {
"name": "EditUsers",
"author": "DevilBro",
"version": "3.9.7",
"version": "3.9.8",
"description": "Allows you to change the icon, name, tag and color of users."
},
"changeLog": {
"added": {
"Do not overwrite role color": "Added option to not overwrite rolecolor in chats and memberlist"
"fixed": {
"Chat": "Works again in chat"
}
}
};
@ -118,6 +118,7 @@ module.exports = (_ => {
Account: "render",
PrivateChannelEmptyMessage: "default",
MessageHeader: "default",
MessageUsername: "default",
MessageContent: "type",
Reaction: "render",
Reactor: "render",
@ -547,29 +548,29 @@ module.exports = (_ => {
}
}
processMessageHeader (e) {
if (e.instance.props.message && settings.changeInChatWindow) {
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue.props.children.slice(1), {name: "Popout", props: [["className", BDFDB.disCN.messageusername]]});
if (index > -1) {
processMessageUsername (e) {
if (e.instance.props.message && settings.changeInChatWindow && e.returnvalue.props.children) {
let messageUsername = BDFDB.ReactUtils.findChild(e.returnvalue.props.children, {name: "Popout", props: [["className", BDFDB.disCN.messageusername]]});
if (messageUsername) {
let data = changedUsers[e.instance.props.message.author.id];
if (data && (data.color1 || data.color2)) {
if (children[index].props && typeof children[index].props.children == "function") {
let renderChildren = children[index].props.children;
children[index].props.children = (...args) => {
if (messageUsername.props && typeof messageUsername.props.children == "function") {
let renderChildren = messageUsername.props.children;
messageUsername.props.children = (...args) => {
let renderedChildren = renderChildren(...args);
this.changeUserColor(renderedChildren, e.instance.props.message.author.id, {guildId: (BDFDB.LibraryModules.ChannelStore.getChannel(e.instance.props.message.channel_id) || {}).guild_id});
return renderedChildren;
}
}
else this.changeUserColor(children[index], e.instance.props.message.author.id, {guildId: (BDFDB.LibraryModules.ChannelStore.getChannel(e.instance.props.message.channel_id) || {}).guild_id});
else this.changeUserColor(messageUsername, e.instance.props.message.author.id, {guildId: (BDFDB.LibraryModules.ChannelStore.getChannel(e.instance.props.message.channel_id) || {}).guild_id});
}
this.injectBadge(children, e.instance.props.message.author.id, (BDFDB.LibraryModules.ChannelStore.getChannel(e.instance.props.message.channel_id) || {}).guild_id, 2, {
}
this.injectBadge(e.returnvalue.props.children, e.instance.props.message.author.id, (BDFDB.LibraryModules.ChannelStore.getChannel(e.instance.props.message.channel_id) || {}).guild_id, 2, {
tagClass: e.instance.props.compact ? BDFDB.disCN.messagebottagcompact : BDFDB.disCN.messagebottagcozy,
useRem: true
});
}
}
}
processMessageContent (e) {
if (e.instance.props.message && settings.changeInChatWindow) {

View File

@ -5,8 +5,13 @@ module.exports = (_ => {
"info": {
"name": "OwnerTag",
"author": "DevilBro",
"version": "1.3.3",
"version": "1.3.4",
"description": "Adds a tag or crown to the server owner (or admins/management)."
},
"changeLog": {
"fixed": {
"Chat": "Works again in chat"
}
}
};
return !window.BDFDB_Global || (!window.BDFDB_Global.loaded && !window.BDFDB_Global.started) ? class {
@ -51,7 +56,7 @@ module.exports = (_ => {
this.patchedModules = {
after: {
MemberListItem: "render",
MessageHeader: "default",
MessageUsername: "default",
NameTag: "default",
UserPopout: "render"
}
@ -186,18 +191,15 @@ module.exports = (_ => {
}
}
processMessageHeader (e) {
processMessageUsername (e) {
if (e.instance.props.message && settings.addInChatWindow) {
let userType = this.getUserType(e.instance.props.message.author, e.instance.props.message.channel_id);
if (userType) {
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue.props.children.slice(1), {name: "Popout", props: [["className", BDFDB.disCN.messageusername]]});
if (index > -1) this.injectOwnerTag(children, e.instance.props.message.author, userType, e.instance.props.compact ? 0 : 2, {
if (userType) this.injectOwnerTag(e.returnvalue.props.children, e.instance.props.message.author, userType, e.instance.props.compact ? 0 : 2, {
tagClass: e.instance.props.compact ? BDFDB.disCN.messagebottagcompact : BDFDB.disCN.messagebottagcozy,
useRem: true
});
}
}
}
processNameTag (e) {
if (e.instance.props.user && e.instance.props.className) {

View File

@ -5,8 +5,13 @@ module.exports = (_ => {
"info": {
"name": "TopRoleEverywhere",
"author": "DevilBro",
"version": "3.0.3",
"version": "3.0.4",
"description": "Adds the highest role of a user as a tag."
},
"changeLog": {
"fixed": {
"Chat": "Works again in chat"
}
}
};
return !window.BDFDB_Global || (!window.BDFDB_Global.loaded && !window.BDFDB_Global.started) ? class {
@ -57,7 +62,7 @@ module.exports = (_ => {
this.patchedModules = {
after: {
MemberListItem: "render",
MessageHeader: "default"
MessageUsername: "default"
}
};
@ -89,6 +94,7 @@ module.exports = (_ => {
}
${BDFDB.dotCNS.messagecompact + BDFDB.dotCNS.messageheader + BDFDB.dotCN._toproleseverywhererolestyle} {
margin-right: 0.3rem;
text-indent: 0;
}
${BDFDB.dotCN._toproleseverywhererolestyle} {
display: inline-flex;
@ -97,9 +103,6 @@ module.exports = (_ => {
${BDFDB.dotCNS._toproleseverywhererolestyle + BDFDB.dotCN.userpopoutrolecircle} {
flex: 0 0 auto;
}
${BDFDB.dotCNS.messagecompact + BDFDB.dotCNS.messageheader + BDFDB.dotCN._toproleseverywhererolestyle} {
text-indent: 0;
}
`;
}
@ -162,21 +165,18 @@ module.exports = (_ => {
}
}
processMessageHeader (e) {
processMessageUsername (e) {
if (e.instance.props.message) {
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue.props.children.slice(1), {name: "Popout", props: [["className", BDFDB.disCN.messageusername]]});
if (index > -1) {
if (settings.showInChat) this.injectRoleTag(children, e.instance.props.message.author, "chat", {
if (settings.showInChat) this.injectRoleTag(e.returnvalue.props.children, e.instance.props.message.author, "chat", {
tagClass: e.instance.props.compact ? BDFDB.disCN.messagebottagcompact : BDFDB.disCN.messagebottagcozy,
useRem: true
});
if (settings.addUserID) this.injectIdTag(children, e.instance.props.message.author, "chat", {
if (settings.addUserID) this.injectIdTag(e.returnvalue.props.children, e.instance.props.message.author, "chat", {
tagClass: e.instance.props.compact ? BDFDB.disCN.messagebottagcompact : BDFDB.disCN.messagebottagcozy,
useRem: true
});
}
}
}
injectRoleTag (children, user, type, config = {}) {
if (!BDFDB.ArrayUtils.is(children) || !user) return;