-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
26 lines (21 loc) · 892 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
const { Client } = require('discord.js');
const ALL_INTENTS = 32767;
const bot = new Client({ intents: ALL_INTENTS, partials: ['MESSAGE', 'CHANNEL', 'REACTION'], });
const token = 'token';
bot.on('ready', () => {
console.log('Ready');
bot.application.commands.set([
{ name: 'ping', description: 'Check the latency and status of the Main Server', options: [], }
]);
});
bot.on('interactionCreate', (interaction) => {
if (interaction.isCommand() && interaction.commandName === 'ping') {
const startTime = interaction.createdTimestamp;
interaction.channel.send('[Server Status] Main Server Online').then(sentMessage => {
const endTime = sentMessage.createdTimestamp;
const latency = endTime - startTime;
interaction.channel.send(`[Server Status] Main Server ${latency}ms`);
});
}
});
bot.login(token);