Python script for auto update Minecraft Server Status using Discord Webhook
View Demo
·
Report Bug
·
Request Feature
Table of Contents
This project is a Python script that updates the status of a Minecraft server using the Discord webhook API. It uses the discord-webhook library and the mcsrvstat.us API to retrieve the server status and send it to a designated Discord webhook.
The script's configuration variables can be easily modified to match the server's information and Discord webhook URL. This project is useful for server admins who want to keep their Discord community informed on the server's availability without the need for manual updates.
Overall, this Python script is a simple and effective way to keep your Discord community up-to-date on your Minecraft server's status.
Before using this project, you need to have the following prerequisites:
- Python3 and Python3-pip installed on your machine.
- A Minecraft server running on a publicly accessible host with the
enable-query
option set totrue
in theserver.properties
file. - A Discord account and access to a Discord server where you have permissions to create and manage webhooks.
- Basic knowledge of Python programming and command line interface.
Run on Repl.it:
-
Clone the repo
git clone https://github.com/gbagush/MCServerStatusBot.git
-
Install the required libraries by running
pip3 install -r requirements.txt
-
Customize
config.json
You can customize the
config.json
file to match your server and Discord webhook settings. Here is an explanation of each field:WEBHOOK_URL
: The URL of the Discord webhook where the server status will be sent. check how to get Webhook URLMESSAGE_ID
: After the bot sends the first message in a Discord channel, theMESSAGE_ID
in theconfig.json
file will be automatically filled.SERVER_ADDRESS
: The IP address or domain name of your Minecraft server.SERVER_PORT
: The port number of your Minecraft server. The default port is 25565.SERVER_NAME
: A name for your Minecraft server.FOOTER
: Refers to the additional text displayed at the bottom of a message or document.SLEEP
: The interval in seconds between each server status update (default 60 seconds)
-
Run the script using Python by running the command
python3 main.py
This bot uses the mcsrvstat.us API.
- mcsrvstat.us API is ratelimited to 600 requests per 10 minutes.
- Try not to exceed this limit. If you do, your bots IP address could be blocked for abuse.
- Bedrock Server Support
- Custom embed message
Distributed under the MIT License. See LICENSE
for more information.