PS C:\Users\name\Desktop\DiscBot\AAA My Custom Discord Bot> node . Nice. (node:6444) UnhandledPromiseRejectionWarning: Error: Incorrect login details were provided. at WebSocketConnection.client.ws.connection.once.event (C:\Users\name\Desktop\DiscBot\AAA My Custom Discord Bot\node_modules\discord.js\src\client\ClientManager.js:48:41) at Object.onceWrapper (events.js:286:20) at WebSocketConnection.emit (events.js:198:13) at WebSocketConnection.onClose (C:\Users\name\Desktop\DiscBot\AAA My Custom Discord Bot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:390:10) at WebSocket.onClose (C:\Users\name\Desktop\DiscBot\AAA My Custom Discord Bot\node_modules\ws\lib\event-target.js:124:16) at WebSocket.emit (events.js:198:13) at WebSocket.emitClose (C:\Users\name\Desktop\DiscBot\AAA My Custom Discord Bot\node_modules\ws\lib\websocket.js:191:10) at TLSSocket.socketOnClose (C:\Users\name\Desktop\DiscBot\AAA My Custom Discord Bot\node_modules\ws\lib\websocket.js:850:15) at TLSSocket.emit (events.js:203:15) at _handle.close (net.js:606:12) (node:6444) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2) (node:6444) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
var fs = require('fs'); const Discord = require('discord.js'); const bot = new Discord.Client(); const token = 'NTk5NTIyMzY4MDQ5NjQzNTUw.XSmgXw.mK2EyTJzGGB1MdT3JCmQkRW6oP4'; const PREFIX = "$"; bot.on('ready', () =>{ console.log('I am online!'); bot.user.setActivity("Test | Prefix: $") }) bot.on('message', message=>{ let args = message.content.substring(PREFIX.length).split(" "); switch(args[0]){ case 'help': message.channel.sendMessage('$cyka | Gives back a good word.'); message.channel.sendMessage('$rules | TrustedBusiness Rules.'); message.channel.sendMessage('$ping | Gives back the word [pong].'); break; case 'cyka': message.channel.sendMessage('blyat!'); break; case 'rules': message.channel.sendMessage('Check here and follow them please! #rules'); break; case 'ping': message.channel.sendMessage('pong! POOOOONG!!'); break; case 'clear': if(!args[1]) return message.reply('Sorry. Define also a number after (clear) command!') message.channel.bulkDelete(args[1]); break; } }) bot.login(token) var read_string = fs.readFile('number.txt', 'utf8', function (err, data) { if (err) return console.error(err); console.log('Nice.') })
Quote: Incorrect login details were provided.
Setting up a bot application | Discord.js Guide[^]: A token is essentially your bot's password; it's what your bot uses to login to Discord. With that being said, it is vital that you do not ever share this token with anybody, purposely or accidentally. If someone does manage to get a hold of your token, they can use your bot as if it were theirs—this means they can perform malicious acts with it.
writeFile
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)