Skip to content

Commit 327ed32

Browse files
committed
fix: ping command
1 parent 09a0af1 commit 327ed32

File tree

2 files changed

+30
-23
lines changed

2 files changed

+30
-23
lines changed

CODE_OF_CONDUCT.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,23 @@ diverse, inclusive, and healthy community.
1717
Examples of behavior that contributes to a positive environment for our
1818
community include:
1919

20-
* Demonstrating empathy and kindness toward other people
21-
* Being respectful of differing opinions, viewpoints, and experiences
22-
* Giving and gracefully accepting constructive feedback
23-
* Accepting responsibility and apologizing to those affected by our mistakes,
20+
- Demonstrating empathy and kindness toward other people
21+
- Being respectful of differing opinions, viewpoints, and experiences
22+
- Giving and gracefully accepting constructive feedback
23+
- Accepting responsibility and apologizing to those affected by our mistakes,
2424
and learning from the experience
25-
* Focusing on what is best not just for us as individuals, but for the
25+
- Focusing on what is best not just for us as individuals, but for the
2626
overall community
2727

2828
Examples of unacceptable behavior include:
2929

30-
* The use of sexualized language or imagery, and sexual attention or
30+
- The use of sexualized language or imagery, and sexual attention or
3131
advances of any kind
32-
* Trolling, insulting or derogatory comments, and personal or political attacks
33-
* Public or private harassment
34-
* Publishing others' private information, such as a physical or email
32+
- Trolling, insulting or derogatory comments, and personal or political attacks
33+
- Public or private harassment
34+
- Publishing others' private information, such as a physical or email
3535
address, without their explicit permission
36-
* Other conduct which could reasonably be considered inappropriate in a
36+
- Other conduct which could reasonably be considered inappropriate in a
3737
professional setting
3838

3939
## Enforcement Responsibilities
@@ -106,7 +106,7 @@ Violating these terms may lead to a permanent ban.
106106
### 4. Permanent Ban
107107

108108
**Community Impact**: Demonstrating a pattern of violation of community
109-
standards, including sustained inappropriate behavior, harassment of an
109+
standards, including sustained inappropriate behavior, harassment of an
110110
individual, or aggression toward or disparagement of classes of individuals.
111111

112112
**Consequence**: A permanent ban from any sort of public interaction within

src/commands/utility/ping.ts

+19-12
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,34 @@ import { randomColor } from "../../helpers/colors";
77

88
export const data = new SlashCommandBuilder()
99
.setName("ping")
10-
.setDescription("Get the bot's ping");
10+
.setDescription("Get the bot's ping and API latency");
1111

1212
export async function execute(interaction: ChatInputCommandInteraction) {
13-
const reply = await interaction.reply({
13+
const sent = await interaction.reply({
14+
content: "Pinging...",
1415
ephemeral: true,
1516
fetchReply: true,
16-
embeds: [
17-
new EmbedBuilder()
18-
.setDescription("Calculating ping...")
19-
.setColor(randomColor()),
20-
],
2117
});
18+
19+
const roundtripLatency = sent.createdTimestamp - interaction.createdTimestamp;
20+
const wsLatency = interaction.client.ws.ping;
21+
2222
const embed = new EmbedBuilder()
23-
.setDescription(
24-
`Pong! Latency is ${
25-
reply.createdTimestamp - interaction.createdTimestamp
26-
}ms`,
23+
.setColor(randomColor())
24+
.setTitle("🏓 Pong!")
25+
.addFields(
26+
{
27+
name: "Bot Response Time",
28+
value: `${roundtripLatency}ms`,
29+
inline: true,
30+
},
31+
{ name: "API Latency", value: `${wsLatency}ms`, inline: true },
2732
)
28-
.setColor(randomColor());
33+
.setFooter({ text: "Bot Ping Information" })
34+
.setTimestamp();
2935

3036
await interaction.editReply({
37+
content: "",
3138
embeds: [embed],
3239
});
3340
}

0 commit comments

Comments
 (0)