-
Notifications
You must be signed in to change notification settings - Fork 1
/
Removenorole.plugin.js
39 lines (34 loc) · 1.25 KB
/
Removenorole.plugin.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/**
* @name RemoveNoRole
* @author Doggybootsy
* @description Remove the "NO ROLES" from user popouts
* @version 2.2
* @source https://github.com/doggybootsy/BDPlugins/
*/
/** @type {import("betterdiscord").PluginCallback} */
module.exports = (meta) => {
const [ UserRolesList, Flux, PermissionStore, PermissionBits ] = BdApi.Webpack.getBulk({
filter: BdApi.Webpack.Filters.byStrings(".default.Messages.ROLES_LIST", ".rolePillBorder]", "disableBorderColor:!0", "return null"),
defaultExport: false
}, {
filter: BdApi.Webpack.Filters.byKeys("useStateFromStores", "Store")
}, {
filter: BdApi.Webpack.Filters.byStoreName("PermissionStore")
}, {
filter: (m) => typeof m.MANAGE_ROLES === "bigint",
searchExports: true
});
return {
start() {
BdApi.Patcher.after(meta.name, UserRolesList, "default", (that, [ props ], res) => {
if (!props.guild || !props.user) return;
const canAddRoles = Flux.useStateFromStores([ PermissionStore ], () => PermissionStore.canManageUser(PermissionBits.MANAGE_ROLES, props.user, props.guild));
if (props.guildMember.roles.length || canAddRoles) return;
return false;
});
},
stop() {
BdApi.Patcher.unpatchAll(meta.name);
}
};
};