I'm doing a dominance ticker for bitcoin and I want to show the price in the nickname of the bot, the thing is that I don't know why but I can't change the nickname, it throws me an error.
const { Client } = require('discord.js'); const client = new Client(); const request = require("request"); var LastBitcoinDominance = 100; client.on("ready", () => { console.log(`Logged in as ${client.user.tag}!`); }) myFunction() function myFunction() { const url = "API"; request(url, (err, res, body) => { const data = JSON.parse(body); var bitcoinDominance = data.bitcoin_dominance_percentage; if (bitcoinDominance == LastBitcoinDominance){ console.log("Bitcoin dominance and LastBitcoinDominacne are the same") }else { client.user.setUsername(bitcoinDominance) LastBitcoinDominance = bitcoinDominance; } }); setTimeout(myFunction, 10000); } client.token(TOKEN) https://stackoverflow.com/questions/65572695/nodejs-change-the-bots-nickname-every-time-the-variable-change-disocrd-js January 05, 2021 at 11:06AM

没有评论:
发表评论