Here's My code
const Discord = require('discord.js');
const logger = require('winston');
const auth = require('./auth.json');
// Initialize Discord Bot
const client = new Discord.Client({ intents: ['GUILDS', 'GUILD_MESSAGES']
});
client.on('ready', function (evt) {
logger.info('Connected');
logger.info('Logged in as: ');
logger.info(bot.username + ' - (' + bot.id + ')');
});
client.on('message', function (user, userID, channelID, message, evt) {
if (message.substring(0, 1) == '.') {
var args = message.substring(1).split(' ');
var cmd = args[0];
args = args.splice(1);
switch(cmd) {
// .ping
case 'ping':
bot.sendMessage({
to: channelID,
message: 'Pong!'
});
break;
}
}
});
client.login('SECRET_TOKEN')
Heres The error it's Drawing
(node:28480) UnhandledPromiseRejectionWarning: ReferenceError: AbortController is not defined
at RequestHandler.execute (C:\Users\aweso\Desktop\Discord Music Bot\node_modules\discord.js\src\rest\RequestHandler.js:172:15)
at RequestHandler.execute (C:\Users\aweso\Desktop\Discord Music Bot\node_modules\discord.js\src\rest\RequestHandler.js:176:19)
at RequestHandler.push (C:\Users\aweso\Desktop\Discord Music Bot\node_modules\discord.js\src\rest\RequestHandler.js:50:25)
at async WebSocketManager.connect (C:\Users\aweso\Desktop\Discord Music Bot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:128:9)
at async Client.login (C:\Users\aweso\Desktop\Discord Music Bot\node_modules\discord.js\src\client\Client.js:245:7)
(Use node --trace-warnings ... to show where the warning was created)
(node:28480) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:28480) [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.
Im hoping someone can help me figure out what's causing the issue I have looked over it and I saw nothing wrong. Thanks in advance.