Skip to content

Commit

Permalink
feat[kritor]: add scheduler
Browse files Browse the repository at this point in the history
  • Loading branch information
RTAkland committed Nov 19, 2024
1 parent 004df7d commit aad1fb9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* Date: 2024/10/29
*/

@file:Suppress("unused")

package cn.rtast.rob.kritor

Expand All @@ -13,6 +14,7 @@ import cn.rtast.rob.kritor.kritor.KritorListener
import cn.rtast.rob.kritor.util.InternalListener
import cn.rtast.rob.kritor.util.authenticate
import cn.rtast.rob.kritor.util.createAuthInterceptor
import cn.rtast.rob.scheduler.BotCoroutineScheduler
import io.grpc.Channel
import io.grpc.ClientInterceptors.intercept
import io.grpc.ManagedChannel
Expand All @@ -35,6 +37,8 @@ class BotInstance internal constructor(
lateinit var action: KritorAction
override val isActionInitialized = true

val scheduler = BotCoroutineScheduler(this)

override suspend fun createBot(): BotInstance {
val channel = ManagedChannelBuilder
.forAddress(host, port)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,20 @@
* Date: 2024/10/27
*/

@file:Suppress("unused")

package cn.rtast.rob.kritor

import cn.rtast.rob.BotFactory
import cn.rtast.rob.kritor.kritor.KritorListener
import cn.rtast.rob.scheduler.GlobalCoroutineScheduler

object RKritorFactory : BotFactory {

val botInstances = mutableListOf<BotInstance>()

val globalScheduler = GlobalCoroutineScheduler(botInstances)

suspend fun createClient(
host: String,
port: Int,
Expand Down

0 comments on commit aad1fb9

Please sign in to comment.