1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-12-01 22:40:07 +00:00

fixes for MessageAutoDeleteTimerChanged

This commit is contained in:
InsanusMokrassar 2021-03-09 22:00:17 +06:00
parent 8bb60bea34
commit bc21a680bc
2 changed files with 14 additions and 0 deletions

View File

@ -163,6 +163,7 @@ const val ipAddressField = "ip_address"
const val linkedChatIdField = "linked_chat_id" const val linkedChatIdField = "linked_chat_id"
const val horizontalAccuracyField = "horizontal_accuracy" const val horizontalAccuracyField = "horizontal_accuracy"
const val revokeMessagesField = "revoke_messages" const val revokeMessagesField = "revoke_messages"
const val messageAutoDeleteTimeField = "message_auto_delete_time"
const val requestContactField = "request_contact" const val requestContactField = "request_contact"
const val requestLocationField = "request_location" const val requestLocationField = "request_location"

View File

@ -1,10 +1,23 @@
package dev.inmo.tgbotapi.types.message.ChatEvents package dev.inmo.tgbotapi.types.message.ChatEvents
import com.soywiz.klock.hours
import dev.inmo.tgbotapi.types.Seconds import dev.inmo.tgbotapi.types.Seconds
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.* import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.*
import dev.inmo.tgbotapi.types.messageAutoDeleteTimeField
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
private val seconds24Hours: Seconds = 60 * 60 * 24
private val seconds7Days: Seconds = seconds24Hours * 7
@Serializable @Serializable
data class MessageAutoDeleteTimerChanged( data class MessageAutoDeleteTimerChanged(
@SerialName(messageAutoDeleteTimeField)
val newAutoDeleteTime: Seconds // TODO:: check that it is seconds val newAutoDeleteTime: Seconds // TODO:: check that it is seconds
) : ChannelEvent, GroupEvent, SupergroupEvent ) : ChannelEvent, GroupEvent, SupergroupEvent
val MessageAutoDeleteTimerChanged.is24Hours
get() = newAutoDeleteTime == seconds24Hours
val MessageAutoDeleteTimerChanged.is7Days
get() = newAutoDeleteTime == seconds7Days