Skip to content

chiao-ke/mcss_server_status_discord_bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Minecraft Server Status Discord Bot for MC Server Soft

A Discord bot specifically designed to monitor MC Server Soft servers and automatically update Discord channels with real-time server status information.

Note: This bot is optimized for servers running with MC Server Soft - the free Minecraft server wrapper UI for Windows.

Features

  • 🔍 Real-time MC Server Soft server status monitoring
  • 📊 Automatic Discord channel updates
  • 🛡️ Minimal permission requirements for enhanced security
  • 🐍 Python-based with simple setup
  • 🖥️ Designed specifically for MC Server Soft wrapper integration

Prerequisites

Installation

1. Environment Setup (Recommended)

Using conda/miniconda for environment management:

# Create a new environment
conda create --name discord-bot python=3.10

# Activate the environment
conda activate discord-bot

2. Install Dependencies

pip install discord.py requests

3. Configuration

  1. Clone this repository or download the code
  2. Open discord_bot.py in your preferred code editor
  3. Find the settings section between #Settings Starts: and #Settings End---
  4. Configure your bot settings:
    • Discord bot token
    • Channel ID where updates will be sent
    • Minecraft server address and port
    • Update interval

4. Discord Bot Setup

  1. Go to Discord Developer Portal
  2. Create a new application and bot
  3. Copy the bot token for configuration
  4. Invite the bot to your server with these permissions:
    • Send Messages
    • Manage Messages

⚠️ Security Note: Only grant necessary permissions. Avoid giving "Administrator" permissions to prevent potential security risks.

Usage

Method 1: Using Batch File (Easiest)

Create a run_bot.bat file in the same directory as your Python script:

Option A: Default conda installation

@echo off
echo Starting Discord Bot...
echo.

REM Activate conda environment
call conda activate discord-bot

REM Check if activation was successful
if errorlevel 1 (
    echo Error: Could not activate conda environment 'discord-bot'
    echo Please make sure the environment exists and conda is properly installed.
    pause
    exit /b 1
)

echo Environment activated successfully!
echo Running Discord bot...
echo.

REM Run the Python script
python discord_bot.py

REM Keep the window open if there's an error
if errorlevel 1 (
    echo.
    echo Bot stopped with an error. Check the output above.
    pause
)

Option B: Custom conda installation path

@echo off
echo Starting Discord Bot...
echo.

REM Set custom conda path (modify this to your conda installation path)
set CONDA_PATH=C:\Your\Custom\Path\To\Miniconda3

REM Initialize conda for batch file
call "%CONDA_PATH%\Scripts\activate.bat" "%CONDA_PATH%"

REM Activate your environment
call conda activate discord-bot

REM Check if activation was successful
if errorlevel 1 (
    echo Error: Could not activate conda environment 'discord-bot'
    echo Please check your conda path and environment name.
    pause
    exit /b 1
)

echo Environment activated successfully!
echo Running Discord bot...
echo.

REM Run the Python script
python discord_bot.py

REM Keep the window open if there's an error
if errorlevel 1 (
    echo.
    echo Bot stopped with an error. Check the output above.
    pause
)

To use the batch file:

  1. Choose the appropriate version based on your conda installation
  2. If using Option B, modify the CONDA_PATH to match your installation directory
  3. Save as run_bot.bat in your project folder
  4. Double-click run_bot.bat to start the bot
  5. The CMD window will show the bot status and keep running

Method 2: Running with VS Code

  1. Open the project in Visual Studio Code
  2. Select the correct Python interpreter (your conda environment)
    • Press Ctrl+Shift+P → "Python: Select Interpreter"
    • Choose the discord-bot environment
  3. Press F5 or click the "Run" button to start the bot

Method 3: Manual Command Line

# Activate your environment
conda activate discord-bot

# Run the bot
python discord_bot.py

Expected Output

When running successfully, your bot will send status updates like this:

Bot Status Example

Troubleshooting

Common Issues

  • IDE Compatibility: This bot has been tested with VS Code. If you encounter issues with other IDEs, try using VS Code.
  • Environment Issues: Ensure you're using the correct Python environment with all dependencies installed.
  • Permission Errors: Make sure your bot has the necessary permissions in the Discord server.
  • Batch File Issues:
    • If the batch file can't find conda, make sure Anaconda/Miniconda is properly installed and added to PATH
    • If environment activation fails, verify the environment name matches what you created
    • Run the batch file as Administrator if you encounter permission issues

Batch File Troubleshooting

If your run_bot.bat doesn't work:

  1. Conda not found: Add conda to your system PATH or use the full path:

    call "C:\Users\YourUsername\miniconda3\Scripts\activate.bat" discord-bot
  2. Environment name mismatch: Make sure your environment name matches:

    conda info --envs  # Check your environment names
  3. Script location: Ensure the batch file is in the same folder as discord_bot.py

Getting Help

If you encounter issues:

  1. Check that all dependencies are installed correctly
  2. Verify your bot token and server settings
  3. Ensure the bot has appropriate permissions in your Discord server
  4. Check the console for error messages

Contributing

This is my first Discord bot project, so improvements and suggestions are welcome! Feel free to:

  • Report bugs
  • Suggest features
  • Submit pull requests

License

MIT License

Acknowledgments

  • Thanks to the MC Server Soft team for creating an excellent Minecraft server wrapper
  • Thanks to the Discord.py community for excellent documentation
  • Minecraft server status checking community for inspiration

About

A Discord bot can get your MCSS servers Status and update it to a Discord channel

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages