const { Client, GatewayIntentBits } = require('discord.js');
const Discord = require("discord.js");
const TOKEN="REDACTED"
const client = new Discord.Client({
intents: [GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMembers,]
})
require('dotenv').config();
client.on('ready', () => {
// channel.send("My Message")
console.log(Logged in as ${client.user.tag}!);
});
client.on("messageCreate", msg => {
if (msg.content === "ping") {
msg.reply("pong");
}
})
client.on('guildMemberAdd', (member) => {
console.log(member)
});
client.on('interactionCreate', async (interaction) => {
if (!interaction.isChatInputCommand()) return;
if (interaction.commandName === 'ping') {
await interaction.reply('Pong!');
}
});
client.login(TOKEN);
^^^^^^
please help, this code doesn't work
when someone types "ping" inside a server it doesn't reply with "pong"