I'm following this tutorial: https://www.youtube.com/watch?v=qv24S2L1N0k&t=1s
the bot is working in the terminal, but not on the Discord Server.
bot.js:
require('dotenv').config()
const Discord = require('discord.js')
const client = new Discord.Client()
client.on('ready', () => {
console.log('Our bot is ready to go!!!')
})
client.login(process.env.BOT_TOKEN)
client.on("message", msg => {
if(msg.content === 'ping'){
msg.channel.send("Not tagged")
}
})
package.json
{
"name": "bot_development",
"version": "1.0.0",
"description": "",
"main": "bot.js",
"scripts": {
"start": "node bot.js",
"devStart": "nodemon bot.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"discord.js": "^12.5.3",
"dotenv": "^8.2.0",
"node": "^16.18.1"
},
"devDependencies": {
"nodemon": "^2.0.20"
}
}
I've tried with
const client = new Discord.Client({intents: ["GUILDS", "GUILD_MESSAGES"]})
and I've tried "messageCreate" instead of "message", like this:
require('dotenv').config()
const Discord = require('discord.js')
const client = new Discord.Client({intents: ["GUILDS", "GUILD_MESSAGES"]})
client.on('ready', () => {
console.log('Our bot is ready to go!!!')
})
client.login(process.env.BOT_TOKEN)
client.on("messageCreate", msg => {
if(msg.content === 'ping'){
msg.channel.send("Not tagged")
}
})
Is there any problem outside of my code? I've done the rest of the configuration at the dev portal in the tutorial.