File tree 1 file changed +10
-0
lines changed
src/main/kotlin/com/mrkirby153/botcore/command/slashcommand/dsl
1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change 1
1
package com.mrkirby153.botcore.command.slashcommand.dsl
2
2
3
3
import com.mrkirby153.botcore.builder.MessageBuilder
4
+ import com.mrkirby153.botcore.coroutine.await
4
5
import com.mrkirby153.botcore.utils.SLF4J
5
6
import kotlinx.coroutines.CoroutineScope
6
7
import net.dv8tion.jda.api.events.interaction.command.MessageContextInteractionEvent
7
8
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent
8
9
import net.dv8tion.jda.api.events.interaction.command.UserContextInteractionEvent
10
+ import net.dv8tion.jda.api.interactions.InteractionHook
9
11
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction
10
12
import net.dv8tion.jda.api.interactions.commands.context.MessageContextInteraction
11
13
import net.dv8tion.jda.api.interactions.commands.context.UserContextInteraction
@@ -80,6 +82,14 @@ class SlashContext(
80
82
}
81
83
return args
82
84
}
85
+
86
+ /* *
87
+ * Defers the reply and then executes [handler]. Specify [ephemeral] to defer ephemerally
88
+ */
89
+ suspend fun defer (ephemeral : Boolean = false, handler : suspend (InteractionHook ) -> Unit ) {
90
+ val hook = deferReply(ephemeral).await()
91
+ handler(hook)
92
+ }
83
93
}
84
94
85
95
/* *
You can’t perform that action at this time.
0 commit comments