mirror of
https://github.com/dalbodeule/chibot-chzzk-bot.git
synced 2025-08-07 12:51:13 +00:00
Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
19d3f23cd7 | ||
|
80d777dad5 |
@@ -62,7 +62,7 @@ object ChzzkHandler {
|
||||
try {
|
||||
val streamInfo = getStreamInfo(it.channel.channelId)
|
||||
if (streamInfo.content.status == "OPEN" && !it.isActive) it.isActive(true, streamInfo)
|
||||
if (streamInfo.content.status == "CLOSED" && it.isActive) it.isActive(false, streamInfo)
|
||||
if (streamInfo.content.status == "CLOSE" && it.isActive) it.isActive(false, streamInfo)
|
||||
} catch(e: SocketTimeoutException) {
|
||||
logger.info("Timeout: ${it.channel.channelName} / ${e.stackTraceToString()}")
|
||||
} catch (e: Exception) {
|
||||
@@ -116,11 +116,6 @@ class UserHandler(
|
||||
})
|
||||
.build()
|
||||
|
||||
init {
|
||||
logger.info("ChzzkChat connecting... ${channel.channelName} - ${channel.channelId}")
|
||||
listener.connectAsync()
|
||||
}
|
||||
|
||||
internal fun disable() {
|
||||
listener.closeAsync()
|
||||
}
|
||||
@@ -140,6 +135,10 @@ class UserHandler(
|
||||
_isActive = value
|
||||
if(value) {
|
||||
logger.info("${user.username} is live.")
|
||||
|
||||
logger.info("ChzzkChat connecting... ${channel.channelName} - ${channel.channelId}")
|
||||
listener.connectAsync()
|
||||
|
||||
if(user.liveAlertMessage != "" && user.liveAlertGuild != null && user.liveAlertChannel != null) {
|
||||
val channel = discord.getChannel(user.liveAlertGuild!!, user.liveAlertChannel!!) ?: throw RuntimeException("${user.liveAlertChannel} is not valid.")
|
||||
|
||||
@@ -164,8 +163,7 @@ class UserHandler(
|
||||
}
|
||||
} else {
|
||||
logger.info("${user.username} is offline.")
|
||||
|
||||
listener.sendChat("${user.username} 님! 방송 수고하셨습니다.")
|
||||
listener.closeAsync()
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user