File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
src/main/kotlin/dev/arbjerg/ukulele/command Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change 1+ package dev.arbjerg.ukulele.command
2+
3+ import dev.arbjerg.ukulele.features.HelpContext
4+ import dev.arbjerg.ukulele.jda.Command
5+ import dev.arbjerg.ukulele.jda.CommandContext
6+ import dev.arbjerg.ukulele.config.BotProps
7+ import org.springframework.stereotype.Component
8+ import kotlin.system.exitProcess
9+
10+ @Component
11+ class ExitCommand (val botProps : BotProps ) : Command(" exit" ) {
12+ override suspend fun CommandContext.invoke () {
13+ if (message.author.id != botProps.ownerId) {
14+ reply(" You do not have permission to run this command." )
15+ return
16+ }
17+
18+ reply(" Shutting down..." )
19+ // Give JDA a moment to send the reply
20+ Thread .sleep(1000 )
21+ exitProcess(0 )
22+ }
23+
24+ override fun HelpContext.provideHelp () {
25+ addUsage(" " )
26+ addDescription(" Shuts down the bot gracefully (Owner only)." )
27+ }
28+ }
You can’t perform that action at this time.
0 commit comments