本文介紹了顯示所有連接的用戶 Discord.js的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
我正在嘗試創建一個計時器,用 discord.js 輪詢所有連接的用戶.
I'm trying to create a timer that polls all connected users with discord.js.
我當前的代碼是...
Bot.on('ready', () => {
setInterval (function (){
var u = Bot.users();
console.log(u);
}, 10000);
});
但是,它不適用于錯誤TypeError: Bot.users is not a function".
However, it doesn't work with a error "TypeError: Bot.users is not a function".
我只是不確定這是如何工作的.我也試過...
I'm just not sure how this works. I've also tried...
Bot.server.users();
Bot.guilds.users();
推薦答案
它將顯示連接到您服務器的所有用戶的用戶名,無論是否在線:
It's going to display all users' username connected to your server, online or not :
Bot.on('ready', () => {
setInterval (function (){
for (user of Bot.users){
console.log(user[1].username);
}
}, 10000);});
這篇關于顯示所有連接的用戶 Discord.js的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!