Added Command Deployment via REST
This commit is contained in:
parent
d032b5dba8
commit
abb422c7f1
4 changed files with 369 additions and 6 deletions
28
index.js
28
index.js
|
@ -1,2 +1,28 @@
|
|||
require('dotenv').config();
|
||||
console.log(process.env)
|
||||
|
||||
const { Client, GatewayIntentBits } = require('discord.js');
|
||||
const token = process.env.TOKEN;
|
||||
|
||||
const client = new Client({
|
||||
intents: [GatewayIntentBits.Guilds]
|
||||
})
|
||||
|
||||
client.once('ready', () => {
|
||||
console.log('Ready!');
|
||||
});
|
||||
|
||||
client.on('interactionCreate', async interaction => {
|
||||
if (!interaction.isCommand()) return;
|
||||
|
||||
const commandName = interaction.commandName;
|
||||
|
||||
if (commandName === 'ping') {
|
||||
await interaction.reply('Pong!');
|
||||
} else if (commandName === 'server') {
|
||||
await interaction.reply(`Server name: ${interaction.guild.name}\nTotal members: ${interaction.guild.memberCount}`);
|
||||
} else if (commandName === 'user') {
|
||||
await interaction.reply(`Your tag: ${interaction.user.tag}\nYour id: ${interaction.user.id}`);
|
||||
}
|
||||
})
|
||||
|
||||
client.login(token);
|
Loading…
Add table
Add a link
Reference in a new issue