File tree 1 file changed +53
-0
lines changed
1 file changed +53
-0
lines changed Original file line number Diff line number Diff line change
1
+ const { SlashCommandBuilder, PermissionFlagsBits } = require ( 'discord.js' ) ;
2
+
3
+ module . exports = {
4
+ ...new SlashCommandBuilder ( )
5
+ . setName ( 'nukecourserep' )
6
+ . setDescription ( 'Replaces course rep' )
7
+ . setDefaultMemberPermissions (
8
+ PermissionFlagsBits . KickMembers || PermissionFlagsBits . BanMembers
9
+ ) ,
10
+
11
+ /**
12
+ *
13
+ * @param {Client } client
14
+ * @param {CommandInteraction } interaction
15
+ * @param {String[] } args
16
+ */
17
+
18
+ run : async ( client , interaction ) => {
19
+ await interaction . deferReply ( {
20
+ ephemeral : true ,
21
+ } ) ;
22
+
23
+ try {
24
+ const role = interaction . guild . roles . cache . find (
25
+ ( r ) => r . name === 'Course Rep'
26
+ ) ;
27
+
28
+ interaction . guild . roles . create ( {
29
+ name : role . name ,
30
+ color : role . color ,
31
+ hoist : role . hoist ,
32
+ position : role . position ,
33
+ permissions : role . permissions ,
34
+ mentionable : role . mentionable ,
35
+ } ) ;
36
+
37
+ role . delete ( role . id , 'The Nuke Course Rep Command Was Run. ' ) ;
38
+
39
+ const newRole = interaction . guild . roles . cache . find (
40
+ ( r ) => r . name === 'Course Rep'
41
+ ) ;
42
+ interaction . editReply (
43
+ `Role has been replaced. The new role ID is: ${ newRole . id } . Please pass this to Kieran.` ,
44
+ true
45
+ ) ;
46
+ } catch ( error ) {
47
+ interaction . editReply ( {
48
+ content : error ,
49
+ ephemeral : true ,
50
+ } ) ;
51
+ }
52
+ } ,
53
+ } ;
You can’t perform that action at this time.
0 commit comments