Shadow_Generator/index.js

28 lines
No EOL
793 B
JavaScript

require('dotenv').config();
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);