Skip to content

Commit

Permalink
Dont launch async event for commands like /l (channel gets reverted b…
Browse files Browse the repository at this point in the history
…ack too fast)
  • Loading branch information
0ffz committed Dec 5, 2023
1 parent 7a9320b commit 85f88a5
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -266,16 +266,17 @@ class ChattyCommands : IdofrontCommandExecutor(), TabCompleter {

arguments.isEmpty() -> swapChannelCommand(channel.value)
else -> {
toGeary().setPersisting(chattyData.copy(channelId = channel.key, lastChannelUsedId = channel.key))
chatty.plugin.launch(chatty.plugin.asyncDispatcher) {
val gearyPlayer = toGeary()
gearyPlayer.setPersisting(chattyData.copy(channelId = channel.key, lastChannelUsedId = channel.key))
runCatching {
GenericChattyDecorateEvent(this@shortcutCommand, arguments.toSentence().miniMsg()).call {
GenericChattyChatEvent(
this@shortcutCommand,
(this as AsyncChatDecorateEvent).result()
).callEvent()
}
}
toGeary().setPersisting(chattyData.copy(channelId = currentChannel))
gearyPlayer.setPersisting(chattyData.copy(channelId = currentChannel))
}
}
}
Expand Down

0 comments on commit 85f88a5

Please sign in to comment.