155 Commits

Author SHA1 Message Date
Chris Ham
2e6cfe21d8 remove unused imports 2025-08-17 09:57:04 -07:00
Chris Ham
5d72159cb2 Fix scheduled events not executing due to property name mismatch
The scheduler was correctly scheduling events but they weren't executing because the code was checking for camelCase property names (channelId, pingRoleId) while the database returns snake_case names (channel_id, ping_role_id). This caused channel and role validation to be skipped, resulting in silent failures.

Also added sqlite3 CLI to Docker container for debugging database issues.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-17 09:53:38 -07:00
Chris Ham
8823eac094 Convert to database-first configuration with token storage
- Rename config.json → seed.json to clarify seeding purpose
- Update ConfigManager to be database-first with minimal file fallbacks
- Store Discord token in database instead of environment variables
- Remove allowedSfxChannels functionality completely
- Update seeding script to import token from seed.json to database
- Add token field to bot_config table in database schema
- Update Docker volume mount to use seed.json
- Update gitignore to protect seed.json while allowing seed.example.json

Configuration Flow:
1. First run: Import from seed.json to database (one-time seeding)
2. Runtime: All configuration from SQLite database
3. Fallback: Environment variables if database unavailable

Security: All sensitive data now stored in encrypted SQLite database

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-16 23:37:06 -07:00
Chris Ham
6d93f3dcad /soundboard -> /sfxboard 2025-08-16 22:32:37 -07:00
Chris Ham
7dc7a92dd1 ephemeral 2025-08-16 22:22:40 -07:00
Chris Ham
b2821d412c SFX -> Sfx 2025-08-16 22:21:10 -07:00
Chris Ham
46b78dd6b3 Add reaction-based status feedback for prefix SFX commands
- Implement reaction progression: 🔊 (playing) →  (finished)
- Remove permissions-heavy removeAll() call that was causing errors
- Add error reaction () for failed sound playback
- Fallback to text reply if reactions fail (permission handling)
- Maintain clean chat experience with minimal visual feedback

Status Flow:
- !sfx command starts: 🔊 reaction added
- Sound finishes playing:  reaction added (both visible)
- Error occurs:  reaction added

Now all SFX interfaces provide consistent status feedback:
- Prefix: Reaction-based progression
- Slash commands: Ephemeral message updates

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-16 22:05:20 -07:00
Chris Ham
98ed84aa2b Fix reboot command configuration reference
- Update reboot command to use ConfigManager instead of raw config
- Fix broken adminUserId reference that was causing command errors
- Use getBotConfig() method to properly access admin configuration
- Ensure reboot command works with hybrid database/file config system

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-16 21:50:35 -07:00
Chris Ham
bcefe03c50 Remove allowedSfxChannels functionality - allow SFX in all channels
- Remove allowedSfxChannels from database schema and all code
- Remove channel checking logic from all SFX commands (!sfx, /sfx, /soundboard)
- Remove /config sfxchannels subcommand
- Update config.json and example to remove channel restrictions
- Simplify SFX system to work in any channel with bot access

Benefits:
- Better user experience - no confusing channel restrictions
- Simpler configuration - fewer settings to manage
- Cleaner codebase - reduced complexity
- Universal access - SFX works anywhere the bot can send messages

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-16 21:45:42 -07:00
Chris Ham
e9b3b630b6 Add smart contextual autocomplete for admin role management
- Add autocomplete to /config roles add/remove commands
- /config roles add only shows roles not currently self-assignable
- /config roles remove only shows roles currently self-assignable
- Filter out bot roles, @everyone, and unmanageable roles
- Convert role parameter to string with autocomplete for better UX
- Add role name validation and lookup in config command

Admin Experience Improvements:
- Smart role suggestions prevent duplicate/invalid selections
- No more seeing roles already in the self-assignable list
- Only see roles the bot can actually manage
- Clean, focused autocomplete interface

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-16 21:05:46 -07:00
Chris Ham
efd5472eed Add smart contextual autocomplete for role management
- Add context-aware autocomplete for /role add and /role remove commands
- /role add only shows roles user doesn't have that are self-assignable
- /role remove only shows roles user currently has that are self-manageable
- Filter autocomplete based on user input with 25 result limit
- Convert role options from RoleOption to StringOption with autocomplete
- Prevent users from seeing irrelevant role choices

User Experience Improvements:
- Smart role suggestions based on current user state
- No more trying to add roles you already have
- No more seeing roles you can't manage
- Clean, focused autocomplete interface

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-16 20:49:01 -07:00
Chris Ham
3c8e005405 Fix role configuration database persistence issue
- Fix /config roles add/remove commands not saving to database
- Prevent upsertGuildConfig from overwriting direct database role updates
- Add early return for role management to skip general config update
- Ensure role IDs are properly persisted when using /config roles commands
- Add proper success feedback and logging for role configuration changes

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-16 20:33:43 -07:00
Chris Ham
61a376cfbb Modernize role management system with slash commands and role IDs
- Convert role management from prefix to slash commands (/role add/remove/list)
- Update database schema to store role IDs as JSON arrays instead of regex patterns
- Add /config roles command for administrators to manage allowed roles
- Simplify database schema by reusing allowed_roles_for_request field as JSON
- Add database reset script (pnpm reset-db) for easy testing and migration
- Update config format to only support array format (no backward compatibility)

Role Management Features:
- /role add <role> - Self-assign roles with dropdown selection
- /role remove <role> - Remove roles with dropdown selection
- /role list - Show available self-assignable roles
- /config roles add/remove/list/clear - Administrator role management

Technical Improvements:
- Role ID based matching (more reliable than name-based regex)
- Type-safe role selection with Discord's native role picker
- Permission hierarchy validation
- Rich embed responses with proper error handling
- Ephemeral responses for clean chat experience

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-16 18:07:07 -07:00
Chris Ham
18350ee878 Consolidate soundboard categories and improve layout
- Merge all people categories (JOSH, LANX, MUTT, etc.) into NERDS section
- Consolidate TV & movie categories into single TV & MOVIES section
- Maintain alphabetical order within all sections
- Update soundboard to show 4 categories per row for cleaner layout
- Remove verbose category list from soundboard interface
- Add emojis to category headers for better visual appeal

Soundboard now shows:
- 🔉 GENERAL - Common/utility sounds
- 🤓 NERDS - Gaming, streaming, and personality sounds
- 🎥 TV & MOVIES - All show/movie clips combined
- Clean 4-button layout per row

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-16 16:47:59 -07:00
Chris Ham
aaf33d55db CHECKPOINT: Interactive soundboard and refactored SFX system
Major Features Implemented:
- Complete Discord.js v14 modernization from v12 with hybrid command system
- SQLite database for dynamic guild configuration management
- Interactive soundboard with categorized button interface (/soundboard)
- Three-tier SFX interface: prefix (!sfx), autocomplete (/sfx), and visual soundboard
- Auto-registration system for public bot distribution
- Soft delete guild management preserving configurations

Technical Improvements:
- Refactored SFX playing into reusable service methods (playSFXInteraction/playSFXMessage)
- Smart markdown chunking that respects code block boundaries
- High-performance caching for 275+ sound effects with autocomplete optimization
- Modern Discord.js v14 patterns (MessageFlags.Ephemeral, proper intents)
- Fixed security vulnerability in @discordjs/opus with pnpm overrides
- Docker deployment with Node 20 and npm for reliable SQLite compilation

Interactive Soundboard Features:
- Category-based navigation with buttons (GENERAL, NERDS, TWIN PEAKS, etc.)
- Pagination support for large categories (16 sounds per page, 4 per row)
- Real-time status updates (Playing → Finished playing)
- Navigation buttons (Previous/Next/Back to Categories)
- Ephemeral responses for clean chat experience

Database System:
- Auto-migration from config.json to SQLite on first run
- /config slash commands for live server configuration
- Scheduled events with timezone support (object and cron formats)
- Guild auto-registration with welcome messages for new servers

Current State: Fully functional modern Discord bot ready for public distribution
2025-08-16 16:20:02 -07:00
Chris Ham
0b167aaa35 Add high-performance caching for SFX autocomplete
- Pre-sort SFX names at startup for efficient autocomplete
- Add search result caching with Map for instant repeated queries
- Respect Discord's 25-choice autocomplete limit
- Cache invalidation when SFX directory changes
- Optimize for 275+ sound effects with minimal latency

Performance improvements:
- Autocomplete responses now cached and instant
- No file system access during user interactions
- Memory-efficient search result caching

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-16 15:21:50 -07:00
Chris Ham
c3adb66de8 Improve SFX list formatting and add smart markdown chunking
- Add smart chunking logic that respects markdown block boundaries
- Prevent code blocks from being split across Discord messages
- Update SFX list display to use improved README.md formatting
- Ensure proper markdown rendering in Discord chat

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-16 15:13:43 -07:00
Chris Ham
f8147ffb14 formatting 2025-08-16 15:02:06 -07:00
Chris Ham
bc74978a79 Update to modern Discord.js ephemeral message pattern
- Replace ephemeral: true with flags: [MessageFlags.Ephemeral]
- Add MessageFlags import to Discord.js imports
- Update all slash command error responses to use modern flag syntax
- Maintains same functionality with Discord.js v14 best practices

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-16 15:01:49 -07:00
Chris Ham
437206851b Update SFX list and improve display functionality
- Update sfx/README.md to include all 275 sound files with proper categorization
- Organize missing sounds into appropriate categories (SILICON VALLEY, KING OF THE HILL, etc.)
- Fix SFX list display to use local README.md instead of external URL
- Add fallback to auto-generated list if README is missing
- Improve chunking to prevent Discord character limit errors

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-16 14:54:40 -07:00
Chris Ham
80b21e5073 Fix security vulnerability with pnpm override
- Add pnpm override to replace vulnerable @discordjs/opus with opusscript
- Eliminates CVE-2024-21521 Denial of Service vulnerability (CVSS 8.7)
- Maintains API compatibility while using secure implementation
- Security audit now shows: No known vulnerabilities found

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-16 14:26:49 -07:00
Chris Ham
fd68a02503 Update CLAUDE.md to reflect current SQLite database architecture
- Document SQLite database system with table structures
- Update commands to match package.json scripts (start, stop, boom, etc.)
- Add comprehensive database configuration flow documentation
- Document auto-registration system for public bot distribution
- Update Docker setup details (Node 20, npm usage, persistence)
- Add guild management and soft delete system documentation
- Document hybrid configuration system (database + file fallback)
- Update architecture with all new services and components

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-16 14:21:24 -07:00
Chris Ham
c2962bac16 Update README.md with SQLite database documentation
- Document database-driven configuration system
- Add three configuration approaches (auto-registration, live config, seeding)
- Update Docker commands to match package.json scripts
- Add comprehensive scheduled events documentation with timezone support
- Update architecture diagram to include database components
- Clarify Node.js version requirements (20 for Docker, 22+ local)
- Document migration process from config.json to database

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-16 14:12:21 -07:00
Chris Ham
d74aebfda7 Add SQLite database for dynamic guild management
Features:
- SQLite database with better-sqlite3 for guild configurations
- Auto-registration when bot joins new guilds with welcome messages
- Soft delete system preserves settings when bot is removed
- Dynamic configuration via /config slash command with subcommands
- Automatic migration from config.json to database on first run
- Support for scheduled events with timezone preservation

Technical Implementation:
- Node.js 20 for better SQLite compatibility in Docker
- Full Debian base image with npm for reliable native module compilation
- Database persistence via Docker volume (./data)
- Hybrid configuration system (database primary, file fallback)
- JSON storage for complex schedule objects with timezone support

Database Schema:
- guilds table with soft delete (is_active flag)
- scheduled_events table with JSON schedule storage
- bot_config table for global settings
- Auto-initialization and seeding from existing config

Admin Features:
- /config show - View current server settings
- /config subcommands - Update prefix, volume, features, etc.
- Administrator permissions required for configuration changes
- Graceful handling of missing or malformed data

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-16 14:02:27 -07:00
Chris Ham
9661ba92d5 Add Docker Compose setup and clean up legacy code
- Add docker-compose.yml with volume mounts for config/sfx
- Simplify npm scripts (up/down/build/restart/logs)
- Update README.md and CLAUDE.md with new commands
- Remove unused lib/ directory (migrated to src/)
- Update package.json scripts to cleaner naming

Benefits:
- Update configs and sound effects without rebuilding image
- Simplified Docker workflow management
- Cleaner project structure

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-16 12:06:40 -07:00
Chris Ham
e53360e887 gen readme 2025-08-16 11:43:46 -07:00
Chris Ham
0ad4265bed Modernize Discord bot to v14 and Node.js 22
Major upgrades and architectural improvements:
- Upgrade Discord.js from v12 to v14.21.0
- Upgrade Node.js from 14 to 22 LTS
- Switch to pnpm package manager
- Complete rewrite with modern Discord API patterns

New Features:
- Hybrid command system: prefix commands + slash commands
- /sfx slash command with autocomplete for sound discovery
- Modern @discordjs/voice integration for audio
- Improved voice connection management
- Enhanced logging for SFX commands
- Multi-stage Docker build for optimized images

Technical Improvements:
- Modular architecture with services and command handlers
- Proper intent management for Discord gateway
- Better error handling and logging
- Hot-reload capability maintained
- Environment variable support
- Optimized Docker container with Alpine Linux

Breaking Changes:
- Moved main entry from index.js to src/index.js
- Updated configuration structure for v14 compatibility
- Replaced deprecated voice APIs with @discordjs/voice
- Updated audio dependencies (opus, ffmpeg)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-16 11:37:37 -07:00
Chris Ham
19c8f4fa85 output next invocation time for scheduled jobs 2024-02-28 16:43:29 -08:00
Chris Ham
abdc894359 dockerize 2024-02-27 18:27:31 -08:00
Chris Ham
30f8307551 new sfx 2023-12-26 13:03:30 -08:00
Chris Ham
194d74f4e7 Merge branch 'main' of github.com:greenham/ghbot
* 'main' of github.com:greenham/ghbot:
  Bump node-fetch from 2.6.1 to 2.6.7
  Bump follow-redirects from 1.14.7 to 1.14.8
  Bump axios from 0.21.1 to 0.21.2
  Bump follow-redirects from 1.13.3 to 1.14.7
2023-12-26 13:02:22 -08:00
Chris Ham
0528e71ad8 new sfx 2023-12-26 13:00:09 -08:00
greenham
fa70efaa98 Merge pull request #8 from greenham/dependabot/npm_and_yarn/node-fetch-2.6.7
Bump node-fetch from 2.6.1 to 2.6.7
2022-02-16 07:47:24 -08:00
dependabot[bot]
313ca7c677 Bump node-fetch from 2.6.1 to 2.6.7
Bumps [node-fetch](https://github.com/node-fetch/node-fetch) from 2.6.1 to 2.6.7.
- [Release notes](https://github.com/node-fetch/node-fetch/releases)
- [Commits](https://github.com/node-fetch/node-fetch/compare/v2.6.1...v2.6.7)

---
updated-dependencies:
- dependency-name: node-fetch
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-16 15:46:04 +00:00
greenham
2ac5050284 Merge pull request #7 from greenham/dependabot/npm_and_yarn/follow-redirects-1.14.8
Bump follow-redirects from 1.14.7 to 1.14.8
2022-02-16 07:45:30 -08:00
dependabot[bot]
30d660ad7a Bump follow-redirects from 1.14.7 to 1.14.8
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.14.7 to 1.14.8.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.14.7...v1.14.8)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-13 12:58:19 +00:00
greenham
b7a72f6792 Merge pull request #6 from greenham/dependabot/npm_and_yarn/axios-0.21.2
Bump axios from 0.21.1 to 0.21.2
2022-01-14 16:22:02 -08:00
dependabot[bot]
8730b90039 Bump axios from 0.21.1 to 0.21.2
Bumps [axios](https://github.com/axios/axios) from 0.21.1 to 0.21.2.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/master/CHANGELOG.md)
- [Commits](https://github.com/axios/axios/compare/v0.21.1...v0.21.2)

---
updated-dependencies:
- dependency-name: axios
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-15 00:21:34 +00:00
greenham
76403d3821 Merge pull request #5 from greenham/dependabot/npm_and_yarn/follow-redirects-1.14.7
Bump follow-redirects from 1.13.3 to 1.14.7
2022-01-14 16:20:41 -08:00
dependabot[bot]
67fc7edbb5 Bump follow-redirects from 1.13.3 to 1.14.7
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.13.3 to 1.14.7.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.13.3...v1.14.7)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-14 09:26:03 +00:00
greenham
ca00e52377 use correct argument when reporting invalid group 2021-08-10 20:03:31 -07:00
greenham
01cc04f0b2 better error handling 2021-08-06 09:04:05 -07:00
greenham
aa83901435 new sfx 2021-08-06 08:57:30 -07:00
greenham
60db93dd2d remove dead clip 2021-08-06 08:57:23 -07:00
greenham
2b3027c496 handle role requests 2021-08-06 08:57:16 -07:00
greenham
7b92e139a7 - support event scheduling
- upgrade discordjs and associated packages
- add/edit some sfx
2021-04-02 22:06:23 -07:00
greenham
6bf997e3be - new location for sfx list due to pastebin restrictions
- new sfx
2021-04-02 19:49:00 -07:00
Chris Ham
48be847d08 new sfx 2021-01-21 07:45:30 -08:00
greenham
75809a310a Merge pull request #4 from greenham/dependabot/npm_and_yarn/socket.io-2.4.1
Bump socket.io from 2.3.0 to 2.4.1
2021-01-21 07:43:43 -08:00
greenham
f87d40948f Merge pull request #3 from greenham/dependabot/npm_and_yarn/axios-0.21.1
Bump axios from 0.19.2 to 0.21.1
2021-01-21 07:43:32 -08:00