Untitled
unknown
javascript
2 years ago
2.9 kB
7
Indexable
// I looked at the code and I think I have a possible solution for you. You can add a new setting called **HideUsers** that takes an array of user IDs that you want to hide. You can then use the **hideUser** function to check if the user ID is in the array and hide them accordingly. Here is an example of how you can edit your code: ```js // Add this setting to the settings object HideUsers: { type: "string", value: "1234567890, 0987654321", // Enter the user IDs separated by commas description: "Enter the user IDs of the users you want to hide", note: "You can find the user ID by enabling developer mode and right-clicking on the user" }, // Add this function to the plugin class hideUser (user) { const hideUsers = this.settings.HideUsers.value.split(","); // Split the string into an array const userID = user.id || user.userId; // Get the user ID from the user object return hideUsers.includes(userID); // Return true if the user ID is in the array, false otherwise }, // Edit this function to use the hideUser function onUserContextMenu (context) { if (!context || !context.user || context.user.bot) return; if (this.hideUser(context.user)) { // Check if the user should be hidden context.remove(); // Remove the context menu return false; // Stop further execution } if (this.settings.RemoveUsers.value && context.user.id !== BDFDB.UserUtils.me.id) { let blocked = BDFDB.LibraryModules.FriendUtils.isBlocked(context.user.id); let name = blocked ? this.labels.context_unblock_user : this.labels.context_block_user; let icon = blocked ? "eye" : "eye-slash"; let action = blocked ? "unblock" : "block"; let subMenu = [ { label: name, id: BDFDB.ContextMenuUtils.createItemId(this.name, action), icon: _ => { return BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, { className: BDFDB.disCN.menuicon, name: BDFDB.LibraryComponents.SvgIcon.Names[icon.toUpperCase()] }); }, action: event => { this.blockUnblock(context.user.id); } } ]; let [removeItem] = BDFDB.ContextMenuUtils.findItem(context.returnvalue, {id: "remove-friend", group: true}); if (removeItem) subMenu.push(removeItem); context.returnvalue.items.splice(1, 0, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, { items: subMenu })); context.returnvalue.items.splice(2, 0, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuSeparator)); } } ``` I hope this works for you. Let me know if you have any questions or issues.
Editor is loading...