how to get api for discord bot everytime when someone joins to add +1number in website
3 Replies
You can do a GET request to
https://discord.com/api/v10/applications/@me
and the response will have an approximate_guild_count
field with, well, and approximate guild count. It'll be accurate to the first three digits (145; 2,380; 156,000; etc). That will get you the guild (AKA "server") count.
As for user count, you need to use the gateway connection. On initial connection you're sent a GUILD_CREATE
event with a member_count
field that tells you how many members there are at that time. Then you'll have to listen for the GUILD_MEMBER_ADD
and GUILD_MEMBER_REMOVE
events to get real-time notification of when a member is added to or removed from a guild. However, that requires permission from Discord to use and they have said on several occasions that guild-member-count is not a valid use case to be able to use it.
If you're using a library they will have some way to get at least some of this info. What lib are you using? I can get you a link to their server
Since you tagged this as Nodejs I'm assuming you're using Discord.js, so here's their link:
https://discord.gg/djs
If you're using a different library let me know and I can get you that link insteadcan we add api on wordpress ?
You'd have to write some PHP on the backend for WP to talk to your bot (you don't want your login credentials to be on the front-end)