Update EditUsers.plugin.js
This commit is contained in:
parent
6cd7bb5ed3
commit
08fff586c9
|
@ -2,7 +2,7 @@
|
|||
* @name EditUsers
|
||||
* @author DevilBro
|
||||
* @authorId 278543574059057154
|
||||
* @version 4.5.0
|
||||
* @version 4.5.1
|
||||
* @description Allows you to locally edit Users
|
||||
* @invite Jx3TjNS
|
||||
* @donate https://www.paypal.me/MircoWittrien
|
||||
|
@ -17,7 +17,7 @@ module.exports = (_ => {
|
|||
"info": {
|
||||
"name": "EditUsers",
|
||||
"author": "DevilBro",
|
||||
"version": "4.5.0",
|
||||
"version": "4.5.1",
|
||||
"description": "Allows you to locally edit Users"
|
||||
}
|
||||
};
|
||||
|
@ -357,7 +357,7 @@ module.exports = (_ => {
|
|||
|
||||
forceUpdateAll () {
|
||||
changedUsers = BDFDB.DataUtils.load(this, "users");
|
||||
|
||||
|
||||
this.changeAppTitle();
|
||||
BDFDB.PatchUtils.forceAllUpdates(this);
|
||||
BDFDB.MessageUtils.rerenderAll();
|
||||
|
@ -365,6 +365,15 @@ module.exports = (_ => {
|
|||
|
||||
onDMContextMenu (e) {
|
||||
if (e.instance.props.user) {
|
||||
if (this.settings.places.contextMenu) {
|
||||
let userName = this.getUserData(e.instance.props.user.id).username;
|
||||
if (userName != e.instance.props.user.username) {
|
||||
let [muteChildren, muteIndex] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "mute-channel"});
|
||||
if (muteIndex > -1) muteChildren[muteIndex].props.label = BDFDB.LanguageUtils.LanguageStringsFormat("MUTE_CHANNEL", `@${userName}`);
|
||||
let [unmuteChildren, unmuteIndex] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "unmute-channel"});
|
||||
if (unmuteIndex > -1) unmuteChildren[unmuteIndex].props.label = BDFDB.LanguageUtils.LanguageStringsFormat("UNMUTE_CHANNEL", `@${userName}`);
|
||||
}
|
||||
}
|
||||
let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "devmode-copy-id", group: true});
|
||||
children.splice(index > -1 ? index : children.length, 0, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
|
||||
children: this.createContextMenuEntry(e.instance.props.user)
|
||||
|
@ -374,16 +383,18 @@ module.exports = (_ => {
|
|||
|
||||
onUserContextMenu (e) {
|
||||
if (e.instance.props.user) {
|
||||
let userName = this.getUserData(e.instance.props.user.id).username;
|
||||
if (false && userName != e.instance.props.user.username && this.settings.places.contextMenu) {
|
||||
let [kickChilden, kickIndex] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "kick"});
|
||||
if (kickIndex > -1) kickChilden[kickIndex].props.label = BDFDB.LanguageUtils.LanguageStringsFormat("KICK_USER", userName);
|
||||
let [banChilden, banIndex] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "ban"});
|
||||
if (banIndex > -1) banChilden[banIndex].props.label = BDFDB.LanguageUtils.LanguageStringsFormat("BAN_USER", userName);
|
||||
let [muteChilden, muteIndex] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "mute-channel"});
|
||||
if (muteIndex > -1) muteChilden[muteIndex].props.label = BDFDB.LanguageUtils.LanguageStringsFormat("MUTE_CHANNEL", `@${userName}`);
|
||||
let [unmuteChilden, unmuteIndex] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "unmute-channel"});
|
||||
if (unmuteIndex > -1) unmuteChilden[unmuteIndex].props.label = BDFDB.LanguageUtils.LanguageStringsFormat("UNMUTE_CHANNEL", `@${userName}`);
|
||||
if (this.settings.places.contextMenu && e.subType == "useUserManagementItems") {
|
||||
let userName = this.getUserData(e.instance.props.user.id).username;
|
||||
if (userName != e.instance.props.user.username) {
|
||||
let [timeoutChildren, timeoutIndex] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "timeout"});
|
||||
if (timeoutIndex > -1) timeoutChildren[timeoutIndex].props.label = BDFDB.LanguageUtils.LanguageStringsFormat("DISABLE_GUILD_COMMUNICATION_FOR_USER", userName);
|
||||
let [removeTimeoutChildren, removeTimeoutIndex] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "removetimeout"});
|
||||
if (removeTimeoutIndex > -1) removeTimeoutChildren[removeTimeoutIndex].props.label = BDFDB.LanguageUtils.LanguageStringsFormat("ENABLE_GUILD_COMMUNICATION_FOR_USER", userName);
|
||||
let [kickChildren, kickIndex] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "kick"});
|
||||
if (kickIndex > -1) kickChildren[kickIndex].props.label = BDFDB.LanguageUtils.LanguageStringsFormat("KICK_USER", userName);
|
||||
let [banChildren, banIndex] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "ban"});
|
||||
if (banIndex > -1) banChildren[banIndex].props.label = BDFDB.LanguageUtils.LanguageStringsFormat("BAN_USER", userName);
|
||||
}
|
||||
}
|
||||
if (e.subType == "useUserRolesItems") {
|
||||
if (e.returnvalue.length) e.returnvalue.push(BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuSeparator, {}));
|
||||
|
@ -1058,8 +1069,7 @@ module.exports = (_ => {
|
|||
if (e.instance.props.channel && e.instance.props.channel.isDM() && this.settings.places.recentDms) {
|
||||
let recipientId = e.instance.props.channel.getRecipientId();
|
||||
if (!recipientId || !changedUsers[recipientId]) return;
|
||||
let tooltip = BDFDB.ReactUtils.findChild(e.returnvalue, {name: "ListItemTooltip"});
|
||||
if (tooltip) tooltip.props.text = this.getUserData(recipientId).username;
|
||||
e.instance.props.channelName = this.getUserData(recipientId).username;
|
||||
let avatar = BDFDB.ReactUtils.findChild(e.returnvalue, {filter: c => c && c.props && !isNaN(parseInt(c.props.id))});
|
||||
if (avatar && typeof avatar.props.children == "function") {
|
||||
let childrenRender = avatar.props.children;
|
||||
|
|
Loading…
Reference in New Issue