Skip to content

Welcome to **Discord Disruptor**, the bot that brings delightful chaos to your Discord server!

License

Notifications You must be signed in to change notification settings

XanderD99/disruptor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

56 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Disruptor ๐ŸŽ‰

Welcome to Disruptor, the bot that brings delightful chaos to your Discord server! This mischievous Go bot randomly joins voice channels at unpredictable intervals to play surprise sounds from your server's Discord soundboard. Whether you want spontaneous fun, a good laugh, or a jump scare, Disruptor delivers! Fast, reliable, and built on Discord's native soundboard APIโ€”no external sound storage required. ๐Ÿš€๐Ÿ”Š


What Does It Do? ๐ŸŽญ

  • ๐ŸŽฒ Random Voice Channel Invasions: Sneaks into voice channels at random intervals for maximum surprise.
  • ๐Ÿ”Š Native Soundboard Integration: Plays sounds directly from your server's Discord soundboard.
  • โฐ Unpredictable Timing: You never know when it's coming next!
  • ๐ŸŽต Auto-Discovery: Automatically uses all soundboard sounds available in your server.
  • ๐ŸŽฏ Smart Channel Selection: Picks active voice channels using weighted random selection for maximum impact.
  • โš™๏ธ Per-Guild Configuration: Each server can customize disruption intervals and preferences.
  • ๐Ÿƒโ€โ™‚๏ธ Bun ORM & SQLite: Fast, modern database operations with automatic schema management.
  • ๐Ÿ› ๏ธ Environment Variable Config: Fine-tune chaos levels with simple env vars.
  • ๐Ÿณ Docker-Ready: Optimized Dockerfile for easy deployment.
  • ๐Ÿ“Š Metrics & Logs: Track disruptions with integrated metrics and structured logging.
  • ๐Ÿงฉ Modular Mayhem: Easily add new disruption strategies.
  • ๐Ÿ•ต๏ธ Voice Channel Vigilance: Monitors voice channels and picks the perfect moments to strike.
  • โš–๏ธ Weighted Channel Selection: Set custom weights for voice channels to control disruption probability.
  • ๐Ÿง‘โ€๐Ÿ’ป Slash Commands: Control the bot with Discord slash commands (/play, /interval, /chance, /disconnect, /next, /weight).
  • ๐ŸŽš๏ธ Interval & Chance Control: Adjust how often and how likely disruptions are per guild.
  • ๐Ÿ›‘ Manual Disconnect: Instantly stop disruptions with a command.
  • ๐Ÿ”„ Next Disruption Preview: See when the next chaos event is scheduled.
  • ๐Ÿง  Advanced Scheduler: Worker pools, jitter, grouping, and more for unpredictable disruption schedules.
  • ๐Ÿท๏ธ Structured Logging: Debug and monitor with clear, contextual logs.
  • ๐Ÿ—๏ธ Automatic Schema Migration: Database tables and schema managed on startup.
  • ๐Ÿงช Test Infrastructure: Ready for tests (no unit tests yet, but infra is set up).
  • ๐Ÿ›ก๏ธ Safe Defaults: In-memory DB for dev, file-based for production.

Getting Started ๐Ÿš€

๐Ÿƒโ€โ™‚๏ธ Quick Start (10 minutes)

Want to get up and running immediately? Follow the Quick Start Guide for the fastest setup path.

๐Ÿ“š Complete Setup Guides

Choose the guide that matches your experience level: ๐ŸŽฏ

Guide Audience Time Description
Quick Start Everyone ๐Ÿ‘ฅ 10 min โšก Fastest path to a working bot ๐Ÿš€
Discord Setup New to Discord bots ๐Ÿ†• 15 min ๐Ÿ“ Step-by-step Discord bot creation ๐Ÿค–
Installation All platforms ๐ŸŒ 20 min ๐Ÿ”ง Detailed platform-specific installation ๐Ÿ’ป
Configuration Advanced users ๐Ÿค“ 30 min โš™๏ธ Complete configuration reference ๐Ÿ“–
Deployment Production ๐Ÿญ 45 min ๐Ÿš€ Production deployment strategies ๐Ÿณ

โšก Minimal Setup

If you just want to test locally (the lazy way ๐Ÿ˜Ž):

# 1. Create Discord bot (get token from Discord Developer Portal)
# 2. Clone and build
git clone https://github.com/XanderD99/disruptor.git
cd disruptor && go mod download && make build

# 3. Run with your token
export CONFIG_TOKEN="your_discord_bot_token"
./output/bin/disruptor

Need help? ๐Ÿค” Start with the Discord Setup Guide if you're new to Discord bots.

๐Ÿ“š Complete Documentation Index - Find the right guide for your needs! ๐Ÿ—บ๏ธ


Docker Deployment ๐Ÿณ

Quick Docker Setup ๐Ÿ‹

# Build image ๐Ÿ—๏ธ
make docker-build

# Run with environment variables ๐ŸŒ
docker run -d --name disruptor \
  -e CONFIG_TOKEN="your_discord_bot_token" \
  -e CONFIG_DATABASE_DSN="file:/data/disruptor.db?cache=shared" \
  -v $(pwd)/data:/data \
  disruptor:latest

Docker Compose ๐ŸŽผ

# docker-compose.yml ๐Ÿ“
version: '3.8'
services:
  disruptor:
    build: .
    environment:
      - CONFIG_TOKEN=${DISCORD_TOKEN}  # Set in .env file
      - CONFIG_DATABASE_DSN=file:/data/disruptor.db?cache=shared
    volumes:
      - ./data:/data
    restart: unless-stopped
echo "DISCORD_TOKEN=your_bot_token" > .env  # ๐Ÿ”‘ Secret sauce!
docker-compose up -d  # ๐Ÿš€ Blast off!

๐Ÿ“– Production Deployment: See Deployment Guide for advanced deployment scenarios! ๐Ÿญโœจ


How It Works ๐Ÿ”ง

  • Soundboard Discovery ๐Ÿ”: Finds all soundboard sounds in your server.
  • Random Selection ๐ŸŽฒ: Picks a sound and a channel at random.
  • Native Playback ๐Ÿ”Š: Uses Discord's soundboard API for high-quality audio.
  • Smart Timing ๐Ÿง : Advanced scheduler determines when to disrupt.
  • Guild Configuration โš™๏ธ: Stores only server settings (intervals, preferences) in the database.
  • Slash Commands โšก: Control disruption, intervals, chance, and more directly from Discord.

Configuration โš™๏ธ

Essential Configuration ๐Ÿ”ง

Required (or it won't work! ๐Ÿ˜ฑ):

Recommended (for a better experience ๐Ÿ’ฏ):

  • CONFIG_DATABASE_DSN: Database location (file:./disruptor.db?cache=shared for persistent storage) ๐Ÿ—„๏ธ
  • CONFIG_LOGGING_LEVEL: Log verbosity (debug, info, warn, error) ๐Ÿ“

Configuration Examples ๐Ÿ’ก

# Development (for testing & breaking things ๐Ÿงช)
export CONFIG_TOKEN="your_bot_token"
export CONFIG_DATABASE_DSN="file::memory:?cache=shared"  # In-memory (poof! gone when you restart ๐Ÿ’จ)
export CONFIG_LOGGING_LEVEL="debug"

# Production (for the real deal ๐ŸŽฏ)
export CONFIG_TOKEN="your_bot_token"
export CONFIG_DATABASE_DSN="file:./disruptor.db?cache=shared"  # Persistent (keeps your data safe ๐Ÿ›ก๏ธ)
export CONFIG_LOGGING_LEVEL="info"

๐Ÿ“– Complete Reference: See Configuration Guide for all options and examples! ๐Ÿ“šโœจ


Database ๐Ÿ—ƒ๏ธ

  • SQLite + Bun ORM ๐Ÿ’ช: Zero config, fast, reliable, portable.
  • Options (pick your flavor! ๐Ÿฆ):
    • In-memory: CONFIG_DATABASE_DSN=file::memory:?cache=shared โšก (fast but forgetful!)
    • File-based: CONFIG_DATABASE_DSN=file:./disruptor.db?cache=shared ๐Ÿ’พ (remembers everything!)
    • Custom path: CONFIG_DATABASE_DSN=file:/path/to/your/database.db?cache=shared ๐Ÿ—‚๏ธ (your way!)
  • Automatic Schema Management ๐Ÿค–: Tables and migrations handled on startup.

Development ๐Ÿ› ๏ธ

Directory Structure ๐Ÿ“‚

  • cmd/ ๐Ÿšช: Application entrypoints
  • internal/ ๐Ÿ”’: Core application logic
    • commands/ โšก: Discord slash commands (/play, /interval, /chance, /disconnect, /next)
    • handlers/ ๐ŸŽฏ: Discord event handlers
    • models/ ๐Ÿ—„๏ธ: Database models (Bun ORM)
    • scheduler/ โฐ: Audio scheduling and timing logic
    • metrics/ ๐Ÿ“Š: Prometheus metrics and monitoring
    • util/ ๐Ÿ› ๏ธ: Shared utilities
  • pkg/ ๐Ÿ“ฆ: Reusable packages (logging, processes)
  • ci/ ๐Ÿญ: CI/CD configuration and Docker files
  • docs/ ๐Ÿ“š: Documentation
  • output/ ๐ŸŽฏ: Compiled binaries

Build and Test ๐Ÿงช

# Download dependencies ๐Ÿ“ฆ
go mod download

# Build application ๐Ÿ”จ
make build

# Run tests (currently no tests implemented ๐Ÿ˜…)
make test

# Static analysis and formatting ๐Ÿงน
go vet ./...
go fmt ./...

Note โš ๏ธ: Do not use make lint - there are known configuration issues with golangci-lint. Use go vet ./... instead.

Development Setup ๐Ÿ’ป

# Clone repository ๐Ÿ“ฅ
git clone https://github.com/XanderD99/disruptor.git
cd disruptor

# Install system dependencies (Ubuntu/Debian) ๐Ÿ”ง
sudo apt install -y libopus-dev pkg-config

# Build and run in development mode ๐Ÿš€
go mod download
make build
export CONFIG_TOKEN="your_dev_bot_token"
export CONFIG_LOGGING_LEVEL="debug"
./output/bin/disruptor

๐Ÿ“– Contributing: See CONTRIBUTING.md for development guidelines! ๐Ÿคโœจ


Slash Commands ๐ŸŽ›๏ธ

  • /play ๐ŸŽต โ€” Play a soundboard sound immediately
  • /interval โฑ๏ธ โ€” Set disruption interval per guild
  • /chance ๐ŸŽฒ โ€” Set disruption chance per guild
  • /weight โš–๏ธ โ€” Set channel selection weight (0-100, higher = more likely to be chosen)
  • /disconnect ๐Ÿ›‘ โ€” Instantly stop disruptions
  • /next ๐Ÿ”ฎ โ€” Preview next scheduled disruption

Weighted Channel Selection โš–๏ธ

Disruptor now supports weighted channel selection, allowing you to control which voice channels are more likely to be chosen for disruptions! ๐ŸŽฏโœจ

How It Works ๐Ÿ”ง

  • Each voice channel has a weight that determines its selection probability ๐Ÿ“Š
  • Default weight: 50 (balanced selection) โš–๏ธ
  • Range: 0-100 (0 = never selected ๐Ÿšซ, 100 = maximum priority ๐ŸŒŸ)
  • Smart selection: Channels with higher weights are proportionally more likely to be chosen ๐Ÿง 

Managing Weights ๐ŸŽš๏ธ

# Set a channel's weight ๐ŸŽฏ
/weight channel:#general-voice weight:75

# Check current weight (omit weight parameter) ๐Ÿ‘€
/weight channel:#general-voice

# High priority channel (disrupted more often) ๐Ÿ”ฅ
/weight channel:#chaos-room weight:90

# Low priority channel (disrupted less often) ๐Ÿคซ
/weight channel:#quiet-study weight:10

# Exclude channel from disruptions ๐Ÿšซ
/weight channel:#meeting-room weight:0

Examples ๐Ÿ’ก

If you have 3 channels with these weights:

  • ๐ŸŽต Music Room: Weight 80 (party time! ๐ŸŽ‰)
  • ๐Ÿ—ฃ๏ธ General Chat: Weight 50 (default balance โš–๏ธ)
  • ๐Ÿ“š Study Hall: Weight 20 (keep it quiet ๐Ÿคซ)

Music Room will be disrupted ~53% of the time, General Chat ~33%, and Study Hall ~13%. Math! ๐Ÿงฎโœจ

Use Cases ๐ŸŽช

  • Priority channels ๐ŸŒŸ: Boost weight for channels where disruptions are most welcome
  • Protected spaces ๐Ÿ›ก๏ธ: Lower weight for serious discussion channels
  • Event management ๐ŸŽŠ: Temporarily adjust weights for special events
  • Community preferences ๐Ÿ—ณ๏ธ: Let server members vote on channel disruption preferences

Troubleshooting ๐Ÿ”ง

Common Issues ๐Ÿค•

Issue Quick Fix
"CONFIG_TOKEN is not set" ๐Ÿ˜ฑ export CONFIG_TOKEN="your_bot_token" ๐Ÿ”‘
Bot won't connect ๐Ÿ˜ต Verify token in Discord Developer Portal ๐Ÿ”
No slash commands ๐Ÿ˜ญ Wait 1 hour for sync, or re-invite bot โฐ
Can't join voice ๐Ÿšซ Check bot has Connect + Speak permissions ๐ŸŽค
No sounds playing ๐Ÿ”‡ Upload sounds to server soundboard ๐ŸŽต

Getting Help ๐Ÿ†˜


Contributing ๐Ÿค

We welcome contributions! Here are some areas where help is appreciated: ๐Ÿ™‹โ€โ™€๏ธ๐Ÿ™‹โ€โ™‚๏ธ

  • ๐ŸŽฏ Smart channel selection algorithms - Better logic for choosing voice channels (make it smarter! ๐Ÿง )
  • ๐ŸŽญ New disruption strategies - Creative ways to surprise users (chaos innovation! ๐Ÿ’ก)
  • โš™๏ธ Advanced configuration options - More customization features (all the knobs! ๐ŸŽ›๏ธ)
  • ๐Ÿš€ Performance optimizations - Memory and CPU improvements (faster chaos! โšก)
  • ๐ŸŒ Global soundboard support - Cross-server sound sharing (world domination! ๐ŸŒŽ)
  • ๐Ÿ“ Documentation improvements - Better guides and examples (make it clearer! ๐Ÿ“–)
  • ๐Ÿงช Test coverage - Unit and integration tests (break it properly! ๐Ÿ”จ)

๐Ÿ“– Read more: CONTRIBUTING.md for development guidelines! ๐Ÿคโœจ


License ๐Ÿ“œ

MIT License. See LICENSE.


Acknowledgments ๐Ÿ™Œ

  • Discord API ๐Ÿค– (the magic behind the curtain)
  • Disgo โšก (our Discord superhero library)
  • Bun ๐Ÿ—„๏ธ (database wizardry)
  • Go ๐Ÿน (gopher power!)
  • SQLite ๐Ÿ“ฑ (tiny but mighty database)
  • Everyone who's been "disrupted" by this botโ€”you're the real MVP! ๐Ÿ†๐Ÿ’–

Warning โš ๏ธ: Use responsibly! This bot is for fun and should only be used in servers where surprise audio is welcome. Always respect your community's preferences and server rules. Happy disrupting! ๐ŸŽ‰๐Ÿ˜ˆ

About

Welcome to **Discord Disruptor**, the bot that brings delightful chaos to your Discord server!

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •