added ping command

This commit is contained in:
Danya H 2024-06-06 14:19:51 +01:00
parent eb6d4f429d
commit 5fa78f5ccd
2 changed files with 23 additions and 1 deletions

17
src/commands/ping.ts Normal file
View File

@ -0,0 +1,17 @@
import { Discord, Slash } from 'discordx'
import { CommandInteraction } from 'discord.js'
@Discord()
export class Ping {
@Slash({
name: 'ping',
description: 'ping the bot',
defaultMemberPermissions: ['Administrator'],
})
async ping(interaction: CommandInteraction) {
await interaction.deferReply({ ephemeral: true })
await interaction.editReply({
content: `🏓Pong! ${interaction.client.ws.ping} ms`,
})
}
}

View File

@ -19,10 +19,15 @@ export const bot = new Client({
simpleCommand: {
prefix: '!',
},
presence: {
status: 'online',
activities: [{ name: 'Designing...', type: 3 }],
},
})
bot.once('ready', async () => {
await bot.initApplicationCommands()
await bot.initApplicationCommands({ global: { disable: { delete: true } } })
console.log('Bot started')
})