How itsmaat/wd-40 works
WD-40 is a Discord bot whose main workflow is users invoking text or slash commands and receiving music, utility, moderation, or entertainment results. Discord event handlers form the runtime ingress; the README documents the command capabilities, while sampled sources show database setup, guild-manager selection, and Reddit fetching. Music sources and Gemini are documented features, but their command-to-integration wiring was not sampled, so those links are marked unverified rather than inferred as calls.
Main entry points: text Text commands · client Command events · guildManager.js Guild manager selector · databaseManager.js Database manager
Components 21
Discord ingress
- Command events
events/client
Command features
- Text commands
commands/text - Slash commands
commands/slash - Context commands
commands/context - Fun and games
commands/text/fun - Moderation tools
commands/text/utils/admin - Gemini response helper
utils/helpers/fetchGeminiResponse.js
Music playback
- Music controls
commands/text/music - Player and extractors
utils/helpers/player - YouTube streaming
utils/helpers/youtubei/youtubeLivesHandler.js
Guild configuration
- Guild manager selector
utils/guildManager/guildManager.js - Persistent guild settings
utils/guildManager/withDatabase - No-DB guild settings
utils/guildManager/withoutDatabase
Data and integrations
- Database manager
utils/db/databaseManager.js - Database migrations
utils/db/databaseMigrator.js - Table repositories
utils/db/tableManager.js - MySQL or SQLite
- Reddit post fetcher
utils/reddit/fetchReddit.js
Other components
- Server users
- Reddit API
- Gemini API
Connections 21
- Server users → Command events: invoke commands
- Command events → Text commands: dispatches
- Command events → Slash commands: dispatches
- Command events → Context commands: dispatches
- Text commands → Fun and games: includes
- Slash commands → Moderation tools: includes
- Text commands → Moderation tools: includes
- Text commands → Music controls: includes
- Music controls → Player and extractors: uses
- Player and extractors → YouTube streaming: uses
- Text commands → Gemini response helper: offers AI features
- Gemini response helper → Gemini API: requests responses
- Text commands → Guild manager selector: uses guild settings
- Guild manager selector → Persistent guild settings: selects with database
utils/guildManager/guildManager.js - Guild manager selector → No-DB guild settings: selects without database
utils/guildManager/guildManager.js - Persistent guild settings → Table repositories: reads and writes
utils/guildManager/withDatabase/autoReactions.js - Database manager → Database migrations: runs migrations
utils/db/databaseManager.js - Table repositories → Database manager: uses ORM
utils/db/tableManager.js - Database manager → MySQL or SQLite: connects
- Reddit post fetcher → Reddit API: fetches posts
utils/reddit/fetchReddit.js - Text commands → Reddit post fetcher: offers Reddit posts