Update EditUsers.plugin.js

This commit is contained in:
Mirco Wittrien 2021-11-03 17:58:40 +01:00
parent 3c860318d1
commit bd64fe31fe
1 changed files with 43 additions and 8 deletions

View File

@ -2,7 +2,7 @@
* @name EditUsers * @name EditUsers
* @author DevilBro * @author DevilBro
* @authorId 278543574059057154 * @authorId 278543574059057154
* @version 4.4.1 * @version 4.4.2
* @description Allows you to locally edit Users * @description Allows you to locally edit Users
* @invite Jx3TjNS * @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien * @donate https://www.paypal.me/MircoWittrien
@ -17,12 +17,13 @@ module.exports = (_ => {
"info": { "info": {
"name": "EditUsers", "name": "EditUsers",
"author": "DevilBro", "author": "DevilBro",
"version": "4.4.1", "version": "4.4.2",
"description": "Allows you to locally edit Users" "description": "Allows you to locally edit Users"
}, },
"changeLog": { "changeLog": {
"added": { "added": {
"Show Accountname": "Similar to 'Show Nickname' you can now enable 'Show Name' which will always show the account name of a user in '()', 'Show Nickname' has a higher priority than 'Show Name'" "Show Accountname": "Similar to 'Show Nickname' you can now enable 'Show Name' which will always show the account name of a user in '()', 'Show Nickname' has a higher priority than 'Show Name'",
"Stream Preview": "Participants are also affected now"
} }
} }
}; };
@ -142,6 +143,7 @@ module.exports = (_ => {
QuickSwitchUserResult: "render", QuickSwitchUserResult: "render",
SearchPopoutComponent: "render", SearchPopoutComponent: "render",
PrivateChannelCallParticipants: "render", PrivateChannelCallParticipants: "render",
VideoParticipants: "default",
ChannelCall: "render", ChannelCall: "render",
PictureInPictureVideo: "default", PictureInPictureVideo: "default",
UserSummaryItem: "render" UserSummaryItem: "render"
@ -156,6 +158,7 @@ module.exports = (_ => {
UserPopoutInfo: "UserPopoutInfo", UserPopoutInfo: "UserPopoutInfo",
MutualFriends: "default", MutualFriends: "default",
VoiceUser: "render", VoiceUser: "render",
ParticipantsForSelectedParticipant: "default",
Account: "render", Account: "render",
PrivateChannelEmptyMessage: "default", PrivateChannelEmptyMessage: "default",
MessageUsername: "default", MessageUsername: "default",
@ -615,7 +618,7 @@ module.exports = (_ => {
let data = changedUsers[e.instance.props.user.id]; let data = changedUsers[e.instance.props.user.id];
if (data && data.name) { if (data && data.name) {
let member = BDFDB.LibraryModules.MemberStore.getMember(BDFDB.LibraryModules.LastGuildStore.getGuildId(), e.instance.props.user.id); let member = BDFDB.LibraryModules.MemberStore.getMember(BDFDB.LibraryModules.LastGuildStore.getGuildId(), e.instance.props.user.id);
e.instance.props.nick = this.getUserNick(e.instance.props.user.id, e.instance.props.nick); e.instance.props.nick = this.getUserNick(e.instance.props.user.id, e.instance.props.nick) || e.instance.props.nick;
} }
} }
else { else {
@ -631,7 +634,7 @@ module.exports = (_ => {
if (data) { if (data) {
e.instance.props.voiceStates[i] = Object.assign({}, e.instance.props.voiceStates[i]); e.instance.props.voiceStates[i] = Object.assign({}, e.instance.props.voiceStates[i]);
e.instance.props.voiceStates[i].user = this.getUserData(e.instance.props.voiceStates[i].user.id); e.instance.props.voiceStates[i].user = this.getUserData(e.instance.props.voiceStates[i].user.id);
e.instance.props.voiceStates[i].nick = this.getUserNick(e.instance.props.voiceStates[i].user.id, e.instance.props.voiceStates[i].member.nick); e.instance.props.voiceStates[i].nick = this.getUserNick(e.instance.props.voiceStates[i].user.id, e.instance.props.voiceStates[i].member.nick) || e.instance.props.voiceStates[i].nick;
} }
} }
} }
@ -1152,13 +1155,45 @@ module.exports = (_ => {
processPrivateChannelCallParticipants (e) { processPrivateChannelCallParticipants (e) {
if (BDFDB.ArrayUtils.is(e.instance.props.participants) && this.settings.places.dmCalls) { if (BDFDB.ArrayUtils.is(e.instance.props.participants) && this.settings.places.dmCalls) {
for (let participant of e.instance.props.participants) if (participant && participant.user) participant.user = this.getUserData(participant.user.id, true, true); e.instance.props.participants = [].concat(e.instance.props.participants);
for (let i in e.instance.props.participants) if (e.instance.props.participants[i] && e.instance.props.participants[i].user) e.instance.props.participants[i] = Object.assign({}, e.instance.props.participants[i], {user: this.getUserData(e.instance.props.participants[i].user.id)});
}
}
processParticipantsForSelectedParticipant (e) {
if (this.settings.places.voiceChat) {
let popout = BDFDB.ReactUtils.findChild(e.returnvalue, {name: "Popout"});
if (popout && typeof popout.props.children == "function") {
let renderChildren = popout.props.children;
popout.props.children = BDFDB.TimeUtils.suppress((...args) => {
let renderedChildren = renderChildren(...args);
for (let viewer of renderedChildren.props.children) viewer.props.src = this.getUserAvatar(viewer.key);
return renderedChildren;
});
}
if (popout && typeof popout.props.renderPopout == "function") {
let renderPopout = popout.props.renderPopout;
popout.props.renderPopout = BDFDB.TimeUtils.suppress((...args) => {
let renderedPopout = renderPopout(...args);
renderedPopout.props.users = [].concat(renderedPopout.props.users);
for (let i in renderedPopout.props.users) if (renderedPopout.props.users[i]) renderedPopout.props.users[i] = this.getUserData(renderedPopout.props.users[i].id);
return renderedPopout;
});
}
}
}
processVideoParticipants (e) {
if (BDFDB.ArrayUtils.is(e.instance.props.participants) && this.settings.places.voiceChat) {
e.instance.props.participants = [].concat(e.instance.props.participants);
for (let i in e.instance.props.participants) if (e.instance.props.participants[i] && e.instance.props.participants[i].user) e.instance.props.participants[i] = Object.assign({}, e.instance.props.participants[i], {user: this.getUserData(e.instance.props.participants[i].user.id)});
} }
} }
processChannelCall (e) { processChannelCall (e) {
if (BDFDB.ArrayUtils.is(e.instance.props.participants) && this.settings.places.dmCalls) { if (BDFDB.ArrayUtils.is(e.instance.props.participants) && this.settings.places.voiceChat) {
for (let participant of e.instance.props.participants) if (participant && participant.user) participant.user = this.getUserData(participant.user.id); e.instance.props.participants = [].concat(e.instance.props.participants);
for (let i in e.instance.props.participants) if (e.instance.props.participants[i] && e.instance.props.participants[i].user) e.instance.props.participants[i] = Object.assign({}, e.instance.props.participants[i], {user: this.getUserData(e.instance.props.participants[i].user.id)});
} }
} }