File tree 2 files changed +6
-0
lines changed
src/main/kotlin/com/mrkirby153/botcore/command/slashcommand/dsl
2 files changed +6
-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.utils.PrerequisiteCheck
4
+ import kotlinx.coroutines.TimeoutCancellationException
4
5
import net.dv8tion.jda.api.interactions.commands.context.ContextInteraction
5
6
import java.util.concurrent.TimeUnit
6
7
@@ -57,6 +58,8 @@ open class ContextCommand<Event : ContextInteraction<*>>(
57
58
}
58
59
try {
59
60
commandAction(event)
61
+ } catch (e: TimeoutCancellationException ) {
62
+ // Ignore
60
63
} catch (e: Exception ) {
61
64
val msg = " :no_entry: ${e.message ? : " An unknown error occurred!" } "
62
65
if (event.isAcknowledged) {
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import kotlinx.coroutines.CoroutineDispatcher
9
9
import kotlinx.coroutines.CoroutineScope
10
10
import kotlinx.coroutines.Dispatchers
11
11
import kotlinx.coroutines.SupervisorJob
12
+ import kotlinx.coroutines.TimeoutCancellationException
12
13
import kotlinx.coroutines.launch
13
14
import kotlinx.coroutines.withTimeout
14
15
import net.dv8tion.jda.api.JDA
@@ -228,6 +229,8 @@ class DslCommandExecutor private constructor(
228
229
}
229
230
}
230
231
replyOrEdit(msg)
232
+ } catch (e: TimeoutCancellationException ) {
233
+ log.debug(" Execution timed out. Ignoring..." )
231
234
} catch (e: Exception ) {
232
235
log.error(" Error executing slash command ${event.fullCommandName} " , e)
233
236
replyOrEdit(" :no_entry: Something went wrong when processing this command" )
You can’t perform that action at this time.
0 commit comments