Jump to content

[PHP][Discord] Show Player Count directly in Discord 1.0.0

   (3 reviews)

1 Screenshot

About This File

In this file I will get you started on how you can use Discord to show your current player count.


First step is to create an application at:


Once created click Bot on the left hand side.

Click "Add Bot" and then "Yes, do it!"

Change your Icon to something more pretty

Click "COPY" underneath "Click to reveal token"

Open the file in the ZIP.

Install PHP composer if not already installed.

Run composer require team-reflex/discord-php

Edit the example_rage.php file and change the "Discord Token here" to the token you copied earlier

Change line 17 IP:PORT to your Server IP and Port

When ready run the file with php -q example_rage.php

This script must always be running for it to appear on the Discord member section. Therefore I would recommend running Linux Screen and running the php -q command then detaching the screen to run it in the background.

The script uses the Discord Heartbeat to keep it active within the list. It will also only poll the server after running the heartbeat 5 times which is every 42 seconds.


To set it up with your Discord server you must do the following:

Take the link you were at to setup your bot - it should look like: https://discord.com/developers/applications/IDHERE/bot

Where it says IDHERE - take it and insert it here: https://discord.com/api/oauth2/authorize?client_id=IDHERE&scope=bot&permissions=1

Once this page loads - select your discord server that you are an admin of. 

This will authorize your bot to submit to your server.


To make your bot appear at the top of the list, simply create a new permission role called Server

Give it permission to send messages

Set it a nice colour

Drag it to the top of your list

Go to the User that is now in your Member list showing player details and give the role of the server you just created


Have fun!


Edited by Wdoyle
Removed my ID

What's New in Version 1.0.0   See changelog


  • Made the script detect if you have edited variables or if you attempt to run it on Localhost (Already been asked)
  • It also casts the Server details and checks if they are available, this is to detect if the server is missing from the Masterlist
  • Token and IP:Port details moved to the variables at the top
  • Like 1

User Feedback

Create an account or sign in to leave a review

You need to be a member in order to leave a review

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Guest yup

   2 of 2 members found this review helpful 2 / 2 members

y use a middle man to get the player count when u could grab it from the server itself and then run a discord bot from the RAGEMP server to modify the bot's presence? it's just additional overhead to grab the player count from the rage masterlist no?

Response from the author:

I use the middleman as some server developers have seperate teams so getting someone to implement a player counter API mechanism from your own server might not be possible.

Your is still a valid suggestion so if you maybe change the section that uses cdn.rage to your own method it would work. No need to mark down the rating as this bot would still work for your idea

Link to review
  • Create New...