mirror of
https://github.com/dalbodeule/chibot-chzzk-bot.git
synced 2025-08-07 21:01:14 +00:00
some change on LiveStatus logics
- add LiveStatus table - in ChzzkHandler.kt (UserHandler), _isActive variable to bind LiveStatusService
This commit is contained in:
@@ -13,6 +13,7 @@ import space.mori.chzzk_bot.common.events.CoroutinesEventBus
|
||||
import space.mori.chzzk_bot.common.events.TimerEvent
|
||||
import space.mori.chzzk_bot.common.events.TimerType
|
||||
import space.mori.chzzk_bot.common.models.User
|
||||
import space.mori.chzzk_bot.common.services.LiveStatusService
|
||||
import space.mori.chzzk_bot.common.services.TimerConfigService
|
||||
import space.mori.chzzk_bot.common.services.UserService
|
||||
import space.mori.chzzk_bot.common.utils.convertChzzkDateToLocalDateTime
|
||||
@@ -96,11 +97,15 @@ class UserHandler(
|
||||
val channel: ChzzkChannel,
|
||||
val logger: Logger,
|
||||
private var user: User,
|
||||
private var _isActive: Boolean = false,
|
||||
var streamStartTime: LocalDateTime?,
|
||||
) {
|
||||
private lateinit var messageHandler: MessageHandler
|
||||
private val dispatcher: CoroutinesEventBus by inject(CoroutinesEventBus::class.java)
|
||||
private var _isActive: Boolean
|
||||
get() = LiveStatusService.getLiveStatus(user)?.status ?: false
|
||||
set(value) {
|
||||
LiveStatusService.updateOrCreate(user, value)
|
||||
}
|
||||
|
||||
var listener: ChzzkChat = chzzk.chat(channel.channelId)
|
||||
.withAutoReconnect(true)
|
||||
|
@@ -40,7 +40,6 @@ class Discord: ListenerAdapter() {
|
||||
val embed = EmbedBuilder()
|
||||
embed.setTitle(status.content.liveTitle, "https://chzzk.naver.com/live/${user.token}")
|
||||
embed.setDescription("${user.username} 님이 방송을 시작했습니다.")
|
||||
embed.setUrl(status.content.channel.channelImageUrl)
|
||||
embed.setTimestamp(Instant.now())
|
||||
embed.setAuthor(user.username, "https://chzzk.naver.com/live/${user.token}", status.content.channel.channelImageUrl)
|
||||
embed.addField("카테고리", status.content.liveCategoryValue, true)
|
||||
|
Reference in New Issue
Block a user