This commit is contained in:
Tutur33
2024-02-13 21:41:14 +01:00
parent 316ff0b535
commit b562c4ea57
+18 -8
View File
@@ -1,15 +1,25 @@
const Discord = require('discord.js');
require('dotenv').config(); require('dotenv').config();
const { Client, GatewayIntentBits } = require('discord.js');
const client = new Discord.Client(); const client = new Client({
intents: [
client.on('ready', () => { GatewayIntentBits.Guilds,
console.log(`Bot is ready as: ${client.user.tag}`); GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMembers,
],
}); });
client.on('message', message => {
if (message.content === 'ping') { client.on('ready', () => {
message.reply('pong'); console.log(`Logged in as ${client.user.tag}!`);
});
client.on('interactionCreate', async interaction => {
if (!interaction.isChatInputCommand()) return;
if (interaction.commandName === 'ping') {
await interaction.reply('Pong!');
} }
}); });