Skip to content

Commit

Permalink
perf: add reaction on another thread
Browse files Browse the repository at this point in the history
  • Loading branch information
yuuahp committed Feb 27, 2024
1 parent e7cd016 commit 936fb10
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/main/kotlin/com/jaoafa/vcspeaker/tts/narrators/Narrator.kt
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class Narrator @OptIn(KordVoice::class) constructor(
narrator()?.queueSelf(voice)
}
}

private val scheduler = Scheduler(player)

/**
Expand Down Expand Up @@ -89,11 +89,15 @@ class Narrator @OptIn(KordVoice::class) constructor(

if (replacedText.isBlank()) return

message?.addReaction("πŸ‘€")
CoroutineScope(Dispatchers.Default).launch {
message?.addReaction("πŸ‘€")
}

scheduler.queue(message, replacedText, inlineVoice)

message?.deleteOwnReaction("πŸ‘€")
CoroutineScope(Dispatchers.Default).launch {
message?.deleteOwnReaction("πŸ‘€")
}
}

/**
Expand Down

0 comments on commit 936fb10

Please sign in to comment.