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();
const { Client, GatewayIntentBits } = require('discord.js');
const client = new Discord.Client();
client.on('ready', () => {
console.log(`Bot is ready as: ${client.user.tag}`);
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMembers,
],
});
client.on('message', message => {
if (message.content === 'ping') {
message.reply('pong');
client.on('ready', () => {
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!');
}
});