File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change
1
+ import { command } from 'jellycommands' ;
2
+ import { wrap_in_embed } from '../utils/embed_helpers' ;
3
+ import { GuildMemberRoleManager } from 'discord.js' ;
4
+
5
+ export default command ( {
6
+ name : 'reping' ,
7
+ description : 'Ping a role' ,
8
+
9
+ global : true ,
10
+
11
+ options : [
12
+ {
13
+ name : 'role' ,
14
+ description : 'The role you want to ping' ,
15
+ type : 'Role' ,
16
+ required : true ,
17
+ } ,
18
+ ] ,
19
+
20
+ run : async ( { interaction } ) => {
21
+ // Find the desired role
22
+ const role = interaction . options . getRole ( 'role' , true ) ;
23
+ // Check if the user has the role
24
+ let hasRole = (
25
+ interaction . member . roles as GuildMemberRoleManager
26
+ ) . cache . find ( ( val ) => val . id === role . id ) ;
27
+ // Exit if the user doesn't have the role
28
+ if ( ! hasRole ) return ;
29
+ // Send the ping message
30
+ interaction . channel . send ( `<@&${ role . id } >` ) ;
31
+ // Follow up the interaction
32
+ await interaction . reply ( wrap_in_embed ( 'Role pinged' ) ) ;
33
+ // Delete the reply after 3 seconds
34
+ setTimeout ( async ( ) => {
35
+ await interaction . deleteReply ( ) ;
36
+ } , 3000 ) ;
37
+ } ,
38
+ } ) ;
You can’t perform that action at this time.
0 commit comments