mirror of
https://github.com/dalbodeule/chibot-chzzk-bot.git
synced 2025-08-07 21:01:14 +00:00
add TimerType.STREAM_OFF status.
- if connected on stream off status, TimerType.STREAM_OFF message sent. - if stream on, default type is TimerType.UPTIME
This commit is contained in:
@@ -3,7 +3,9 @@ package space.mori.chzzk_bot.common.events
|
||||
enum class TimerType(var value: Int) {
|
||||
UPTIME(0),
|
||||
TIMER(1),
|
||||
REMOVE(2)
|
||||
REMOVE(2),
|
||||
|
||||
STREAM_OFF(50)
|
||||
}
|
||||
|
||||
class TimerEvent(
|
||||
|
@@ -0,0 +1,14 @@
|
||||
package space.mori.chzzk_bot.common.utils
|
||||
|
||||
import java.time.LocalDateTime
|
||||
import java.time.temporal.ChronoUnit
|
||||
|
||||
fun getUptime(streamOnTime: LocalDateTime): String {
|
||||
val currentTime = LocalDateTime.now()
|
||||
|
||||
val hours = ChronoUnit.HOURS.between(streamOnTime, currentTime)
|
||||
val minutes = ChronoUnit.MINUTES.between(streamOnTime?.plusHours(hours), currentTime)
|
||||
val seconds = ChronoUnit.SECONDS.between(streamOnTime?.plusHours(hours)?.plusMinutes(minutes), currentTime)
|
||||
|
||||
return String.format("%02d:%02d:%02d", hours, minutes, seconds)
|
||||
}
|
Reference in New Issue
Block a user