1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-27 20:48:44 +00:00

fixes for MessageAutoDeleteTimerChanged

This commit is contained in:
InsanusMokrassar 2021-03-09 22:00:17 +06:00
parent 3c8e5e61f2
commit 2531f3779e
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 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"

View File

@ -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