File tree 1 file changed +44
-0
lines changed
1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change
1
+ const {
2
+ Client,
3
+ Interaction,
4
+ EmbedBuilder,
5
+ PermissionFlagsBits,
6
+ } = require ( "discord.js" ) ;
7
+ const { v4 : uuidv4 } = require ( "uuid" ) ; // Import the UUID generator
8
+
9
+ module . exports = {
10
+ /**
11
+ * @param {Client } client
12
+ * @param {Interaction } interaction
13
+ */
14
+ callback : async ( client , interaction ) => {
15
+ const allowedRole = "" ;
16
+
17
+ if ( ! interaction . member . roles . cache . has ( allowedRole ) ) {
18
+ return await interaction . reply ( { content : "❌ You don't have permission to use this command." , ephemeral : true } ) ;
19
+ }
20
+
21
+ try {
22
+ const generatedKey = uuidv4 ( ) ;
23
+
24
+ const embed = new EmbedBuilder ( )
25
+ . setColor ( "#4ea554" )
26
+ . setTitle ( "🔑 Key Generated" )
27
+ . setDescription ( `Here's your generated key: \`${ generatedKey } \`` )
28
+ . setTimestamp ( )
29
+ . setFooter ( {
30
+ text : `Requested by ${ interaction . user . tag } ` ,
31
+ iconURL : interaction . user . displayAvatarURL ( { dynamic : true } ) ,
32
+ } ) ;
33
+
34
+ await interaction . reply ( { embeds : [ embed ] } ) ;
35
+
36
+ } catch ( error ) {
37
+ console . error ( "Error generating key:" , error ) ;
38
+ await interaction . reply ( { content : "❌ Failed to generate a key." , ephemeral : true } ) ;
39
+ }
40
+ } ,
41
+
42
+ name : "generatekey" ,
43
+ description : "Generates a key." ,
44
+ } ;
You can’t perform that action at this time.
0 commit comments