File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change
1
+ import {
2
+ ChatInputCommandInteraction ,
3
+ EmbedBuilder ,
4
+ SlashCommandBuilder ,
5
+ } from "discord.js" ;
6
+ import { randomColor } from "../../helpers/colors" ;
7
+
8
+ export const data = new SlashCommandBuilder ( )
9
+ . setName ( "ping" )
10
+ . setDescription ( "Get the bot's ping" ) ;
11
+
12
+ export async function execute ( interaction : ChatInputCommandInteraction ) {
13
+ const reply = await interaction . reply ( {
14
+ ephemeral : true ,
15
+ fetchReply : true ,
16
+ embeds : [
17
+ new EmbedBuilder ( )
18
+ . setDescription ( "Calculating ping..." )
19
+ . setColor ( randomColor ( ) ) ,
20
+ ] ,
21
+ } ) ;
22
+ const embed = new EmbedBuilder ( )
23
+ . setDescription (
24
+ `Pong! Latency is ${
25
+ reply . createdTimestamp - interaction . createdTimestamp
26
+ } ms`,
27
+ )
28
+ . setColor ( randomColor ( ) ) ;
29
+
30
+ await interaction . editReply ( {
31
+ embeds : [ embed ] ,
32
+ } ) ;
33
+ }
You can’t perform that action at this time.
0 commit comments