mirror of
https://github.com/dalbodeule/chibot-chzzk-bot.git
synced 2025-08-07 21:01:14 +00:00
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
c35b3082cc | ||
|
19d3f23cd7 | ||
|
80d777dad5 | ||
|
d2071b323e |
@@ -62,7 +62,7 @@ object ChzzkHandler {
|
|||||||
try {
|
try {
|
||||||
val streamInfo = getStreamInfo(it.channel.channelId)
|
val streamInfo = getStreamInfo(it.channel.channelId)
|
||||||
if (streamInfo.content.status == "OPEN" && !it.isActive) it.isActive(true, streamInfo)
|
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) {
|
} catch(e: SocketTimeoutException) {
|
||||||
logger.info("Timeout: ${it.channel.channelName} / ${e.stackTraceToString()}")
|
logger.info("Timeout: ${it.channel.channelName} / ${e.stackTraceToString()}")
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
@@ -116,11 +116,6 @@ class UserHandler(
|
|||||||
})
|
})
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
init {
|
|
||||||
logger.info("ChzzkChat connecting... ${channel.channelName} - ${channel.channelId}")
|
|
||||||
listener.connectAsync()
|
|
||||||
}
|
|
||||||
|
|
||||||
internal fun disable() {
|
internal fun disable() {
|
||||||
listener.closeAsync()
|
listener.closeAsync()
|
||||||
}
|
}
|
||||||
@@ -140,6 +135,10 @@ class UserHandler(
|
|||||||
_isActive = value
|
_isActive = value
|
||||||
if(value) {
|
if(value) {
|
||||||
logger.info("${user.username} is live.")
|
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) {
|
if(user.liveAlertMessage != "" && user.liveAlertGuild != null && user.liveAlertChannel != null) {
|
||||||
val channel = discord.getChannel(user.liveAlertGuild!!, user.liveAlertChannel!!) ?: throw RuntimeException("${user.liveAlertChannel} is not valid.")
|
val channel = discord.getChannel(user.liveAlertGuild!!, user.liveAlertChannel!!) ?: throw RuntimeException("${user.liveAlertChannel} is not valid.")
|
||||||
|
|
||||||
@@ -164,8 +163,7 @@ class UserHandler(
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logger.info("${user.username} is offline.")
|
logger.info("${user.username} is offline.")
|
||||||
|
listener.closeAsync()
|
||||||
listener.sendChat("${user.username} 님! 방송 수고하셨습니다.")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -63,7 +63,7 @@ class MessageHandler(
|
|||||||
listener.sendChat("명령어 추가 형식은 '!명령어추가 명령어 내용'입니다.")
|
listener.sendChat("명령어 추가 형식은 '!명령어추가 명령어 내용'입니다.")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (commands.containsKey(parts[0])) {
|
if (commands.containsKey(parts[1])) {
|
||||||
listener.sendChat("${parts[1]} 명령어는 이미 있는 명령어입니다.")
|
listener.sendChat("${parts[1]} 명령어는 이미 있는 명령어입니다.")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -84,7 +84,7 @@ class MessageHandler(
|
|||||||
listener.sendChat("명령어 수정 형식은 '!명령어수정 명령어 내용'입니다.")
|
listener.sendChat("명령어 수정 형식은 '!명령어수정 명령어 내용'입니다.")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (!commands.containsKey(parts[0])) {
|
if (!commands.containsKey(parts[1])) {
|
||||||
listener.sendChat("${parts[1]} 명령어는 없는 명령어입니다.")
|
listener.sendChat("${parts[1]} 명령어는 없는 명령어입니다.")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
<!-- 콘솔에 출력하는 기본 로그 설정 -->
|
<!-- 콘솔에 출력하는 기본 로그 설정 -->
|
||||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||||
<level>DEBUG</level>
|
<level>INFO</level>
|
||||||
</filter>
|
</filter>
|
||||||
<encoder>
|
<encoder>
|
||||||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
|
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
|
||||||
|
Reference in New Issue
Block a user