Skip to content

Commit

Permalink
Catch tricks registering command errors
Browse files Browse the repository at this point in the history
Signed-off-by: shedaniel <daniel@shedaniel.me>
  • Loading branch information
shedaniel committed Feb 14, 2022
1 parent 2dddc21 commit 95d2c13
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,10 @@ object TricksManager {
val slashCommands = this.slashCommands ?: return
val tricks = (tricks.values.asSequence() + extraChecks.asSequence()).toMutableList()
TricksManager.tricks.values.forEach { trick ->
slashCommands.guildCommand(trick.guildId, TrickBasedCommand(trick)
.asSlashCommand("Run trick ${trick.name}", listOf(trick.name)))
runCatching {
slashCommands.guildCommand(trick.guildId, TrickBasedCommand(trick)
.asSlashCommand("Run trick ${trick.name}", listOf(trick.name)))
}.exceptionOrNull()?.printStackTrace()
}
val availableTricks = TricksManager.tricks.values.map { it.name }
tricks.groupBy { it.guildId }.mapValues { it.value.map { it.name }.toSet() }.forEach { (guildId, tricks) ->
Expand Down

0 comments on commit 95d2c13

Please sign in to comment.