Skip to content

LeGeRyChEeSe/LanPlay-DiscordBot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

12 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽฎ LanPlay-DiscordBot

LanPlay-DiscordBot

Visitors Stars Issues Python Docker License

๐ŸŽฎ Modern Discord bot for real-time LAN Play server monitoring

Monitor Nintendo Switch games, players, and servers across multiple LAN Play instances with beautiful Discord integration

๐Ÿš€ Quick Start โ€ข ๐ŸŽฏ Features โ€ข ๐Ÿ“– Documentation โ€ข ๐Ÿค Support

๐Ÿš€ Quick Start

๐Ÿ”ฅ Docker Installation (Recommended)

โœจ Quick start with Docker Compose:

git clone https://github.com/LeGeRyChEeSe/LanPlay-DiscordBot.git
cd LanPlay-DiscordBot
cp .env.example .env

โš ๏ธ IMPORTANT: Configure your .env file before starting:

# Edit .env with a text editor and add your tokens:
# TOKEN=your_discord_bot_token_here
# API_LAN_KEY=your_lan_play_api_key_here
docker-compose up -d

๐Ÿ“‹ Installation Steps

  1. Clone the repository from GitHub
  2. Copy the environment template: cp .env.example .env
  3. โš ๏ธ Configure your API keys in the .env file:
  4. Start the bot with Docker or Python

๐Ÿ“š Need help? View detailed setup guide

๐ŸŽฏ Features

๐Ÿ› ๏ธ What You Get

๐ŸŒŸ Core Components

  • ๐ŸŽฎ Real-time Game Monitoring: Display active Nintendo Switch games and player counts
  • ๐ŸŒ Multi-Server Support: Monitor multiple LAN Play servers simultaneously
  • ๐Ÿ”ง Custom Server Management: Administrators can add/remove custom servers

๐ŸŽฒ Additional Features

  • ๐ŸŒ Multi-language Support: Available in English and French
  • ๐Ÿ“Š Server Uptime Tracking: Display server reliability information
  • ๐ŸŽจ Rich Embeds: Beautiful Discord embeds with game icons and player information

โœจ Smart Features

  • ๐Ÿณ Docker Ready: Fully containerized for easy deployment
  • ๐Ÿ”’ Security First: Non-root Docker containers and input validation

๐Ÿ“– Documentation

Quick Links:

๐Ÿ”ง Installation Methods

๐Ÿณ Docker (Recommended)

Using Docker Compose:

# 1. Clone and navigate
git clone https://github.com/LeGeRyChEeSe/LanPlay-DiscordBot.git
cd LanPlay-DiscordBot

# 2. Create environment file
cp .env.example .env

# 3. โš ๏ธ EDIT .env file with your tokens:
# TOKEN=your_discord_bot_token_here
# API_LAN_KEY=your_lan_play_api_key_here

# 4. Start the bot
docker-compose up -d

Using Docker Run:

docker run -d \
  --name lanplay-discordbot \
  -e TOKEN=your_discord_bot_token_here \
  -e API_LAN_KEY=your_lan_play_api_key_here \
  -v bot_data:/app/data \
  garohrl/lanplay-discordbot:latest

๐Ÿ› ๏ธ Manual Installation

# 1. Clone and navigate
git clone https://github.com/LeGeRyChEeSe/LanPlay-DiscordBot.git
cd LanPlay-DiscordBot

# 2. Create virtual environment
python -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate

# 3. Install dependencies
pip install -r requirements.txt

# 4. Create environment file
cp .env.example .env

# 5. โš ๏ธ EDIT .env file with your API keys:
# TOKEN=your_discord_bot_token_here
# API_LAN_KEY=your_lan_play_api_key_here

# 6. Start the bot
python main.py

โš™๏ธ Configuration

Environment Variables

Create a .env file with the following variables:

# Discord Bot Token (Required)
TOKEN=your_discord_bot_token

# LAN Play API Key (Required)
API_LAN_KEY=your_lan_play_api_key

Getting API Key

๐Ÿ“‹ Step-by-step guide to get your LAN Play API key:

  1. Visit lan-play.com
  2. Open Developer Tools (F12 or Ctrl+Shift+I)
  3. Go to Network tab and refresh the page
  4. Find the getMonitors request and click on it
  5. In the Payload tab, copy the api_key value
  6. Add it to your .env file: API_LAN_KEY=your_copied_api_key_here

โš ๏ธ Important: Without a valid API key, the bot cannot fetch LAN Play server data!

๐Ÿ“ฑ Discord Bot Setup

Creating a Discord Application

  1. Go to the Discord Developer Portal
  2. Click "New Application" and give it a name
  3. Navigate to the "Bot" section
  4. Click "Add Bot" and confirm
  5. Copy the bot token and add it to your .env file

Bot Permissions

The bot requires the following permissions:

  • Send Messages
  • Send Messages in Threads
  • Embed Links
  • Read Message History
  • Manage Expressions (for game icons)
  • Create Expressions
  • Use Slash Commands

Inviting the Bot

  1. In the Discord Developer Portal, go to OAuth2 โ†’ URL Generator
  2. Select these scopes:
    • bot
    • applications.commands
  3. Select the permissions listed above
  4. Use the generated URL to invite the bot to your server

โš ๏ธ Security Note: Keep your bot token secret! Never share it publicly or commit it to version control.

๐ŸŽฎ Commands

Command Description Usage Permission Preview
/help Display help menu and available commands /help Everyone Help
/lan Display LAN Play server information and active games /lan Everyone LAN
/add Add a custom LAN Play server to monitoring /add server:tekn0.net:11451 Administrator Add
/delete Remove a custom LAN Play server /delete server:tekn0.net:11451 Administrator Delete
/version Display bot version and build information /version Everyone -
/changelog Show recent changes and release notes /changelog [count:5] Everyone -

Command Examples

/lan Command

Shows server selection menu with:

  • Server uptime percentages
  • Real-time player counts (active/idle)
  • Game information with custom icons
  • Host and player details

Admin Commands

  • Add Server: /add server:your-server.com:11451
  • Delete Server: /delete server:your-server.com:11451 (with autocomplete)

๐Ÿ“ Project Structure

LanPlay-DiscordBot/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ bot/
โ”‚   โ”‚   โ”œโ”€โ”€ bot.py          # Main bot class and initialization
โ”‚   โ”‚   โ”œโ”€โ”€ commands.py     # Slash command handlers
โ”‚   โ”‚   โ””โ”€โ”€ events.py       # Event handlers (dropdowns, etc.)
โ”‚   โ”œโ”€โ”€ utils/
โ”‚   โ”‚   โ”œโ”€โ”€ lanplay_client.py    # GraphQL client for LAN Play API
โ”‚   โ”‚   โ”œโ”€โ”€ server_manager.py    # Custom server management
โ”‚   โ”‚   โ”œโ”€โ”€ localization.py      # Multi-language support
โ”‚   โ”‚   โ”œโ”€โ”€ version.py           # Semantic versioning system
โ”‚   โ”‚   โ””โ”€โ”€ changelog.py         # Changelog management
โ”‚   โ””โ”€โ”€ config/
โ”‚       โ”œโ”€โ”€ settings.py     # Configuration management
โ”‚       โ””โ”€โ”€ locale/         # Language files
โ”œโ”€โ”€ scripts/                # Development and build scripts
โ”‚   โ”œโ”€โ”€ version_bump.py     # Python version management
โ”‚   โ”œโ”€โ”€ version.sh          # Shell version commands
โ”‚   โ””โ”€โ”€ docker-build.sh     # Docker build with versioning
โ”œโ”€โ”€ static/assets/          # Static resources
โ”œโ”€โ”€ tests/                  # Unit tests
โ”œโ”€โ”€ main.py                 # Application entry point
โ”œโ”€โ”€ requirements.txt        # Python dependencies
โ”œโ”€โ”€ Dockerfile             # Container configuration
โ”œโ”€โ”€ docker-compose.yml     # Docker Compose setup
โ”œโ”€โ”€ Makefile                # Development commands
โ”œโ”€โ”€ VERSION                 # Current version number
โ”œโ”€โ”€ CHANGELOG.md            # Structured changelog
โ”œโ”€โ”€ VERSIONING.md           # Versioning system documentation
โ””โ”€โ”€ .env.example           # Environment template

๐Ÿค Support

๐Ÿ› Having Issues?

๐ŸŒ Official Resources

๐Ÿ”„ Development

Running Tests:

python -m pytest tests/

Code Formatting:

black src/
flake8 src/

Development Setup:

  1. Fork the project
  2. Create feature branch: git checkout -b feature/AmazingFeature
  3. Install dependencies: pip install -r requirements.txt
  4. Make changes and test
  5. Document changes: make add-change TYPE=added DESC="New feature"
  6. Commit: git commit -m 'feat: Add AmazingFeature'
  7. Release: make release-bump TYPE=minor (if needed)
  8. Push and create Pull Request

Version Management:

# Show current version
make version

# Add changelog entry
make add-change TYPE=fixed DESC="Fix bug" ISSUE="#42"

# Version bumping
make bump-patch    # Bug fixes
make bump-minor    # New features  
make bump-major    # Breaking changes

# Release management
make release       # Release unreleased changes
make changelog     # View recent changes

๐Ÿ“ License & Credits

๐Ÿ“„ Licensed under MIT License

๐Ÿ™ Special Thanks

๐Ÿ“ˆ Star History

Star History Chart

๐Ÿ‘จโ€๐Ÿ’ป Author: Garoh โ€ข Discord: garohrl

About

A Discord Bot for retrieving data from http://lan-play.com/

Resources

License

Stars

Watchers

Forks

Contributors