Search code examples
javascriptdiscord.jsfetch

How to fetch discord.js bot informations like bot username or bot id without login in it and using token


All i want is to get simple discord bot informations using token, but i dont want to make bot online.

I tried using discord API and it doesnt work for me but discord.js client it works but makes bot online and i dont want it.


Solution

  • This code will login to discord, get the bot's info, then logout.

    const { Client } = require('discord.js'), 
    const client = new Client();
    client.on('ready', async () => {
    console.log(client) // or client.user if you just want client user info
    client.destroy() // logs out of Discord
    })
    client.login('...')