From 5fa78f5ccd12d605a25db112fab2a40a4dfa6919 Mon Sep 17 00:00:00 2001 From: Danya H Date: Thu, 6 Jun 2024 14:19:51 +0100 Subject: [PATCH] added ping command --- src/commands/ping.ts | 17 +++++++++++++++++ src/main.ts | 7 ++++++- 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 src/commands/ping.ts diff --git a/src/commands/ping.ts b/src/commands/ping.ts new file mode 100644 index 0000000..a2bb0b3 --- /dev/null +++ b/src/commands/ping.ts @@ -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`, + }) + } +} diff --git a/src/main.ts b/src/main.ts index c957f0e..e3acabf 100644 --- a/src/main.ts +++ b/src/main.ts @@ -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') })