Initial commit
This commit is contained in:
commit
c87d4d0b88
5 changed files with 60 additions and 0 deletions
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
node_modules
|
||||
.env
|
||||
config.json
|
8
commands/echo.js
Normal file
8
commands/echo.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
const { SlashCommandBuilder } = require('discord.js');
|
||||
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName('echo')
|
||||
.setDescription('What do you want it to repeat?')
|
||||
.addStringOption(option =>
|
||||
option.setName('input')
|
||||
.setDescription('The input to echo back'));
|
25
commands/ping.js
Normal file
25
commands/ping.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
const { SlashCommandBuilder } = require('@discordjs/builders');
|
||||
const { EmbedBuilder } = require('discord.js'); // Import EmbedBuilder
|
||||
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('ping')
|
||||
.setDescription('Replies with Pong!'),
|
||||
async execute(interaction) {
|
||||
// Calculate the latency
|
||||
const apiLatency = Math.round(interaction.client.ws.ping);
|
||||
const hostLatency = Date.now() - interaction.createdTimestamp;
|
||||
|
||||
// Create an embed message
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle("Pong! Here's the stats!")
|
||||
.setColor(0x00AE86) // You can choose any color you like
|
||||
.addFields(
|
||||
{ name: 'API Latency', value: `${apiLatency}ms`, inline: true },
|
||||
{ name: 'Host Latency', value: `${hostLatency}ms`, inline: true }
|
||||
);
|
||||
|
||||
// Send the embed message as a reply
|
||||
await interaction.reply({ embeds: [embed] });
|
||||
},
|
||||
};
|
16
index.js
Normal file
16
index.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
// Require the necessary discord.js classes
|
||||
const { Client, Events, GatewayIntentBits } = require('discord.js');
|
||||
const { token } = require('./config.json');
|
||||
|
||||
// Create a new client instance
|
||||
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
|
||||
|
||||
// When the client is ready, run this code (only once).
|
||||
// The distinction between `client: Client<boolean>` and `readyClient: Client<true>` is important for TypeScript developers.
|
||||
// It makes some properties non-nullable.
|
||||
client.once(Events.ClientReady, readyClient => {
|
||||
console.log(`Ready! Logged in as ${readyClient.user.tag}`);
|
||||
});
|
||||
|
||||
// Log in to Discord with your client's token
|
||||
client.login(token);
|
8
package.json
Normal file
8
package.json
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"name": "GlobalBanList",
|
||||
"version": "0.0.1",
|
||||
"author": "Rosie Val <support@prismbot.icu>",
|
||||
"dependencies": {
|
||||
"discord.js": "^14.15.3"
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue