Rust Wiki

Revision Difference

Creating_a_player_count_display_discord_bot#565050

<cat>Play.Hosting</cat>⤶ <title>Setting up a discord bot for your Rust server</title>⤶ ⤶ A Discord bot offers a simple and effective way to showcase your Rust server right within your Discord. It’s a common feature that nearly every Rust server uses.⤶ # Method #1 - No Hosting Needed & Free⤶ ⤶ ## PlayerCountBot.com⤶ ⤶ PlayerCountBot supports Rust using A2S queries or RCON (for more advanced data such as "joining" player count). Below is a full walkthrough on how to link your Rust server with your custom Discord bot using PlayerCountBot.⤶ ⤶ ## 🤖 Creating your Discord bot⤶ ⤶ You’ll first need to create a Discord bot using the [Discord Developer Portal](https://discord.com/developers/applications/). Follow the steps below:⤶ ⤶ 1. Go to the [Developer Portal](https://discord.com/developers/applications/)⤶ 2. At the top, click `New Application`⤶ 3. Give your bot a `Name`, and select a team (`Personal` is fine), then click `Create`⤶ * This name will be visible publicly on the bot⤶ * You can set a profile picture later in the settings⤶ 4. Great! Now continue with the rest of the guide below.⤶ ⤶ ## 🔗 Linking your Rust server with PlayerCountBot⤶ ⤶ This part is quick and easy — you’ll also be able to configure custom status templates and scrolling messages!⤶ ⤶ 1. Visit https://physgun.com/playercountbot and click `Login to Discord ->`⤶ 2. Click the `Create` button⤶ 3. Enter your `Server Information` (name, game type = Rust), then click `Next`⤶ 4. Fill out the `Query Setup`:⤶ * For Rust:⤶ * Use your server’s IP and port⤶ * If you want to show joining players, **you must use the Rust RCON method**⤶ * Enable RCON in your Rust server startup with the following:⤶ ```⤶ +rcon.port 28016 +rcon.password "yourSecurePassword" +rcon.web 1⤶ ```⤶ * Ensure the RCON port is accessible via your firewall and hosted IP⤶ 5. Click `Next`⤶ ⤶ Now we’ll link your bot:⤶ ⤶ 6. Open the [Discord Developer Portal](https://discord.com/developers/applications/) and select your bot⤶ 7. Click on the `OAuth2` tab⤶ 8. Click `Copy` under the `CLIENT ID`⤶ ⤶ <image src="2923d/8ddbdd23daf11d0.png" size="70975" name="Copying the Client ID from Discord" />⤶ ⤶ 9. Go back to PlayerCountBot and paste the `CLIENT ID` into the `Bot Client ID` field⤶ ⤶ <image src="2923d/8ddbdd221648f89.png" size="74919" name="Pasting Discord Client ID into playercountbot" />⤶ ⤶ 10. Go back to the Developer Portal and click the `Bot` tab⤶ 11. Under `TOKEN`, click `Reset Token` – this is required to generate a new token ⤶ **⚠️ NEVER share this token with anyone.**⤶ <image src="2923d/8ddbdd24f5702a4.png" size="110210" name="Resetting the Discord Token to obtain a new one" />⤶ ⤶ 12. After the token is generated, click `Copy`⤶ <image src="2923d/8ddbdd25c382242.png" size="222724" name="Copying the Discord Bot Token" />⤶ ⤶ 13. Return to PlayerCountBot and paste the token into the `Bot Token` input⤶ 14. Click `Create` — you’re done!⤶ ⤶ ## ✅ Invite the bot to your Discord⤶ ⤶ To invite the bot to your server, simply click the `Invite` button at the top right of PlayerCountBot.⤶ ⤶ | TIP: Want a profile picture for your bot? Go back to the `Bot` tab in the [Developer Portal](https://discord.com/developers/applications/) and upload a custom icon and banner.⤶ ⤶ ---⤶ ⤶ PlayerCountBot will now automatically update your Discord bot’s status with live Rust server data such as player count, and if using RCON, even track players that are joining.⤶ ⤶ If you run into issues or need help, visit [https://playercountbot.com](https://playercountbot.com) and join the support Discord!⤶ ⤶ # Method 2: Self-hosted NodeJS Bot⤶ ⤶ If you'd rather not use the hosted version, there's an open source alternative available that you can run yourself.⤶ ⤶ You can find it here: [https://github.com/Killa4/Rust-Player-Count-Bot](https://github.com/Killa4/Rust-Player-Count-Bot)⤶ ⤶ This version runs locally and updates your Discord bot’s status with Rust server info using A2S queries. It requires basic Node.js knowledge and a machine or server to host the script.