diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/Common.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/Common.kt index 8eaef26cfb..ff8adabedd 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/Common.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/Common.kt @@ -163,6 +163,7 @@ const val ipAddressField = "ip_address" const val linkedChatIdField = "linked_chat_id" const val horizontalAccuracyField = "horizontal_accuracy" const val revokeMessagesField = "revoke_messages" +const val messageAutoDeleteTimeField = "message_auto_delete_time" const val requestContactField = "request_contact" const val requestLocationField = "request_location" diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/ChatEvents/MessageAutoDeleteTimerChanged.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/ChatEvents/MessageAutoDeleteTimerChanged.kt index e54c53fdd3..adbce62869 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/ChatEvents/MessageAutoDeleteTimerChanged.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/ChatEvents/MessageAutoDeleteTimerChanged.kt @@ -1,10 +1,23 @@ package dev.inmo.tgbotapi.types.message.ChatEvents +import com.soywiz.klock.hours import dev.inmo.tgbotapi.types.Seconds import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.* +import dev.inmo.tgbotapi.types.messageAutoDeleteTimeField +import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable +private val seconds24Hours: Seconds = 60 * 60 * 24 +private val seconds7Days: Seconds = seconds24Hours * 7 + @Serializable data class MessageAutoDeleteTimerChanged( + @SerialName(messageAutoDeleteTimeField) val newAutoDeleteTime: Seconds // TODO:: check that it is seconds ) : ChannelEvent, GroupEvent, SupergroupEvent + +val MessageAutoDeleteTimerChanged.is24Hours + get() = newAutoDeleteTime == seconds24Hours + +val MessageAutoDeleteTimerChanged.is7Days + get() = newAutoDeleteTime == seconds7Days