mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-12-05 00:10:07 +00:00
Compare commits
No commits in common. "01dfedf54090ed9a82e7ab6e1e0b6ec6ff376c74" and "8791573145193ca5ec3e895b7847ca2f3c3abccc" have entirely different histories.
01dfedf540
...
8791573145
21
CHANGELOG.md
21
CHANGELOG.md
@ -1,26 +1,5 @@
|
||||
# TelegramBotAPI changelog
|
||||
|
||||
## 2.2.0
|
||||
|
||||
* `Core`:
|
||||
* For `CopyMessage` order of parameters has been changed
|
||||
* `ReplyForce` defaults changes:
|
||||
* All old companion properties (like `ReplyForce.ReplyForceSelective`) have been renamed:
|
||||
* `ReplyForceSelective` -> `Selective`
|
||||
* `ReplyForceNonSelective` -> `NonSelective`
|
||||
* `ReplyForceDefault` -> `Default`
|
||||
* New companion functions:
|
||||
* `ReplyForce#Selective`
|
||||
* `ReplyForce#NonSelective`
|
||||
* Rename `CreatorChatMember` -> `OwnerChatMember`
|
||||
* `API`:
|
||||
* For `copyMessage` order of parameters has been changed
|
||||
* `Utils`:
|
||||
* New extension `Message#sameChat`
|
||||
* New extension `Message#sameMessage`
|
||||
* New functions `flatInlineKeyboard` and `flatReplyKeyboard`
|
||||
* Experimentally add new triple of class casts: `if*`, `*OrNull` and `*OrThrow`
|
||||
|
||||
## 2.1.3
|
||||
|
||||
* `Versions`:
|
||||
|
@ -6,4 +6,4 @@ kotlin.incremental=true
|
||||
kotlin.incremental.js=true
|
||||
|
||||
library_group=dev.inmo
|
||||
library_version=2.2.0
|
||||
library_version=2.1.3
|
||||
|
@ -16,8 +16,8 @@ import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||
*/
|
||||
suspend inline fun TelegramBot.copyMessage(
|
||||
fromChatId: ChatIdentifier,
|
||||
messageId: MessageIdentifier,
|
||||
toChatId: ChatIdentifier,
|
||||
messageId: MessageIdentifier,
|
||||
text: String? = null,
|
||||
parseMode: ParseMode? = null,
|
||||
disableNotification: Boolean = false,
|
||||
@ -26,18 +26,7 @@ suspend inline fun TelegramBot.copyMessage(
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = execute(
|
||||
CopyMessage(
|
||||
fromChatId,
|
||||
messageId,
|
||||
toChatId,
|
||||
text,
|
||||
parseMode,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
allowSendingWithoutReply,
|
||||
replyMarkup
|
||||
)
|
||||
CopyMessage(fromChatId, toChatId, messageId, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||
)
|
||||
|
||||
/**
|
||||
@ -46,8 +35,8 @@ suspend inline fun TelegramBot.copyMessage(
|
||||
*/
|
||||
suspend inline fun TelegramBot.copyMessage(
|
||||
fromChat: Chat,
|
||||
messageId: MessageIdentifier,
|
||||
toChatId: ChatIdentifier,
|
||||
messageId: MessageIdentifier,
|
||||
text: String? = null,
|
||||
parseMode: ParseMode? = null,
|
||||
disableNotification: Boolean = false,
|
||||
@ -55,7 +44,7 @@ suspend inline fun TelegramBot.copyMessage(
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = copyMessage(fromChat.id, messageId, toChatId, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||
) = copyMessage(fromChat.id, toChatId, messageId, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||
|
||||
/**
|
||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||
@ -63,8 +52,8 @@ suspend inline fun TelegramBot.copyMessage(
|
||||
*/
|
||||
suspend inline fun TelegramBot.copyMessage(
|
||||
fromChatId: ChatIdentifier,
|
||||
messageId: MessageIdentifier,
|
||||
toChat: Chat,
|
||||
messageId: MessageIdentifier,
|
||||
text: String? = null,
|
||||
parseMode: ParseMode? = null,
|
||||
disableNotification: Boolean = false,
|
||||
@ -72,7 +61,7 @@ suspend inline fun TelegramBot.copyMessage(
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = copyMessage(fromChatId, messageId, toChat.id, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||
) = copyMessage(fromChatId, toChat.id, messageId, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||
|
||||
/**
|
||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||
@ -80,8 +69,8 @@ suspend inline fun TelegramBot.copyMessage(
|
||||
*/
|
||||
suspend inline fun TelegramBot.copyMessage(
|
||||
fromChat: Chat,
|
||||
messageId: MessageIdentifier,
|
||||
toChat: Chat,
|
||||
messageId: MessageIdentifier,
|
||||
text: String? = null,
|
||||
parseMode: ParseMode? = null,
|
||||
disableNotification: Boolean = false,
|
||||
@ -89,7 +78,39 @@ suspend inline fun TelegramBot.copyMessage(
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = copyMessage(fromChat.id, messageId, toChat.id, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||
) = copyMessage(fromChat.id, toChat.id, messageId, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||
|
||||
/**
|
||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||
*/
|
||||
suspend inline fun TelegramBot.copyMessage(
|
||||
toChatId: ChatIdentifier,
|
||||
message: Message,
|
||||
text: String? = null,
|
||||
parseMode: ParseMode? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = copyMessage(message.chat, toChatId, message.messageId, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||
|
||||
/**
|
||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||
*/
|
||||
suspend inline fun TelegramBot.copyMessage(
|
||||
toChat: Chat,
|
||||
message: Message,
|
||||
text: String? = null,
|
||||
parseMode: ParseMode? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = copyMessage(message.chat, toChat, message.messageId, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||
|
||||
|
||||
/**
|
||||
@ -98,8 +119,8 @@ suspend inline fun TelegramBot.copyMessage(
|
||||
*/
|
||||
suspend inline fun TelegramBot.copyMessage(
|
||||
fromChatId: ChatIdentifier,
|
||||
messageId: MessageIdentifier,
|
||||
toChatId: ChatIdentifier,
|
||||
messageId: MessageIdentifier,
|
||||
entities: TextSourcesList,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
@ -107,17 +128,7 @@ suspend inline fun TelegramBot.copyMessage(
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = execute(
|
||||
CopyMessage(
|
||||
fromChatId,
|
||||
messageId,
|
||||
toChatId,
|
||||
entities,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
allowSendingWithoutReply,
|
||||
replyMarkup
|
||||
)
|
||||
CopyMessage(fromChatId, toChatId, messageId, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||
)
|
||||
|
||||
/**
|
||||
@ -126,15 +137,15 @@ suspend inline fun TelegramBot.copyMessage(
|
||||
*/
|
||||
suspend inline fun TelegramBot.copyMessage(
|
||||
fromChat: Chat,
|
||||
messageId: MessageIdentifier,
|
||||
toChatId: ChatIdentifier,
|
||||
messageId: MessageIdentifier,
|
||||
entities: TextSourcesList,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = copyMessage(fromChat.id, messageId, toChatId, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||
) = copyMessage(fromChat.id, toChatId, messageId, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||
|
||||
/**
|
||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||
@ -142,15 +153,15 @@ suspend inline fun TelegramBot.copyMessage(
|
||||
*/
|
||||
suspend inline fun TelegramBot.copyMessage(
|
||||
fromChatId: ChatIdentifier,
|
||||
messageId: MessageIdentifier,
|
||||
toChat: Chat,
|
||||
messageId: MessageIdentifier,
|
||||
entities: TextSourcesList,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = copyMessage(fromChatId, messageId, toChat.id, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||
) = copyMessage(fromChatId, toChat.id, messageId, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||
|
||||
/**
|
||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||
@ -158,47 +169,15 @@ suspend inline fun TelegramBot.copyMessage(
|
||||
*/
|
||||
suspend inline fun TelegramBot.copyMessage(
|
||||
fromChat: Chat,
|
||||
toChat: Chat,
|
||||
messageId: MessageIdentifier,
|
||||
toChat: Chat,
|
||||
entities: TextSourcesList,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = copyMessage(fromChat.id, messageId, toChat.id, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||
|
||||
/**
|
||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||
*/
|
||||
suspend inline fun TelegramBot.copyMessage(
|
||||
toChatId: ChatIdentifier,
|
||||
message: Message,
|
||||
text: String? = null,
|
||||
parseMode: ParseMode? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = copyMessage(message.chat, message.messageId, toChatId, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||
|
||||
/**
|
||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||
*/
|
||||
suspend inline fun TelegramBot.copyMessage(
|
||||
toChat: Chat,
|
||||
message: Message,
|
||||
text: String? = null,
|
||||
parseMode: ParseMode? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = copyMessage(message.chat, message.messageId, toChat, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||
) = copyMessage(fromChat.id, toChat.id, messageId, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||
|
||||
/**
|
||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||
@ -213,7 +192,7 @@ suspend inline fun TelegramBot.copyMessage(
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = copyMessage(message.chat, message.messageId, toChatId, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||
) = copyMessage(message.chat, toChatId, message.messageId, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||
|
||||
/**
|
||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||
@ -228,4 +207,4 @@ suspend inline fun TelegramBot.copyMessage(
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = copyMessage(message.chat, message.messageId, toChat, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||
) = copyMessage(message.chat, toChat, message.messageId, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||
|
@ -1,180 +0,0 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.send
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.send.CopyMessage
|
||||
import dev.inmo.tgbotapi.requests.send.OrderChangingDeprecationWarn
|
||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.MessageIdentifier
|
||||
import dev.inmo.tgbotapi.types.message.ParseMode
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.chat.Chat
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||
|
||||
// TODO:: Swap fromChatId and toChatId for more correct order of parameters
|
||||
|
||||
/**
|
||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||
*/
|
||||
@Deprecated(OrderChangingDeprecationWarn)
|
||||
suspend inline fun TelegramBot.copyMessage(
|
||||
fromChatId: ChatIdentifier,
|
||||
toChatId: ChatIdentifier,
|
||||
messageId: MessageIdentifier,
|
||||
text: String? = null,
|
||||
parseMode: ParseMode? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = execute(
|
||||
CopyMessage(
|
||||
fromChatId,
|
||||
messageId,
|
||||
toChatId,
|
||||
text,
|
||||
parseMode,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
allowSendingWithoutReply,
|
||||
replyMarkup
|
||||
)
|
||||
)
|
||||
|
||||
/**
|
||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||
*/
|
||||
@Deprecated(OrderChangingDeprecationWarn)
|
||||
suspend inline fun TelegramBot.copyMessage(
|
||||
fromChat: Chat,
|
||||
toChatId: ChatIdentifier,
|
||||
messageId: MessageIdentifier,
|
||||
text: String? = null,
|
||||
parseMode: ParseMode? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = copyMessage(fromChat.id, toChatId, messageId, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||
|
||||
/**
|
||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||
*/
|
||||
@Deprecated(OrderChangingDeprecationWarn)
|
||||
suspend inline fun TelegramBot.copyMessage(
|
||||
fromChatId: ChatIdentifier,
|
||||
toChat: Chat,
|
||||
messageId: MessageIdentifier,
|
||||
text: String? = null,
|
||||
parseMode: ParseMode? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = copyMessage(fromChatId, toChat.id, messageId, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||
|
||||
/**
|
||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||
*/
|
||||
@Deprecated(OrderChangingDeprecationWarn)
|
||||
suspend inline fun TelegramBot.copyMessage(
|
||||
fromChat: Chat,
|
||||
toChat: Chat,
|
||||
messageId: MessageIdentifier,
|
||||
text: String? = null,
|
||||
parseMode: ParseMode? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = copyMessage(fromChat.id, toChat.id, messageId, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||
|
||||
|
||||
/**
|
||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||
*/
|
||||
@Deprecated(OrderChangingDeprecationWarn)
|
||||
suspend inline fun TelegramBot.copyMessage(
|
||||
fromChatId: ChatIdentifier,
|
||||
toChatId: ChatIdentifier,
|
||||
messageId: MessageIdentifier,
|
||||
entities: TextSourcesList,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = execute(
|
||||
CopyMessage(
|
||||
fromChatId,
|
||||
messageId,
|
||||
toChatId,
|
||||
entities,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
allowSendingWithoutReply,
|
||||
replyMarkup
|
||||
)
|
||||
)
|
||||
|
||||
/**
|
||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||
*/
|
||||
@Deprecated(OrderChangingDeprecationWarn)
|
||||
suspend inline fun TelegramBot.copyMessage(
|
||||
fromChat: Chat,
|
||||
toChatId: ChatIdentifier,
|
||||
messageId: MessageIdentifier,
|
||||
entities: TextSourcesList,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = copyMessage(fromChat.id, toChatId, messageId, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||
|
||||
/**
|
||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||
*/
|
||||
@Deprecated(OrderChangingDeprecationWarn)
|
||||
suspend inline fun TelegramBot.copyMessage(
|
||||
fromChatId: ChatIdentifier,
|
||||
toChat: Chat,
|
||||
messageId: MessageIdentifier,
|
||||
entities: TextSourcesList,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = copyMessage(fromChatId, toChat.id, messageId, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||
|
||||
/**
|
||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||
*/
|
||||
@Deprecated(OrderChangingDeprecationWarn)
|
||||
suspend inline fun TelegramBot.copyMessage(
|
||||
fromChat: Chat,
|
||||
toChat: Chat,
|
||||
messageId: MessageIdentifier,
|
||||
entities: TextSourcesList,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = copyMessage(fromChat.id, toChat.id, messageId, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
@ -16,11 +16,6 @@ import dev.inmo.tgbotapi.types.message.toRawMessageEntities
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import kotlinx.serialization.*
|
||||
|
||||
// TODO:: Swap fromChatId and toChatId for more correct order of parameters
|
||||
|
||||
const val OrderChangingDeprecationWarn = "The order of parameters in this factory will be changed soon. To avoid unexpected behaviour, swap message id and target chat id parameters"
|
||||
|
||||
@Deprecated(OrderChangingDeprecationWarn)
|
||||
fun CopyMessage(
|
||||
fromChatId: ChatIdentifier,
|
||||
toChatId: ChatIdentifier,
|
||||
@ -32,21 +27,8 @@ fun CopyMessage(
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = CopyMessage(
|
||||
toChatId,
|
||||
fromChatId,
|
||||
messageId,
|
||||
text,
|
||||
parseMode,
|
||||
null,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
allowSendingWithoutReply,
|
||||
replyMarkup
|
||||
)
|
||||
) = CopyMessage(fromChatId, toChatId, messageId, text, parseMode, null, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||
|
||||
@Deprecated(OrderChangingDeprecationWarn)
|
||||
fun CopyMessage(
|
||||
fromChatId: ChatIdentifier,
|
||||
toChatId: ChatIdentifier,
|
||||
@ -58,57 +40,8 @@ fun CopyMessage(
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = CopyMessage(
|
||||
toChatId,
|
||||
fromChatId,
|
||||
messageId,
|
||||
entities.makeString(),
|
||||
null,
|
||||
entities.toRawMessageEntities(),
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
allowSendingWithoutReply,
|
||||
replyMarkup
|
||||
)
|
||||
|
||||
fun CopyMessage(
|
||||
fromChatId: ChatIdentifier,
|
||||
messageId: MessageIdentifier,
|
||||
toChatId: ChatIdentifier,
|
||||
text: String? = null,
|
||||
parseMode: ParseMode? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = CopyMessage(
|
||||
toChatId,
|
||||
fromChatId,
|
||||
messageId,
|
||||
text,
|
||||
parseMode,
|
||||
null,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
allowSendingWithoutReply,
|
||||
replyMarkup
|
||||
)
|
||||
|
||||
fun CopyMessage(
|
||||
fromChatId: ChatIdentifier,
|
||||
messageId: MessageIdentifier,
|
||||
toChatId: ChatIdentifier,
|
||||
entities: List<TextSource>,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = CopyMessage(
|
||||
toChatId,
|
||||
fromChatId,
|
||||
messageId,
|
||||
entities.makeString(),
|
||||
null,
|
||||
@ -122,10 +55,10 @@ fun CopyMessage(
|
||||
|
||||
@Serializable
|
||||
data class CopyMessage internal constructor(
|
||||
@SerialName(chatIdField)
|
||||
val toChatId: ChatIdentifier,
|
||||
@SerialName(fromChatIdField)
|
||||
val fromChatId: ChatIdentifier,
|
||||
@SerialName(chatIdField)
|
||||
val toChatId: ChatIdentifier,
|
||||
@SerialName(messageIdField)
|
||||
override val messageId: MessageIdentifier,
|
||||
@SerialName(captionField)
|
||||
|
@ -415,7 +415,6 @@ const val mediaField = "media"
|
||||
const val disableEditMessageField = "disable_edit_message"
|
||||
const val scoreField = "score"
|
||||
const val forceField = "force"
|
||||
const val forceReplyField = "force_reply"
|
||||
|
||||
const val regularPollType = "regular"
|
||||
const val quizPollType = "quiz"
|
||||
|
@ -1,6 +1,7 @@
|
||||
package dev.inmo.tgbotapi.types.buttons
|
||||
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.inputFieldPlaceholderField
|
||||
import dev.inmo.tgbotapi.types.inputFieldPlaceholderLimit
|
||||
import kotlinx.serialization.*
|
||||
|
||||
@Serializable
|
||||
@ -9,24 +10,13 @@ data class ReplyForce(
|
||||
@SerialName(inputFieldPlaceholderField)
|
||||
val inputFieldPlaceholder: String? = null
|
||||
) : KeyboardMarkup {
|
||||
@SerialName(forceReplyField)
|
||||
@SerialName("force_reply")
|
||||
@Required
|
||||
val forceReply: Boolean = true
|
||||
|
||||
companion object {
|
||||
fun Selective(inputFieldPlaceholder: String? = null) = ReplyForce(true, inputFieldPlaceholder)
|
||||
fun NonSelective(inputFieldPlaceholder: String? = null) = ReplyForce(false, inputFieldPlaceholder)
|
||||
val Selective = Selective()
|
||||
val NonSelective = NonSelective()
|
||||
val Default = ReplyForce()
|
||||
|
||||
@Deprecated("Renamed", ReplaceWith("ReplyForce.Selective"))
|
||||
inline val ReplyForceSelective
|
||||
get() = Selective
|
||||
@Deprecated("Renamed", ReplaceWith("ReplyForce.NonSelective"))
|
||||
inline val ReplyForceNonSelective
|
||||
get() = NonSelective
|
||||
@Deprecated("Renamed", ReplaceWith("ReplyForce.Default"))
|
||||
val ReplyForceSelective = ReplyForce(true)
|
||||
val ReplyForceNonSelective = ReplyForce(false)
|
||||
val ReplyForceDefault = ReplyForce()
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@ object ChatMemberSerializer : KSerializer<ChatMember> {
|
||||
override fun deserialize(decoder: Decoder): ChatMember {
|
||||
val json = JsonObject.serializer().deserialize(decoder)
|
||||
return when (json[statusField] ?.jsonPrimitive ?.content ?: error("Status field of chat member must be specified, but incoming json contains next: $json")) {
|
||||
"creator" -> nonstrictJsonFormat.decodeFromJsonElement(OwnerChatMember.serializer(), json)
|
||||
"creator" -> nonstrictJsonFormat.decodeFromJsonElement(CreatorChatMember.serializer(), json)
|
||||
"administrator" -> nonstrictJsonFormat.decodeFromJsonElement(AdministratorChatMemberImpl.serializer(), json)
|
||||
"member" -> nonstrictJsonFormat.decodeFromJsonElement(MemberChatMemberImpl.serializer(), json)
|
||||
"restricted" -> nonstrictJsonFormat.decodeFromJsonElement(RestrictedChatMember.serializer(), json)
|
||||
@ -34,7 +34,7 @@ object ChatMemberSerializer : KSerializer<ChatMember> {
|
||||
|
||||
override fun serialize(encoder: Encoder, value: ChatMember) {
|
||||
when (value) {
|
||||
is OwnerChatMember -> OwnerChatMember.serializer()
|
||||
is CreatorChatMember -> CreatorChatMember.serializer()
|
||||
is AdministratorChatMemberImpl -> AdministratorChatMemberImpl.serializer()
|
||||
is MemberChatMember -> MemberChatMemberImpl.serializer()
|
||||
is RestrictedChatMember -> RestrictedChatMember.serializer()
|
||||
|
@ -5,7 +5,7 @@ import dev.inmo.tgbotapi.types.chat.User
|
||||
import kotlinx.serialization.*
|
||||
|
||||
@Serializable
|
||||
data class OwnerChatMember(
|
||||
data class CreatorChatMember(
|
||||
override val user: User,
|
||||
@SerialName(isAnonymousField)
|
||||
override val isAnonymous: Boolean = false,
|
||||
@ -38,6 +38,3 @@ data class OwnerChatMember(
|
||||
@Required
|
||||
private val type: String = "creator"
|
||||
}
|
||||
|
||||
@Deprecated("Renamed", ReplaceWith("OwnerChatMember", "dev.inmo.tgbotapi.types.chat.member.OwnerChatMember"))
|
||||
typealias CreatorChatMember = OwnerChatMember
|
@ -1828,26 +1828,14 @@ inline fun InlineQueryResult.requireInlineQueryResultVoiceCommon(): InlineQueryR
|
||||
this as InlineQueryResultVoiceCommon
|
||||
|
||||
@PreviewFeature
|
||||
@Deprecated("Renamed", ReplaceWith("whenOwnerChatMember", "dev.inmo.tgbotapi.extensions.utils.whenOwnerChatMember"))
|
||||
inline fun <T> ChatMember.whenCreatorChatMember(block: (CreatorChatMember) -> T) = asCreatorChatMember() ?.let(block)
|
||||
|
||||
@PreviewFeature
|
||||
@Deprecated("Renamed", ReplaceWith("asOwnerChatMember", "dev.inmo.tgbotapi.extensions.utils.asOwnerChatMember"))
|
||||
inline fun ChatMember.asCreatorChatMember(): CreatorChatMember? = this as? CreatorChatMember
|
||||
|
||||
@PreviewFeature
|
||||
@Deprecated("Renamed", ReplaceWith("requireOwnerChatMember", "dev.inmo.tgbotapi.extensions.utils.requireOwnerChatMember"))
|
||||
inline fun ChatMember.requireCreatorChatMember(): CreatorChatMember = this as CreatorChatMember
|
||||
|
||||
@PreviewFeature
|
||||
inline fun <T> ChatMember.whenOwnerChatMember(block: (OwnerChatMember) -> T) = asOwnerChatMember() ?.let(block)
|
||||
|
||||
@PreviewFeature
|
||||
inline fun ChatMember.asOwnerChatMember(): OwnerChatMember? = this as? OwnerChatMember
|
||||
|
||||
@PreviewFeature
|
||||
inline fun ChatMember.requireOwnerChatMember(): OwnerChatMember = this as OwnerChatMember
|
||||
|
||||
@PreviewFeature
|
||||
inline fun <T> ChatMember.whenKickedChatMember(block: (KickedChatMember) -> T) = asKickedChatMember() ?.let(block)
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,16 +0,0 @@
|
||||
package dev.inmo.tgbotapi.extensions.utils.extensions
|
||||
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||
|
||||
/**
|
||||
* @return true in case if [this] message is placed in the same chat that [other]
|
||||
*/
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun Message.sameChat(other: Message) = chat.id == other.chat.id
|
||||
|
||||
/**
|
||||
* @return true in case if [this] message is the same as [other]. The same here means that these messages from one chat
|
||||
* and have equal [Message.messageId] identifier
|
||||
*/
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun Message.sameMessage(other: Message) = sameChat(other) && messageId == other.messageId
|
@ -40,16 +40,6 @@ inline fun inlineKeyboard(
|
||||
block: InlineKeyboardBuilder.() -> Unit
|
||||
) = InlineKeyboardBuilder().apply(block).build()
|
||||
|
||||
/**
|
||||
* Factory-function for [InlineKeyboardBuilder], but in difference with [inlineKeyboard] this function will create single-row
|
||||
* inline keyboard
|
||||
*
|
||||
* @see InlineKeyboardBuilder.row
|
||||
*/
|
||||
inline fun flatInlineKeyboard(
|
||||
block: InlineKeyboardRowBuilder.() -> Unit
|
||||
) = inlineKeyboard { row(block) }
|
||||
|
||||
/**
|
||||
* Creates an [InlineKeyboardRowBuilder] and [apply] [block] with this builder
|
||||
*
|
||||
|
@ -47,20 +47,6 @@ inline fun replyKeyboard(
|
||||
block: ReplyKeyboardBuilder.() -> Unit
|
||||
) = ReplyKeyboardBuilder().apply(block).build(resizeKeyboard, oneTimeKeyboard, inputFieldPlaceholder, selective)
|
||||
|
||||
/**
|
||||
* Factory-function for [ReplyKeyboardBuilder], but in difference with [replyKeyboard] this method will create single-row
|
||||
* keyboard
|
||||
*/
|
||||
inline fun flatReplyKeyboard(
|
||||
resizeKeyboard: Boolean? = null,
|
||||
oneTimeKeyboard: Boolean? = null,
|
||||
inputFieldPlaceholder: String? = null,
|
||||
selective: Boolean? = null,
|
||||
block: ReplyKeyboardRowBuilder.() -> Unit
|
||||
) = replyKeyboard(resizeKeyboard, oneTimeKeyboard, inputFieldPlaceholder, selective) {
|
||||
row(block)
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an [ReplyKeyboardRowBuilder] and [apply] [block] with this builder
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user