【发布时间】:2021-11-01 08:52:19
【问题描述】:
我需要我的机器人根据价格和价格变动来更改名称。我不能使用用户名,因为机器人会因为更改用户名的限制而停止工作。我发现昵称应该没问题,但是我不能让它工作。
client.once('ready', () => {
rp(requestOptions).then(response => {
const answer = JSON.parse(response)
console.log('API Call response:', answer["data"]["3501"]["quote"]);
const percent_change_24h = answer["data"]["3501"]["quote"]["USD"]["percent_change_24h"];
const price = answer["data"]["3501"]["quote"]["USD"]["price"];
client.user.setNickname("Coin Price" + price.toFixed(5) + "$");
client.user.setActivity(percent_change_24h + "%", { type: "PLAYING" });
console.log('Ready!');
}).catch((err) => {
console.log('API Call error:', err.message);
});
});
// Login to Discord with your client's token
client.login(config.token);
错误:API Call error: client.user.setNickname is not a function
更改机器人昵称的正确关键字是什么? (不是用户名)
【问题讨论】:
标签: node.js api discord discord.js