filwiesner / TmiK

Twitch messaging in Kotlin - Simple DSL for interacting with Twitch chat
MIT License
8 stars 1 forks source link

Sample on letting the bot join different channels #2

Closed mkpazon closed 4 years ago

mkpazon commented 4 years ago

Does the library allow joining different channels?

Should I have a tmi(token = "...", context = this.coroutineContext) { ... } block for each channel I am joining or can I use the same tmi block?

filwiesner commented 4 years ago

Hello! Thanks for using my lib @mkpazon

You can just join another channel with join("channel") in any scope.

filwiesner commented 4 years ago

I use this function to connect to all the channels I need:

fun MainScope.joinOnFirstConnect() {
    var first = true

    onConnected {
        val channels = arrayOf("firstChannel", "secondChannel", .... )

        if (first) {
            for (channel in channels)
                join(channel)

            first = false
        }
    }
}
filwiesner commented 4 years ago

Ofcourse you don't have to use this function, it was only demonstration of how can you join multiple channels when connected to Twitch.

Can this issue be closed now?

mkpazon commented 4 years ago

Thanks for the help!