Skip to content

Commit

Permalink
fix epic free game push
Browse files Browse the repository at this point in the history
  • Loading branch information
kukume committed Dec 28, 2024
1 parent d21f55a commit dda0f37
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,13 @@ suspend fun TelegramBot.sendPic(tgId: Long, text: String, picUrl: List<String>,
messageThreadId?.let {
sendPhoto.messageThreadId(it)
}
asyncExecute(sendPhoto)
try {
asyncExecute(sendPhoto)
} catch (e: Exception) {
sendPhoto.caption("")
asyncExecute(sendPhoto)
sendTextMessage(tgId, text, messageThreadId)
}
} else if (picUrl.isEmpty()) {
sendTextMessage(tgId, text, messageThreadId)
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class EpicScheduled(
val promotion = element["promotions"]?.get("promotionalOffers")?.get(0)?.get("promotionalOffers")?.get(0)
?: element["promotions"]?.get("upcomingPromotionalOffers")?.get(0)?.get("promotionalOffers")?.get(0) ?: continue
val startDate = promotion["startDate"].asText().replace(".000Z", "")
val startTimeStamp = LocalDateTime.parse(startDate, DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss")).toInstant(ZoneOffset.ofHours(8)).toEpochMilli()
val startTimeStamp = LocalDateTime.parse(startDate, DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss")).toInstant(ZoneOffset.ofHours(0)).toEpochMilli()
val nowTimeStamp = System.currentTimeMillis()
val diff = nowTimeStamp - startTimeStamp
if (diff < 1000 * 60 * 60 && diff > 0) {
Expand Down

0 comments on commit dda0f37

Please sign in to comment.