使用PHP获取Discord中的成员总数 [英] Get total number of members in Discord using PHP

查看:219
本文介绍了使用PHP获取Discord中的成员总数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Discord服务器,有1361个成员,在我的网站上,我想显示已加入用户的总数。

I have a Discord servern with 1361 members and on my website I want to display a total number of joined users.

我想出了所有在线方式的方法服务器上的成员使用:

I have figured out how to get all online Members on the server using:

   <?php

    $jsonIn = file_get_contents('https://discordapp.com/api/guilds/356230556738125824/widget.json');
    $JSON = json_decode($jsonIn, true);

    $membersCount = count($JSON['members']);

    echo "Number of members: " . $membersCount;
   ?>

我应该做些什么来获得已加入服务器的所有用户总数,而不是只是显示在线成员?

What should I do differently to get a total number of ALL users that have joined the server, and not just display the online members?

推荐答案

您需要在不和谐服务器上安装一个机器人来获取所有成员。例如,使用Discord js库。

You need a bot on your discord server to get all members. Use the Discord js library for example.

这篇关于使用PHP获取Discord中的成员总数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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