commit c87d4d0b889a518c30fd900df487b6392e7a2c4e Author: ShadowVR Date: Sun Jun 16 21:37:15 2024 -0400 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..80df32d --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +node_modules +.env +config.json \ No newline at end of file diff --git a/commands/echo.js b/commands/echo.js new file mode 100644 index 0000000..318f0ec --- /dev/null +++ b/commands/echo.js @@ -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')); \ No newline at end of file diff --git a/commands/ping.js b/commands/ping.js new file mode 100644 index 0000000..88e2357 --- /dev/null +++ b/commands/ping.js @@ -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] }); + }, +}; diff --git a/index.js b/index.js new file mode 100644 index 0000000..2d4694e --- /dev/null +++ b/index.js @@ -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` and `readyClient: Client` 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); \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..4101a9d --- /dev/null +++ b/package.json @@ -0,0 +1,8 @@ +{ + "name": "GlobalBanList", + "version": "0.0.1", + "author": "Rosie Val ", + "dependencies": { + "discord.js": "^14.15.3" + } +}