Skip to content

Commit

Permalink
fix: ping command
Browse files Browse the repository at this point in the history
  • Loading branch information
ICEPrey committed Sep 15, 2024
1 parent 09a0af1 commit 327ed32
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 23 deletions.
22 changes: 11 additions & 11 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,23 @@ diverse, inclusive, and healthy community.
Examples of behavior that contributes to a positive environment for our
community include:

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

Examples of unacceptable behavior include:

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

## Enforcement Responsibilities
Expand Down Expand Up @@ -106,7 +106,7 @@ Violating these terms may lead to a permanent ban.
### 4. Permanent Ban

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

**Consequence**: A permanent ban from any sort of public interaction within
Expand Down
31 changes: 19 additions & 12 deletions src/commands/utility/ping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,34 @@ import { randomColor } from "../../helpers/colors";

export const data = new SlashCommandBuilder()
.setName("ping")
.setDescription("Get the bot's ping");
.setDescription("Get the bot's ping and API latency");

export async function execute(interaction: ChatInputCommandInteraction) {
const reply = await interaction.reply({
const sent = await interaction.reply({
content: "Pinging...",
ephemeral: true,
fetchReply: true,
embeds: [
new EmbedBuilder()
.setDescription("Calculating ping...")
.setColor(randomColor()),
],
});

const roundtripLatency = sent.createdTimestamp - interaction.createdTimestamp;
const wsLatency = interaction.client.ws.ping;

const embed = new EmbedBuilder()
.setDescription(
`Pong! Latency is ${
reply.createdTimestamp - interaction.createdTimestamp
}ms`,
.setColor(randomColor())
.setTitle("🏓 Pong!")
.addFields(
{
name: "Bot Response Time",
value: `${roundtripLatency}ms`,
inline: true,
},
{ name: "API Latency", value: `${wsLatency}ms`, inline: true },
)
.setColor(randomColor());
.setFooter({ text: "Bot Ping Information" })
.setTimestamp();

await interaction.editReply({
content: "",
embeds: [embed],
});
}

0 comments on commit 327ed32

Please sign in to comment.