bash ./install.shEdit your server.properties:
enable-rcon=true
rcon.port=25575
rcon.password=your_password_hereUse the OAuth2 URL generator in Discord Developer Portal:
- Scopes:
bot,applications.commands - Bot Permissions: As needed (basic permissions are sufficient)
export DISCORD_BOT_TOKEN="your_token"
export RCON_PASSWORD="your_password"
python bot.pysudo ./install.shThe installer will:
- Create a dedicated
mcbotservice 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.serviceThen start the service:
sudo systemctl start mcbot
sudo systemctl status mcbotView logs:
sudo journalctl -u mcbot -fCreate 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.