I was trying to use discord.js to get current client ID, I installed discord.js, @discordjs/rest discord-api-types and here's my code
const Discord = require("discord.js");
const client = new Discord.Client();
client.login("Your Token");
const commands = require("./commands.json");
const rest = new REST({ "version": "9" }).setToken(process.env.TOKEN);
(async () => {
try {
console.log("Started refreshing application (/) commands.");
if (process.argv.length) {
await rest.put(
Routes.applicationGuildCommands(process.env.CLIENT_ID, process.argv[0]), { "body": commands }
);
} else {
await rest.put(
Routes.applicationCommands(process.env.CLIENT_ID), { "body": commands }
);
}
console.log("Successfully reloaded application (/) commands.");
} catch (error) {
console.error(error);
}
})();
I am getting this error:
Uncaught TypeError: setInterval(...).unref is not a function at new RESTManager ([PATH]\node_modules\discord.js\src\rest\RESTManager.js:23:51) at new BaseClient ([PATH]\node_modules\discord.js\src\client\BaseClient.js:27:17) at new Client ([PATH]\node_modules\discord.js\src\client\Client.js:38:5) at file:///[PATH]/assets/app.js:2:16