CarPiggy
A plugin-based Discord bot for community management, built in both TypeScript (Cloudflare Workers) and Python (discord.py on Fly.io) variants.
Overview
CarPiggy is a Discord bot designed for community management and engagement. It exists in two variants — a TypeScript version running on Cloudflare Workers and a Python version running on Fly.io — each optimized for different deployment models.
Plugin Architecture
Both variants share a plugin-based architecture where features are isolated, independently loadable modules:
- Moderation — Auto-moderation rules, warning system, timeout management
- Server Management — Role assignment, channel configuration, welcome messages
- Community — Engagement tracking, activity metrics, custom commands
- Utilities — Reminders, polls, information lookups
Each plugin registers its own commands, event handlers, and configuration schema. Plugins can be enabled or disabled per server without affecting others.
TypeScript Variant
The TypeScript version runs on Cloudflare Workers using Discord’s HTTP-based interactions API:
- Zero persistent connections — each interaction is a stateless HTTP request
- Sub-10ms response times from Cloudflare’s edge
- State stored in Cloudflare KV and D1
- Deployed via Wrangler with automatic rollbacks
Python Variant
The Python version uses discord.py’s gateway connection for real-time event handling:
- Persistent WebSocket connection to Discord’s gateway
- PostgreSQL for data persistence
- Runs as a containerized service on Fly.io
- Better suited for features requiring real-time event streams (message tracking, voice state changes)
Why Two Variants?
Different deployment models suit different requirements. The Workers variant handles slash commands with minimal latency and zero infrastructure cost. The Python variant handles gateway events that require persistent connections. In practice, they complement each other.