update ping

This commit is contained in:
SowinskiBraeden committed 2022-07-31 17:06:12 -07:00
1 parent 0776cb6974
commit ee3f38f6b6
2 files changed
+13 -4

No files matched your search

+10 -2
View File
@@ -18,11 +18,19 @@ module.exports = {
* @param {string[]} args
* @param {*} param3
*/
run: async (client, interaction, args, { GuildDB }) => {
run: async (client, interaction, args, { GuildDB }, start) => {
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
return interaction.send(`You are not allowed to use the bot in this channel.`);
}
return interaction.send('Pong!');
const end = new Date().getTime();
const time = end - start;
const pingEmbed = new MessageEmbed()
.setDescription(`**Pong!** Bot ping: ${time}ms`)
.setColor(client.config.EmbedColor);
return interaction.send({ embeds: [pingEmbed] });
},
},
}
+3 -2
View File
@@ -28,6 +28,7 @@ class QuarksBot extends Client {
this.Ready = false;
this.ws.on("INTERACTION_CREATE", async (interaction) => {
const start = new Date().getTime();
if (interaction.type!=3) {
client.log("Interaction")
let GuildDB = await this.GetGuild(interaction.guild_id);
@@ -53,8 +54,8 @@ class QuarksBot extends Client {
});
};
let cmd = client.commands.get(command);
if (cmd.SlashCommand && cmd.SlashCommand.run)
cmd.SlashCommand.run(this, interaction, args, { GuildDB });
if (cmd.name == 'ping' && cmd.SlashCommand && cmd.SlashCommand.run) cmd.SlashCommand.run(this, interaction, args, { GuildDB }, start);
else if (cmd.SlashCommand && cmd.SlashCommand.run) cmd.SlashCommand.run(this, interaction, args, { GuildDB });
}
});