显示所有连接的用户Discord.js [英] Displaying all connected users Discord.js

查看:69
本文介绍了显示所有连接的用户Discord.js的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个使用discord.js轮询所有连接用户的计时器。

I'm trying to create a timer that polls all connected users with discord.js.

我当前的代码是......

My current code is...

Bot.on('ready', () => {
    setInterval (function (){
        var u = Bot.users();
        console.log(u);
    }, 10000);
});

但是,它不能用于错误TypeError:Bot.users不是函数 。

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();


推荐答案

嘿,你最好试试这个

代码

    var guilds = client.guilds;
    console.log(guilds);

这将返回一个收集,其中包含机器人连接的所有公会,并且公会包含其所有成员给出了很多信息,请参阅cmd日志

this returns a collecting which contain all the guilds which bot is connected and the guild contains its all members it gives lot of info see the cmd log

更多参考这里

到底是什么公会使用这个链接

what is the hell is guild use this link

https ://discord.js.org/#/docs/main/stable/class/Guild

收集到底是怎么回事

https:// discord .js.org /#/ docs / main / stable / class / Collection

这篇关于显示所有连接的用户Discord.js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆