Skip to content

Python script for auto update Minecraft Server Status using Discord Webhook

License

Notifications You must be signed in to change notification settings

gbagush/MCServerStatusBot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Contributors Forks Stargazers Issues MIT License


Logo

Minecraft Server Status Discord Bot

Python script for auto update Minecraft Server Status using Discord Webhook
View Demo · Report Bug · Request Feature


Table of Contents
  1. About The Project
  2. Getting Started
  3. Notes
  4. To Do
  5. License

About The Project

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.

Demo

demo

Getting Started

Prerequisites

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 to true in the server.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.

Installation

Run on Repl.it:

Run on Repl.it

  1. Clone the repo

    git clone https://github.com/gbagush/MCServerStatusBot.git
  2. Install the required libraries by running

    pip3 install -r requirements.txt
  3. 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 URL
    • MESSAGE_ID: After the bot sends the first message in a Discord channel, the MESSAGE_ID in the config.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. FooterExample
    • SLEEP: The interval in seconds between each server status update (default 60 seconds)
  4. Run the script using Python by running the command

    python3 main.py

Notes

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.

To Do

  • Bedrock Server Support
  • Custom embed message

License

Distributed under the MIT License. See LICENSE for more information.

About

Python script for auto update Minecraft Server Status using Discord Webhook

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages