-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Badge request: Discord online/total #4500
Comments
Much like #4257, I suspect this most likely is not going to be possible. The Discord APIs are very limited in terms of being able to provide the underlying info like this that Shields would need to be able to render such a badge. We can leave this open for a few days in case anyone is able to find and provide details on an accessible API endpoint that includes this data, but otherwise this will be blocked due to lack of upstream data availability. |
I was able to take a look, technically it's possible to get all users and count them?! |
Do you know if that endpoint is available for consumption by non-members? The issues we've had in the past stem from the authorization requirements of the APIs, it's not the lack of the endpoints existing. (assuming you aren't a member of the below server and authenticated) you'll get 401 errors on all the guild api endpoints We have to use the There is a |
Thank you! |
Let us know if you hear anything! |
I've asked in their discord api server and got this response:
I guess this will need special impl. for that specific badge? But at least it is possible to get an approx. of the users. |
Thanks @elpiel - any idea how "approximate" that count is? |
Also are the invites specific to a server or inidvidual channels (or both)? |
I about the approximation - I have no idea... I didn't ask as well.
I haven't worked with their API so I can't be sure. |
Removing the AFAICT the data seems reasonable to use, and the value in the response for our invite code is the same as what I see on our Shields server https://discordapp.com/api/invites/HjJCwm5?with_counts=true {
"code": "HjJCwm5",
"guild": {
"id": "308323056592486420",
"name": "shields",
"splash": null,
"banner": null,
"description": null,
"icon": "11a50197f2858fa14b74f41ceaacc4b6",
"features": [],
"verification_level": 1,
"vanity_url_code": null
},
"channel": {
"id": "308323056592486420",
"name": "contributing",
"type": 0
},
"inviter": {
"id": "306496561301684224",
"username": "paulmelnikow",
"avatar": "7667ed8ea335982730a320c36102fc32",
"discriminator": "9778"
},
"approximate_member_count": 336,
"approximate_presence_count": 22
} |
Discord online/total
badge
The widget endpoint can also be used to pull the presence count. It requires the server admins to have enabled it, but it's permanent, while invites can expire after some time or be deleted by accident if someone doesn't know it's being used by shields.io. Widgets can be enabled through Server Settings > Widgets, and the json endpoint can be copied there too. That endpoint requires no authentication. Here's an example: https://discordapp.com/api/guilds/445203868624748555/widget.json |
@elpiel and @pedrofracassi there's an open pull request for this, #5079, unfortunately its author is no longer responding. Would one of you be interested in picking things up again and helping land the pull request? |
@sdabhi23 sure, please pick it up! 👍🏻 |
Do you mind if I raise a new PR as there seems to be a merge conflict on the old one? |
If it's easier for you, that's fine. My only suggestion would be to include the |
I think discord invites show member count, but that might be member count when the invite was created. If it contains a dynamic member count then we can have it take a permanent discord invite theoretically. |
any luck |
If this was in Java i'd probably be able to do it but i only know js 😅 |
I figured out how you can do this, if you query https://discord.com/api/invites/{invitecode}?with_counts=true it'll return a json object that contains EDIT: this was already said oops thx @jackson-57 for helping me with this |
Gentle reminder to folks that the ping-like messages are not particularly helpful, especially given the presence of the open PR in #5079 which has some outstanding issues. If this is a badge you'd really like to see, then we'd encourage you to try to pick up #5079 and carry it over the finish line. If you are interested in this badge but don't have the bandwidth to work on it, then please subscribe to this issue (and perhaps #5079). Updates will be posted as and when there's an update to share. |
I completely agree with @calebcartwright. Even if you're not familiar with JavaScript, there is an analysis aspect which I outlined in #5079 (comment). This doesn't require any programming knowledge, so do jump in, Shields.io is a community project. 😉 |
For anyone looking at this, you can use the Dynamic JSON Badge using Just add a Example with the Javalin discord server: |
To get a total member number, we need to use Like my Wechaty: ![Dynamic JSON Badge](https://img.shields.io/badge/dynamic/json?
url=https%3A%2F%2Fdiscord.com%2Fapi%2Finvites%2F7q8NBZbQzt%3Fwith_counts%3Dtrue&query=%24.approximate_member_count&logo=discord&logoColor=white&label=Users%20Total&color=green) It would be great if we could use some string concatenate in the |
📋 Description
A discord badge as the one currently available, with the only difference, that it shows the total number of people in the server as well:
E.g.
Discord: 15/50 online
🔗 Data
I am not sure if there is such an endpoint with the available data in the Discord API.
🎤 Motivation
Showing the number of online users is good, but sometimes you want to also show the number of people that have joined the server in total. It's good to show the total interest in your project/server.
The text was updated successfully, but these errors were encountered: