-
-
Save pedroricardo/da90fd467962ca8424cfc56dc3a54df6 to your computer and use it in GitHub Desktop.
const Discord = require("discord.js"); //baixar a lib | |
const client = new Discord.Client(); | |
const config = require("./config.json"); | |
client.on("ready", () => { | |
console.log(`Bot foi iniciado, com ${client.users.size} usuários, em ${client.channels.size} canais, em ${client.guilds.size} servidores.`); | |
client.user.setPresence({ game: { name: 'comando', type: 1, url: 'https://www.twitch.tv/pedroricardo'} }); | |
//0 = Jogando | |
// 1 = Transmitindo | |
// 2 = Ouvindo | |
// 3 = Assistindo | |
}); | |
client.on("message", async message => { | |
if(message.author.bot) return; | |
if(message.channel.type === "dm") return; | |
if(!message.content.startsWith(config.prefix)) return; | |
const args = message.content.slice(config.prefix.length).trim().split(/ +/g); | |
const comando = args.shift().toLowerCase(); | |
// coamdno ping | |
if(comando === "ping") { | |
const m = await message.channel.send("Ping?"); | |
m.edit(`Pong! A Latência é ${m.createdTimestamp - message.createdTimestamp}ms. A Latencia da API é ${Math.round(client.ping)}ms`); | |
} | |
}); | |
client.login(config.token); |
{ | |
"prefix": "!", | |
"token": "XXXXXXX" | |
} |
Ao iniciar o bot, com node . aparece esse erro.
TypeError [CLIENT_MISSING_INTENTS]: Valid intents must be provided for the Client.
at Client._validateOptions (C:\Users\ryanf\Desktop\Bot.js\node_modules\discord.js\src\client\Client.js:544:13)
at new Client (C:\Users\ryanf\Desktop\Bot.js\node_modules\discord.js\src\client\Client.js:73:10)
at Object. (C:\Users\ryanf\Desktop\Bot.js\bot.js:2:16)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:17:47 {
estou com o mesmo problema! Ja conseguiu resolver?
Olá deve estar faltando alguma instrução nas classe que são chamadas. Pelo oque consegui entender não esta encontrando alguns módulos.
Vou dar uma pesquisada caso encontrem mandem postem aqui.
Mesmo problema alguem conseguiu resolver?
ol
if(comando === "ping") {
const m = message.channel.send("Ping?");
m.edit(
Pong! A latencia eh ${m.createdTimestamp - message.createdTimestamp}ms. A Latencia da API eh ${Math.round(client.ws.ping)}ms
);}