change the ugly println stuff to prettier logging
This commit is contained in:
parent
5e8f88b719
commit
816fe4bb34
@ -13,10 +13,12 @@ import dev.jansel.feixiao.utils.*
|
||||
import dev.kord.core.entity.channel.GuildMessageChannel
|
||||
import dev.kordex.core.ExtensibleBot
|
||||
import dev.kordex.data.api.DataCollection
|
||||
import io.github.oshai.kotlinlogging.KotlinLogging
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.runBlocking
|
||||
|
||||
var twitchClient: TwitchClient? = null
|
||||
val logger = KotlinLogging.logger { }
|
||||
|
||||
suspend fun main() {
|
||||
val bot = ExtensibleBot(token) {
|
||||
@ -34,7 +36,7 @@ suspend fun main() {
|
||||
.build()
|
||||
|
||||
twitchClient!!.eventManager.onEvent(ChannelGoLiveEvent::class.java) {
|
||||
println("${it.channel.name} went live!")
|
||||
logger.info { "${it.channel.name} went live!" }
|
||||
runBlocking {
|
||||
launch {
|
||||
val streamer = StreamerCollection().getData(it.channel.name)
|
||||
|
@ -1,6 +1,7 @@
|
||||
package dev.jansel.feixiao.extensions
|
||||
|
||||
import dev.jansel.feixiao.database.collections.StreamerCollection
|
||||
import dev.jansel.feixiao.logger
|
||||
import dev.jansel.feixiao.twitchClient
|
||||
import dev.kord.core.event.gateway.ReadyEvent
|
||||
import dev.kordex.core.extensions.Extension
|
||||
@ -12,12 +13,12 @@ class EventHooks : Extension() {
|
||||
override suspend fun setup() {
|
||||
event<ReadyEvent> {
|
||||
action {
|
||||
println("Bot is ready!")
|
||||
logger.info { "Bot is ready!" }
|
||||
kord.editPresence { listening("the database") }
|
||||
// check every entry in the database and enable the stream event listener
|
||||
StreamerCollection().collection.find().toList().forEach {
|
||||
twitchClient!!.clientHelper.enableStreamEventListener(it.name)
|
||||
println("Enabled stream event listener for ${it.name}")
|
||||
logger.info { "Enabled stream event listener for ${it.name}" }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user