mirror of
https://github.com/dalbodeule/chibot-chzzk-bot.git
synced 2025-06-09 15:28:21 +00:00
chzzk followdate error handler add
This commit is contained in:
parent
c35b3082cc
commit
7522ec6f9e
@ -143,18 +143,24 @@ class MessageHandler(
|
|||||||
}
|
}
|
||||||
|
|
||||||
result = followPattern.replace(result) {
|
result = followPattern.replace(result) {
|
||||||
val following = getFollowDate(listener.chatId, msg.userId)
|
try {
|
||||||
val dateString: String = following.content.streamingProperty.following?.followDate ?: SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(
|
val following = getFollowDate(listener.chatId, msg.userId)
|
||||||
Date()
|
|
||||||
)
|
|
||||||
val today = LocalDate.now()
|
|
||||||
|
|
||||||
val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")
|
val dateString: String = following.content.streamingProperty.following?.followDate ?: SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(
|
||||||
// 문자열을 LocalDate 객체로 변환
|
Date()
|
||||||
val pastDate = LocalDate.parse(dateString, formatter)
|
)
|
||||||
|
val today = LocalDate.now()
|
||||||
|
|
||||||
val period = Period.between(pastDate, today)
|
val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")
|
||||||
period.days.toString()
|
// 문자열을 LocalDate 객체로 변환
|
||||||
|
val pastDate = LocalDate.parse(dateString, formatter)
|
||||||
|
|
||||||
|
val period = Period.between(pastDate, today)
|
||||||
|
period.days.toString()
|
||||||
|
} catch (e: Exception) {
|
||||||
|
logger.info(e.message)
|
||||||
|
return@replace "0"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
result = counterPattern.replace(result) {
|
result = counterPattern.replace(result) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user