Skip to content
This repository has been archived by the owner on Jul 15, 2024. It is now read-only.

Commit

Permalink
feat: update /ping + make mod commands ephemeral
Browse files Browse the repository at this point in the history
  • Loading branch information
wdhdev committed Jul 10, 2023
1 parent bfd536a commit 5b7bc7f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
26 changes: 23 additions & 3 deletions src/commands/info/ping.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = {
enabled: true,
hidden: false,
deferReply: true,
ephemeral: false,
ephemeral: true,
async execute(interaction, client, Discord) {
try {
const pinging = new Discord.EmbedBuilder()
Expand All @@ -23,11 +23,31 @@ module.exports = {
const botLatency = i.createdTimestamp - interaction.createdTimestamp;
const apiLatency = Math.round(client.ws.ping);

let botLatencyValue;
let apiLatencyValue;

if(botLatency >= 0 && botLatency <= 99) {
botLatencyValue = `🟢 ${botLatency}ms`;
} else if(botLatency >= 100 && botLatency <= 199) {
botLatencyValue = `🟠 ${botLatency}ms`;
} else {
botLatencyValue = `🔴 ${botLatency}ms`;
}

if(apiLatency >= 0 && apiLatency <= 99) {
apiLatencyValue = `🟢 ${apiLatency}ms`;
} else if(apiLatency >= 100 && apiLatency <= 199) {
apiLatencyValue = `🟠 ${apiLatency}ms`;
} else {
apiLatencyValue = `🔴 ${apiLatency}ms`;
}

const ping = new Discord.EmbedBuilder()
.setColor(client.config_embeds.default)
.setTitle("🏓 Pong!")
.addFields (
{ name: "Bot Latency", value: `${botLatency}ms` },
{ name: "API Latency", value: `${apiLatency}ms` }
{ name: "Bot Latency", value: botLatencyValue, inline: true },
{ name: "API Latency", value: apiLatencyValue, inline: true }
)

await interaction.editReply({ embeds: [ping] });
Expand Down
2 changes: 1 addition & 1 deletion src/commands/mod/appeal.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ module.exports = {
enabled: true,
hidden: true,
deferReply: true,
ephemeral: false,
ephemeral: true,
async execute(interaction, client, Discord) {
try {
const modLogsChannel = client.channels.cache.get(client.config_channels.modLogs);
Expand Down
2 changes: 1 addition & 1 deletion src/commands/mod/appeals.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module.exports = {
enabled: true,
hidden: true,
deferReply: true,
ephemeral: false,
ephemeral: true,
async execute(interaction, client, Discord) {
try {
const user = interaction.options.getUser("user");
Expand Down

0 comments on commit 5b7bc7f

Please sign in to comment.