Command Structure
pwr-bot uses Discord’s slash command system with organized command groups. All commands are invoked with/ and provide autocomplete suggestions.
Commands are organized using the Cog pattern, where each feature module provides a set of related commands. See
src/bot/commands.rs for implementation details.Command Categories
Feed Management
Manage subscriptions to anime and manga feeds./feed subscribe
Subscribe to AniList, MangaDex, or Comick feedsParameters:
url- Source URL from supported platformsend_into- Where to send notifications (Server/DM)
/feed unsubscribe
Unsubscribe from feedsParameters:
url- Source URL to unsubscribe fromsend_into- Subscription type (Server/DM)
/feed list
View all your active subscriptionsParameters:
send_into- Filter by subscription type (optional)
/feed settings
Configure server feed settings (admin only)Settings:
- Notification channel
- Subscribe/unsubscribe role requirements
Voice Channel Tracking
Track and analyze voice channel activity./vc leaderboard
View ranked voice activity leaderboardParameters:
time_range- Filter by time period (optional)
- Server leaderboard or Voice Partners mode
- Paginated results (10 per page)
- Your current rank display
/vc stats
Display voice activity statistics with chartsParameters:
time_range- Time period to analyze (optional)user- User to view stats for (optional)statistic- Stat type for server view (optional)
- Contribution grid (yearly view)
- Line charts (hourly, weekly, monthly)
- Toggle between user/server stats
/vc settings
Configure voice tracking settings (admin only)Settings:
- Enable/disable voice tracking
- AFK channel behavior
Server Management
General bot configuration and server setup./settings
Configure server-wide bot settings (admin only)Categories:
- Feed notification settings
- Voice tracking settings
- Role permissions
/register
Register the server for bot featuresCreates necessary database entries for the server to use feed subscriptions and voice tracking.
/unregister
Unregister the server (admin only)Removes all server data including subscriptions, settings, and voice tracking history.
/register_owner
Owner-only registration commandUsed for manual server registration by bot owner.
Bot Information
Get information about the bot./about
Display bot information and statisticsShows:
- Bot version and uptime
- Server count
- Developer credits
- Links to documentation and support
/welcome
Display welcome message for new usersProvides an overview of bot features and getting started guide.
Utility Commands
Developer and debugging commands./dump_db
Export database (owner only)Creates a backup of the SQLite database for debugging or migration purposes.
Command Permissions
Permission Levels
Everyone:/feed subscribe(with optional role requirements)/feed unsubscribe(with optional role requirements)/feed list/vc leaderboard/vc stats/about/welcome
/settings/feed settings/vc settings/register/unregister
/dump_db/register_owner
Command Context
Commands behave differently based on context:Server Context
When used in a server:- Feed commands can create server-wide subscriptions
- Voice commands track server voice activity
- Settings commands affect the server configuration
DM Context
When used in DMs:- Feed commands create personal DM subscriptions
- Voice stats show your personal activity across all servers
- Server-specific commands are unavailable
Some commands like
/vc leaderboard are server-only, while others like /feed subscribe work in both contexts with different behavior.Error Handling
The bot provides clear error messages for common issues: Permission Errors:Response Types
Ephemeral vs Public
Ephemeral Responses (only you can see):- Error messages
- Configuration commands
- Personal settings
- Leaderboards
- Statistics
- Feed notifications
Interactive Components
Many commands use Discord’s interactive components: Buttons:- Time range selection (leaderboards, stats)
- Pagination (previous/next)
- Mode toggles (server/user stats)
- User selection (view other users’ stats)
- Time range filters (dropdown)
- Interactive components expire after 120 seconds
- Commands can be re-run to reset the timeout
Command Implementation
All commands follow the Poise framework pattern:Adding New Commands
Adding New Commands
To add a new command to pwr-bot:See
- Create a command module in
src/bot/commands/ - Implement the command with
#[poise::command]attribute - Add the command to
Cogs::commands()insrc/bot/commands.rs
AGENTS.md in the source repository for detailed guidelines.Command Response Times
Typical response times for different command types:- Simple commands (
/about,/welcome) - Instant - Database queries (
/feed list) - Under 100ms - API requests (
/feed subscribe) - 500ms - 2s - Image generation (
/vc leaderboard,/vc stats) - 1-3s - Batch operations - 2-5s per item
Commands that take longer than 3 seconds use Discord’s “defer” mechanism to show a loading state and prevent timeout errors.