This repository was archived by the owner on Sep 8, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change 1
1
import { MessageComponentInteraction , SelectMenuInteraction } from "discord.js" ;
2
2
import { ComponentInteractionHandler } from "../../lib/interaction" ;
3
- import { createRolesMessage } from "../../lib/makigas/roles" ;
3
+ import { createRolesMessage , ROLE_DEFINITIONS } from "../../lib/makigas/roles" ;
4
4
5
5
function difference ( a : string [ ] , b : string [ ] ) : string [ ] {
6
6
return a . filter ( ( i ) => ! b . includes ( i ) ) ;
@@ -13,7 +13,10 @@ export default class ModMenuAlert implements ComponentInteractionHandler {
13
13
if ( event . inGuild ( ) ) {
14
14
/* event.member might not contain the information we are interested in. */
15
15
const member = await event . guild . members . fetch ( event . user . id ) ;
16
- const currentRoles = member . roles . cache . map ( ( role ) => role . name ) ;
16
+ const acceptableRoles = ROLE_DEFINITIONS . map ( ( r ) => r . label ) ;
17
+ const currentRoles = member . roles . cache
18
+ . map ( ( role ) => role . name )
19
+ . filter ( ( r ) => acceptableRoles . includes ( r ) ) ;
17
20
const desiredRoles = event . values ;
18
21
19
22
/* Set and unset roles that should not apply here. */
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ import {
11
11
* this code, you should probably change this with the list of roles that you are using
12
12
* for your server...
13
13
*/
14
- const ROLE_DEFINITIONS = [
14
+ export const ROLE_DEFINITIONS = [
15
15
{
16
16
label : "Anuncios" ,
17
17
description : "Te menciono cuando tenga algo que anunciar" ,
You can’t perform that action at this time.
0 commit comments