mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 16:23:48 +00:00
Merge pull request #197 from madhead/issues/175
Fix #175: Support for message_id field in unpinChatMessage method
This commit is contained in:
commit
654d84b1b4
@ -23,6 +23,7 @@
|
|||||||
* New fields `AudioFile#fileName` and `VideoFile#fileName`
|
* New fields `AudioFile#fileName` and `VideoFile#fileName`
|
||||||
* New fields `SendDocument#disableContentTypeDetection` and `InputMediaDocument#disableContentTypeDetection`
|
* New fields `SendDocument#disableContentTypeDetection` and `InputMediaDocument#disableContentTypeDetection`
|
||||||
* New request `UnpinAllChatMessages`
|
* New request `UnpinAllChatMessages`
|
||||||
|
* New parameter for `unpinChatMessage` method: `messageId`
|
||||||
* New dice type `FootballDiceAnimationType`
|
* New dice type `FootballDiceAnimationType`
|
||||||
* Limits for dices has been changed
|
* Limits for dices has been changed
|
||||||
* `commonDiceResultLimit` has been deprecated
|
* `commonDiceResultLimit` has been deprecated
|
||||||
|
@ -3,14 +3,18 @@ package dev.inmo.tgbotapi.requests.chat.modify
|
|||||||
import dev.inmo.tgbotapi.CommonAbstracts.types.ChatRequest
|
import dev.inmo.tgbotapi.CommonAbstracts.types.ChatRequest
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
|
import dev.inmo.tgbotapi.types.MessageIdentifier
|
||||||
import dev.inmo.tgbotapi.types.chatIdField
|
import dev.inmo.tgbotapi.types.chatIdField
|
||||||
|
import dev.inmo.tgbotapi.types.messageIdField
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
import kotlinx.serialization.builtins.serializer
|
import kotlinx.serialization.builtins.serializer
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class UnpinChatMessage(
|
data class UnpinChatMessage(
|
||||||
@SerialName(chatIdField)
|
@SerialName(chatIdField)
|
||||||
override val chatId: ChatIdentifier
|
override val chatId: ChatIdentifier,
|
||||||
|
@SerialName(messageIdField)
|
||||||
|
val messageId: MessageIdentifier? = null
|
||||||
): ChatRequest, SimpleRequest<Boolean> {
|
): ChatRequest, SimpleRequest<Boolean> {
|
||||||
override fun method(): String = "unpinChatMessage"
|
override fun method(): String = "unpinChatMessage"
|
||||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||||
|
@ -3,12 +3,21 @@ package dev.inmo.tgbotapi.extensions.api.chat.modify
|
|||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.chat.modify.UnpinChatMessage
|
import dev.inmo.tgbotapi.requests.chat.modify.UnpinChatMessage
|
||||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
|
import dev.inmo.tgbotapi.types.MessageIdentifier
|
||||||
|
import dev.inmo.tgbotapi.types.chat.abstracts.Chat
|
||||||
import dev.inmo.tgbotapi.types.chat.abstracts.PublicChat
|
import dev.inmo.tgbotapi.types.chat.abstracts.PublicChat
|
||||||
|
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||||
|
|
||||||
suspend fun TelegramBot.unpinChatMessage(
|
suspend fun TelegramBot.unpinChatMessage(
|
||||||
chatId: ChatIdentifier
|
chatId: ChatIdentifier,
|
||||||
) = execute(UnpinChatMessage(chatId))
|
messageId: MessageIdentifier? = null
|
||||||
|
) = execute(UnpinChatMessage(chatId, messageId))
|
||||||
|
|
||||||
suspend fun TelegramBot.unpinChatMessage(
|
suspend fun TelegramBot.unpinChatMessage(
|
||||||
chat: PublicChat
|
chat: Chat,
|
||||||
) = unpinChatMessage(chat.id)
|
messageId: MessageIdentifier? = null
|
||||||
|
) = unpinChatMessage(chat.id, messageId)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.unpinChatMessage(
|
||||||
|
message: Message
|
||||||
|
) = unpinChatMessage(message.chat.id, message.messageId)
|
||||||
|
Loading…
Reference in New Issue
Block a user