How daksh7011/troy works
Troy is a Kotlin Discord bot whose main workflow is Discord events and commands entering through the bot runtime, then producing server interactions or moderation actions. Commands cover entertainment, utilities, moderation, configuration and age-restricted content; moderation and guild settings use repositories backed by MongoDB. The README also documents phishing protection and broad command capabilities. Several command implementations are unsampled, so their internal calls and integrations are not inferred; those branches are represented at their source directories.
Main entry points: Troy.kt Bot setup · App.kt Event handlers · Warn.kt Warning workflow · repository Data repositories
Components 26
Bot runtime
- Event handlers
src/main/kotlin/troy/App.kt - Bot setup
src/main/kotlin/troy/core/Troy.kt
Discord commands
- Fun commands
src/main/kotlin/troy/commands/funstuff - Dictionary lookup
src/main/kotlin/troy/commands/funstuff/Dictionary.kt - Urban dictionary
src/main/kotlin/troy/commands/funstuff/UrbanDictionary.kt - Doggo command
src/main/kotlin/troy/commands/funstuff/Doggo.kt - Poll command
src/main/kotlin/troy/commands/funstuff/Poll.kt - Utility commands
src/main/kotlin/troy/commands/misc - Steam lookup
src/main/kotlin/troy/commands/misc/Steam.kt - Guild configuration
src/main/kotlin/troy/commands/config - Moderation commands
src/main/kotlin/troy/commands/mod - Warning workflow
src/main/kotlin/troy/commands/mod/Warn.kt - Ban command
src/main/kotlin/troy/commands/mod/Ban.kt - Kick command
src/main/kotlin/troy/commands/mod/Kick.kt - Age-restricted commands
src/main/kotlin/troy/commands/nsfw
Safety and presence
- Phishing protection
src/main/kotlin/troy/utils/PhishingDomainsHelper.kt - Presence rotation
src/main/kotlin/troy/utils/PresenceManager.kt
Persistence
- Data repositories
src/main/kotlin/troy/data/repository - Guild settings
src/main/kotlin/troy/data/repository/GlobalGuildRepository.kt - Warning records
src/main/kotlin/troy/data/repository/WarningLogsRepository.kt - Ban records
src/main/kotlin/troy/data/repository/BanLogsRepository.kt - Kick records
src/main/kotlin/troy/data/repository/KickLogsRepository.kt
Other components
- Discord users
- Discord API
- MongoDB
- OwlDict API
Connections 21
- Discord users → Event handlers: sends events
src/main/kotlin/troy/App.kt - Event handlers → Bot setup: creates runtime
src/main/kotlin/troy/App.kt - Bot setup → Fun commands: registers commands
src/main/kotlin/troy/core/Troy.kt - Bot setup → Utility commands: registers commands
src/main/kotlin/troy/core/Troy.kt - Bot setup → Moderation commands: registers commands
src/main/kotlin/troy/core/Troy.kt - Bot setup → Age-restricted commands: registers commands
src/main/kotlin/troy/core/Troy.kt - Bot setup → Guild configuration: registers commands
src/main/kotlin/troy/core/Troy.kt - Event handlers → Phishing protection: fetches domains
src/main/kotlin/troy/App.kt - Event handlers → Presence rotation: sets presence
src/main/kotlin/troy/App.kt - Event handlers → Guild settings: initializes guilds
src/main/kotlin/troy/App.kt - Bot setup → Data repositories: loads modules
src/main/kotlin/troy/core/Troy.kt - Dictionary lookup → OwlDict API: requests definitions
src/main/kotlin/troy/commands/funstuff/Dictionary.kt - Warning workflow → Warning records: records warnings
src/main/kotlin/troy/commands/mod/Warn.kt - Warning workflow → Guild settings: reads policy
src/main/kotlin/troy/commands/mod/Warn.kt - Warning workflow → Ban records: records automatic bans
src/main/kotlin/troy/commands/mod/Warn.kt - Warning workflow → Kick records: records automatic kicks
src/main/kotlin/troy/commands/mod/Warn.kt - Ban command → Ban records: records bans
src/main/kotlin/troy/commands/mod/Ban.kt - Kick command → Kick records: records kicks
src/main/kotlin/troy/commands/mod/Kick.kt - Data repositories → MongoDB: persists records
- Discord API → Fun commands: hosts commands
- Discord API → Moderation commands: hosts commands