File tree 3 files changed +38
-2
lines changed 3 files changed +38
-2
lines changed Original file line number Diff line number Diff line change @@ -15,5 +15,11 @@ export const fartCommand = new SlashCommandBuilder()
15
15
16
16
export const quoiFeurCommand = new SlashCommandBuilder ( )
17
17
. setName ( 'quoi-feur' )
18
- . setDescription ( 'Add quoi-feur game to the channel' )
18
+ . setDescription ( 'Manage quoi-feur game in the channel' )
19
+ . addSubcommand ( ( subcommand ) =>
20
+ subcommand . setName ( 'add' ) . setDescription ( 'Add the quoi-feur game in the channel' ) ,
21
+ )
22
+ . addSubcommand ( ( subcommand ) =>
23
+ subcommand . setName ( 'remove' ) . setDescription ( 'Remove the quoi-feur game in the channel' ) ,
24
+ )
19
25
. toJSON ( ) ;
Original file line number Diff line number Diff line change @@ -25,7 +25,15 @@ export const handleInteractionCreation = async (interaction: Interaction): Promi
25
25
await interaction . reply ( 'https://prout.dev' ) ;
26
26
break ;
27
27
case 'quoi-feur' :
28
- await addQuoiFeurChannel ( interaction ) ;
28
+ if ( interaction . options . getSubcommand ( true ) === 'add' ) {
29
+ await addQuoiFeurChannel ( interaction ) ;
30
+ return ;
31
+ }
32
+ if ( interaction . options . getSubcommand ( true ) === 'remove' ) {
33
+ await interaction . reply ( 'Not implemented yet' ) ;
34
+ return ;
35
+ }
36
+ await interaction . reply ( 'Unknown subcommand' ) ;
29
37
break ;
30
38
}
31
39
} ;
Original file line number Diff line number Diff line change @@ -75,3 +75,25 @@ export const addQuoiFeurChannel = async (interaction: ChatInputCommandInteractio
75
75
await cache . set ( 'quoiFeurChannels' , [ ...channels , channel . id ] ) ;
76
76
await interaction . reply ( 'Quoi-feur enabled in this channel' ) ;
77
77
} ;
78
+
79
+ export const removeQuoiFeurChannel = async ( interaction : ChatInputCommandInteraction ) => {
80
+ const channel = interaction . channel ;
81
+ if ( ! channel || ! channel . isTextBased ( ) ) return ;
82
+
83
+ const channels = await cache . get ( 'quoiFeurChannels' , [ ] ) ;
84
+ if ( ! channels . includes ( channel . id ) ) {
85
+ await interaction . reply ( 'Quoi-feur is not enabled in this channel' ) ;
86
+ return ;
87
+ }
88
+
89
+ const role = interaction . guild ?. roles . cache . find ( ( r ) => r . name === MUTED_BY_BOT ) ;
90
+ if ( ! role ) return ;
91
+ if ( ! ( channel instanceof TextChannel ) ) return ;
92
+
93
+ await channel . permissionOverwrites . delete ( role ) ;
94
+ await cache . set (
95
+ 'quoiFeurChannels' ,
96
+ channels . filter ( ( channelId ) => channelId !== channel . id ) ,
97
+ ) ;
98
+ await interaction . reply ( 'Quoi-feur disabled in this channel' ) ;
99
+ } ;
You can’t perform that action at this time.
0 commit comments