feat: add black list manager to manage group who kicked the bot

This commit is contained in:
2024-10-11 17:12:50 +08:00
parent a0b74d3df4
commit 1c3f582c86
10 files changed
+123 -8

No files matched your search

@@ -9,10 +9,18 @@ package cn.rtast.fancybot.util.misc
import java.time.Instant
import java.time.ZoneId
import java.time.format.DateTimeFormatter
private val zoneId = ZoneId.of("Asia/Shanghai")
fun Long.isSameDay(timestamp2: Long): Boolean {
val zoneId = ZoneId.of("Asia/Shanghai")
val date1 = Instant.ofEpochSecond(this).atZone(zoneId).toLocalDate()
val date2 = Instant.ofEpochSecond(timestamp2).atZone(zoneId).toLocalDate()
return date1 == date2
}
fun Long.convertToDate(): String {
val instant = Instant.ofEpochSecond(this)
val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd").withZone(zoneId)
return formatter.format(instant)
}