Skip to content

ptMuta/mcbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Minecraft Discord Bot

Setup

1. Install Bot

bash ./install.sh

2. Enable RCON on Minecraft Server

Edit your server.properties:

enable-rcon=true
rcon.port=25575
rcon.password=your_password_here

3. Invite the Bot to Your Server

Use the OAuth2 URL generator in Discord Developer Portal:

  • Scopes: bot, applications.commands
  • Bot Permissions: As needed (basic permissions are sufficient)

4. Run the Bot

Development

export DISCORD_BOT_TOKEN="your_token"
export RCON_PASSWORD="your_password"
python bot.py

Production

sudo ./install.sh

The installer will:

  • Create a dedicated mcbot service user
  • Install files to /opt/mcbot
  • Set up a Python virtual environment
  • Install dependencies
  • Configure systemd service

After installation, edit the service configuration:

sudo systemctl edit --full mcbot.service

Then start the service:

sudo systemctl start mcbot
sudo systemctl status mcbot

View logs:

sudo journalctl -u mcbot -f

Adding New Commands

Create a new Python file in the commands/ directory with a setup(group) function:

import discord
from discord import app_commands

async def my_command(interaction: discord.Interaction):
    embed = discord.Embed(
        title="My Command",
        description="Command executed successfully.",
        color=discord.Color.green()
    )
    await interaction.response.send_message(embed=embed)

def setup(group: app_commands.Group):
    @group.command(name='mycommand', description='My custom command')
    async def cmd(interaction: discord.Interaction):
        await my_command(interaction)

The command will be automatically discovered and registered as /mcbot mycommand on bot startup.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published