mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-12-22 16:47:13 +00:00
fixes in inaccessible message support
This commit is contained in:
parent
5190f7b856
commit
b5f4219635
@ -6,9 +6,8 @@ import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.MessageId
|
||||
import dev.inmo.tgbotapi.types.chat.Chat
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||
import dev.inmo.tgbotapi.types.message.content.MediaGroupCollectionContent
|
||||
import dev.inmo.tgbotapi.types.message.content.MediaGroupContent
|
||||
|
||||
suspend fun TelegramBot.deleteMessage(
|
||||
chatId: ChatIdentifier,
|
||||
@ -23,7 +22,7 @@ suspend fun TelegramBot.deleteMessage(
|
||||
) = deleteMessage(chat.id, messageId)
|
||||
|
||||
suspend fun TelegramBot.deleteMessage(
|
||||
message: Message
|
||||
message: AccessibleMessage
|
||||
): Boolean {
|
||||
val mediaGroupContent = ((message as? ContentMessage<*>) ?.content as? MediaGroupCollectionContent<*>)
|
||||
if (mediaGroupContent == null) {
|
||||
@ -46,9 +45,9 @@ suspend fun TelegramBot.delete(
|
||||
) = deleteMessage(chat, messageId)
|
||||
|
||||
suspend fun TelegramBot.delete(
|
||||
message: Message
|
||||
message: AccessibleMessage
|
||||
) = deleteMessage(message)
|
||||
|
||||
suspend fun Message.delete(
|
||||
suspend fun AccessibleMessage.delete(
|
||||
requestsExecutor: TelegramBot
|
||||
) = requestsExecutor.deleteMessage(this)
|
||||
|
@ -1,11 +1,9 @@
|
||||
package dev.inmo.tgbotapi.extensions.api
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.DeleteMessage
|
||||
import dev.inmo.tgbotapi.requests.DeleteMessages
|
||||
import dev.inmo.tgbotapi.requests.ForwardMessages
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||
|
||||
suspend fun TelegramBot.deleteMessages(
|
||||
chatId: ChatIdentifier,
|
||||
@ -37,7 +35,7 @@ suspend fun TelegramBot.deleteMessages(
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.deleteMessages(
|
||||
messages: List<Message>
|
||||
messages: List<AccessibleMessage>
|
||||
) = messages.groupBy { it.chat }.map { (chat, messages) ->
|
||||
deleteMessages(
|
||||
chatId = chat.id,
|
||||
@ -63,5 +61,5 @@ suspend fun TelegramBot.delete(
|
||||
) = deleteMessages(chatId = chatId, messageIds = (listOf(firstMessageId, secondMessageId) + messageIds.toList()))
|
||||
|
||||
suspend fun TelegramBot.delete(
|
||||
messages: List<Message>
|
||||
messages: List<AccessibleMessage>
|
||||
) = deleteMessages(messages)
|
||||
|
@ -6,7 +6,7 @@ import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.MessageId
|
||||
import dev.inmo.tgbotapi.types.MessageThreadId
|
||||
import dev.inmo.tgbotapi.types.chat.Chat
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||
import dev.inmo.tgbotapi.types.threadId
|
||||
|
||||
suspend fun TelegramBot.forwardMessage(
|
||||
@ -49,7 +49,7 @@ suspend fun TelegramBot.forwardMessage(
|
||||
|
||||
suspend fun TelegramBot.forwardMessage(
|
||||
toChatId: ChatIdentifier,
|
||||
message: Message,
|
||||
message: AccessibleMessage,
|
||||
threadId: MessageThreadId? = toChatId.threadId,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false
|
||||
@ -57,7 +57,7 @@ suspend fun TelegramBot.forwardMessage(
|
||||
|
||||
suspend fun TelegramBot.forwardMessage(
|
||||
toChat: Chat,
|
||||
message: Message,
|
||||
message: AccessibleMessage,
|
||||
threadId: MessageThreadId? = toChat.id.threadId,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false
|
||||
|
@ -3,7 +3,7 @@ package dev.inmo.tgbotapi.extensions.api
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.ForwardMessages
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||
|
||||
suspend fun TelegramBot.forwardMessages(
|
||||
toChatId: ChatIdentifier,
|
||||
@ -66,7 +66,7 @@ suspend fun TelegramBot.forwardMessages(
|
||||
|
||||
suspend fun TelegramBot.forwardMessages(
|
||||
toChatId: ChatIdentifier,
|
||||
messages: List<Message>,
|
||||
messages: List<AccessibleMessage>,
|
||||
threadId: MessageThreadId? = toChatId.threadId,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
@ -141,7 +141,7 @@ suspend fun TelegramBot.forward(
|
||||
|
||||
suspend fun TelegramBot.forward(
|
||||
toChatId: ChatIdentifier,
|
||||
messages: List<Message>,
|
||||
messages: List<AccessibleMessage>,
|
||||
threadId: MessageThreadId? = toChatId.threadId,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
|
@ -2,39 +2,24 @@ package dev.inmo.tgbotapi.extensions.api
|
||||
|
||||
import korlibs.time.DateTime
|
||||
import korlibs.time.TimeSpan
|
||||
import dev.inmo.micro_utils.coroutines.LinkedSupervisorJob
|
||||
import dev.inmo.micro_utils.coroutines.launchSafelyWithoutExceptions
|
||||
import dev.inmo.tgbotapi.abstracts.types.WithReplyMarkup
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.extensions.api.edit.edit
|
||||
import dev.inmo.tgbotapi.extensions.api.edit.location.live.editLiveLocation
|
||||
import dev.inmo.tgbotapi.extensions.api.edit.location.live.stopLiveLocation
|
||||
import dev.inmo.tgbotapi.extensions.api.send.send
|
||||
import dev.inmo.tgbotapi.extensions.api.send.sendLiveLocation
|
||||
import dev.inmo.tgbotapi.requests.send.SendLiveLocation
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.chat.Chat
|
||||
import dev.inmo.tgbotapi.types.location.LiveLocation
|
||||
import dev.inmo.tgbotapi.types.location.Location
|
||||
import dev.inmo.tgbotapi.types.location.StaticLocation
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||
import dev.inmo.tgbotapi.types.message.content.LocationContent
|
||||
import dev.inmo.tgbotapi.utils.extensions.threadIdOrNull
|
||||
import io.ktor.utils.io.core.Closeable
|
||||
import korlibs.time.millisecondsLong
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.CoroutineStart
|
||||
import kotlinx.coroutines.currentCoroutineContext
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.map
|
||||
import kotlinx.coroutines.isActive
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlin.js.JsName
|
||||
import kotlin.jvm.JvmName
|
||||
import kotlin.math.ceil
|
||||
|
||||
val defaultLivePeriodDelayMillis = (livePeriodLimit.last - 60L) * 1000L
|
||||
@ -253,7 +238,7 @@ suspend fun TelegramBot.startLiveLocation(
|
||||
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||
*/
|
||||
suspend inline fun TelegramBot.replyWithLiveLocation(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
scope: CoroutineScope,
|
||||
latitude: Double,
|
||||
longitude: Double,
|
||||
@ -288,7 +273,7 @@ suspend inline fun TelegramBot.replyWithLiveLocation(
|
||||
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||
*/
|
||||
suspend inline fun TelegramBot.replyWithLiveLocation(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
scope: CoroutineScope,
|
||||
location: StaticLocation,
|
||||
liveTimeMillis: Long = defaultLivePeriodDelayMillis,
|
||||
|
@ -5,7 +5,7 @@ import dev.inmo.tgbotapi.requests.StopPoll
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.chat.Chat
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||
|
||||
/**
|
||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||
@ -35,7 +35,7 @@ suspend fun TelegramBot.stopPoll(
|
||||
*/
|
||||
suspend fun TelegramBot.stopPoll(
|
||||
chatId: IdChatIdentifier,
|
||||
message: Message,
|
||||
message: AccessibleMessage,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
) = stopPoll(chatId, message.messageId, replyMarkup)
|
||||
|
||||
@ -45,6 +45,6 @@ suspend fun TelegramBot.stopPoll(
|
||||
*/
|
||||
suspend fun TelegramBot.stopPoll(
|
||||
chat: Chat,
|
||||
message: Message,
|
||||
message: AccessibleMessage,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
) = stopPoll(chat.id, message.messageId, replyMarkup)
|
||||
|
@ -5,7 +5,7 @@ import dev.inmo.tgbotapi.requests.chat.modify.PinChatMessage
|
||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.MessageId
|
||||
import dev.inmo.tgbotapi.types.chat.Chat
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||
|
||||
suspend fun TelegramBot.pinChatMessage(
|
||||
chatId: ChatIdentifier,
|
||||
@ -20,6 +20,6 @@ suspend fun TelegramBot.pinChatMessage(
|
||||
) = pinChatMessage(chat.id, messageId, disableNotification)
|
||||
|
||||
suspend fun TelegramBot.pinChatMessage(
|
||||
message: Message,
|
||||
message: AccessibleMessage,
|
||||
disableNotification: Boolean = false
|
||||
) = pinChatMessage(message.chat.id, message.messageId, disableNotification)
|
||||
|
@ -5,7 +5,7 @@ import dev.inmo.tgbotapi.requests.chat.modify.UnpinChatMessage
|
||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.MessageId
|
||||
import dev.inmo.tgbotapi.types.chat.Chat
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||
|
||||
suspend fun TelegramBot.unpinChatMessage(
|
||||
chatId: ChatIdentifier,
|
||||
@ -18,5 +18,5 @@ suspend fun TelegramBot.unpinChatMessage(
|
||||
) = unpinChatMessage(chat.id, messageId)
|
||||
|
||||
suspend fun TelegramBot.unpinChatMessage(
|
||||
message: Message
|
||||
message: AccessibleMessage
|
||||
) = unpinChatMessage(message.chat.id, message.messageId)
|
||||
|
@ -14,7 +14,7 @@ import dev.inmo.tgbotapi.types.location.LiveLocation
|
||||
import dev.inmo.tgbotapi.types.media.TelegramMedia
|
||||
import dev.inmo.tgbotapi.types.message.ParseMode
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||
import dev.inmo.tgbotapi.types.message.content.*
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSource
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
@ -181,7 +181,7 @@ suspend fun TelegramBot.edit(
|
||||
* as a builder for that
|
||||
*/
|
||||
suspend fun TelegramBot.edit(
|
||||
message: Message,
|
||||
message: AccessibleMessage,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
) = editMessageReplyMarkup(message, replyMarkup)
|
||||
|
||||
|
@ -11,7 +11,7 @@ import dev.inmo.tgbotapi.types.message.ParseMode
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.chat.Chat
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||
import dev.inmo.tgbotapi.types.message.content.MediaContent
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
|
||||
@ -98,7 +98,7 @@ suspend fun <T> TelegramBot.editMessageCaption(
|
||||
*/
|
||||
@RiskFeature("This method is unsafe due to absence of any guaranties about the type of message. In case if message is not media message this method will throw an exception")
|
||||
suspend fun <T> TelegramBot.editMessageCaption(
|
||||
message: Message,
|
||||
message: AccessibleMessage,
|
||||
entities: List<TextSource>,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
): ContentMessage<MediaContent> where T : TextedWithTextSources, T : MediaContent {
|
||||
|
@ -6,7 +6,7 @@ import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.MessageId
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.chat.Chat
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||
|
||||
/**
|
||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||
@ -35,7 +35,7 @@ suspend fun TelegramBot.editMessageReplyMarkup(
|
||||
* as a builder for that
|
||||
*/
|
||||
suspend fun TelegramBot.editMessageReplyMarkup(
|
||||
message: Message,
|
||||
message: AccessibleMessage,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
) = editMessageReplyMarkup(message.chat.id, message.messageId, replyMarkup)
|
||||
|
||||
|
@ -10,7 +10,7 @@ import dev.inmo.tgbotapi.types.message.ParseMode
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.chat.Chat
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||
import dev.inmo.tgbotapi.types.message.content.TextContent
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSource
|
||||
import dev.inmo.tgbotapi.utils.*
|
||||
@ -174,7 +174,7 @@ suspend fun TelegramBot.editMessageText(
|
||||
*/
|
||||
@RiskFeature("This method is unsafe due to absence of any guaranties about the type of message. In case if message is not text message this method will throw an exception")
|
||||
suspend fun TelegramBot.editMessageText(
|
||||
message: Message,
|
||||
message: AccessibleMessage,
|
||||
entities: TextSourcesList,
|
||||
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
@ -186,7 +186,7 @@ suspend fun TelegramBot.editMessageText(
|
||||
*/
|
||||
@RiskFeature("This method is unsafe due to absence of any guaranties about the type of message. In case if message is not text message this method will throw an exception")
|
||||
suspend fun TelegramBot.editMessageText(
|
||||
message: Message,
|
||||
message: AccessibleMessage,
|
||||
separator: TextSource? = null,
|
||||
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||
replyMarkup: InlineKeyboardMarkup? = null,
|
||||
@ -199,7 +199,7 @@ suspend fun TelegramBot.editMessageText(
|
||||
*/
|
||||
@RiskFeature("This method is unsafe due to absence of any guaranties about the type of message. In case if message is not text message this method will throw an exception")
|
||||
suspend fun TelegramBot.editMessageText(
|
||||
message: Message,
|
||||
message: AccessibleMessage,
|
||||
separator: String,
|
||||
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||
replyMarkup: InlineKeyboardMarkup? = null,
|
||||
|
@ -9,7 +9,7 @@ import dev.inmo.tgbotapi.types.MessageThreadId
|
||||
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
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||
import dev.inmo.tgbotapi.types.threadId
|
||||
|
||||
/**
|
||||
@ -186,7 +186,7 @@ suspend inline fun TelegramBot.copyMessage(
|
||||
*/
|
||||
suspend inline fun TelegramBot.copyMessage(
|
||||
toChatId: ChatIdentifier,
|
||||
message: Message,
|
||||
message: AccessibleMessage,
|
||||
text: String? = null,
|
||||
parseMode: ParseMode? = null,
|
||||
threadId: MessageThreadId? = toChatId.threadId,
|
||||
@ -203,7 +203,7 @@ suspend inline fun TelegramBot.copyMessage(
|
||||
*/
|
||||
suspend inline fun TelegramBot.copyMessage(
|
||||
toChat: Chat,
|
||||
message: Message,
|
||||
message: AccessibleMessage,
|
||||
text: String? = null,
|
||||
parseMode: ParseMode? = null,
|
||||
threadId: MessageThreadId? = toChat.id.threadId,
|
||||
@ -220,7 +220,7 @@ suspend inline fun TelegramBot.copyMessage(
|
||||
*/
|
||||
suspend inline fun TelegramBot.copyMessage(
|
||||
toChatId: ChatIdentifier,
|
||||
message: Message,
|
||||
message: AccessibleMessage,
|
||||
entities: TextSourcesList,
|
||||
threadId: MessageThreadId? = toChatId.threadId,
|
||||
disableNotification: Boolean = false,
|
||||
@ -236,7 +236,7 @@ suspend inline fun TelegramBot.copyMessage(
|
||||
*/
|
||||
suspend inline fun TelegramBot.copyMessage(
|
||||
toChat: Chat,
|
||||
message: Message,
|
||||
message: AccessibleMessage,
|
||||
entities: TextSourcesList,
|
||||
threadId: MessageThreadId? = toChat.id.threadId,
|
||||
disableNotification: Boolean = false,
|
||||
|
@ -3,7 +3,7 @@ package dev.inmo.tgbotapi.extensions.api.send
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.send.CopyMessages
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||
|
||||
suspend fun TelegramBot.copyMessages(
|
||||
toChatId: ChatIdentifier,
|
||||
@ -66,7 +66,7 @@ suspend fun TelegramBot.copyMessages(
|
||||
|
||||
suspend fun TelegramBot.copyMessages(
|
||||
toChatId: ChatIdentifier,
|
||||
messages: List<Message>,
|
||||
messages: List<AccessibleMessage>,
|
||||
threadId: MessageThreadId? = toChatId.threadId,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
|
@ -22,8 +22,7 @@ import dev.inmo.tgbotapi.types.files.TelegramMediaFile
|
||||
import dev.inmo.tgbotapi.types.files.Sticker
|
||||
import dev.inmo.tgbotapi.types.games.Game
|
||||
import dev.inmo.tgbotapi.types.location.*
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.PossiblyTopicMessage
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||
import dev.inmo.tgbotapi.types.message.content.*
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSource
|
||||
import dev.inmo.tgbotapi.types.payments.LabeledPrice
|
||||
@ -44,7 +43,7 @@ import kotlin.jvm.JvmName
|
||||
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||
*/
|
||||
suspend inline fun TelegramBot.reply(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
phoneNumber: String,
|
||||
firstName: String,
|
||||
lastName: String? = null,
|
||||
@ -70,7 +69,7 @@ suspend inline fun TelegramBot.reply(
|
||||
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||
*/
|
||||
suspend inline fun TelegramBot.reply(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
contact: Contact,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
@ -95,7 +94,7 @@ suspend inline fun TelegramBot.reply(
|
||||
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||
*/
|
||||
suspend inline fun TelegramBot.replyWithDice(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
animationType: DiceAnimationType? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
@ -108,7 +107,7 @@ suspend inline fun TelegramBot.replyWithDice(
|
||||
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||
*/
|
||||
suspend inline fun TelegramBot.reply(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
animationType: DiceAnimationType,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
@ -124,7 +123,7 @@ suspend inline fun TelegramBot.reply(
|
||||
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||
*/
|
||||
suspend inline fun TelegramBot.reply(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
latitude: Double,
|
||||
longitude: Double,
|
||||
disableNotification: Boolean = false,
|
||||
@ -148,7 +147,7 @@ suspend inline fun TelegramBot.reply(
|
||||
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||
*/
|
||||
suspend inline fun TelegramBot.reply(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
location: StaticLocation,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
@ -173,7 +172,7 @@ suspend inline fun TelegramBot.reply(
|
||||
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||
*/
|
||||
suspend inline fun TelegramBot.reply(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
text: String,
|
||||
parseMode: ParseMode? = null,
|
||||
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||
@ -199,7 +198,7 @@ suspend inline fun TelegramBot.reply(
|
||||
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||
*/
|
||||
suspend inline fun TelegramBot.reply(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
entities: TextSourcesList,
|
||||
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||
disableNotification: Boolean = false,
|
||||
@ -223,7 +222,7 @@ suspend inline fun TelegramBot.reply(
|
||||
* as a builder for that
|
||||
*/
|
||||
suspend fun TelegramBot.reply(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
separator: TextSource? = null,
|
||||
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||
disableNotification: Boolean = false,
|
||||
@ -238,7 +237,7 @@ suspend fun TelegramBot.reply(
|
||||
* as a builder for that
|
||||
*/
|
||||
suspend fun TelegramBot.reply(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
separator: String,
|
||||
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||
disableNotification: Boolean = false,
|
||||
@ -256,7 +255,7 @@ suspend fun TelegramBot.reply(
|
||||
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||
*/
|
||||
suspend inline fun TelegramBot.reply(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
latitude: Double,
|
||||
longitude: Double,
|
||||
title: String,
|
||||
@ -288,7 +287,7 @@ suspend inline fun TelegramBot.reply(
|
||||
)
|
||||
|
||||
suspend inline fun TelegramBot.reply(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
location: StaticLocation,
|
||||
title: String,
|
||||
address: String,
|
||||
@ -319,7 +318,7 @@ suspend inline fun TelegramBot.reply(
|
||||
)
|
||||
|
||||
suspend inline fun TelegramBot.reply(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
venue: Venue,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
@ -340,7 +339,7 @@ suspend inline fun TelegramBot.reply(
|
||||
// Game
|
||||
|
||||
suspend inline fun TelegramBot.replyWithGame(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
gameShortName: String,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
@ -351,7 +350,7 @@ suspend inline fun TelegramBot.replyWithGame(
|
||||
)
|
||||
|
||||
suspend inline fun TelegramBot.replyWithGame(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
game: Game,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
@ -362,7 +361,7 @@ suspend inline fun TelegramBot.replyWithGame(
|
||||
)
|
||||
|
||||
suspend inline fun TelegramBot.reply(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
game: Game,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
@ -374,7 +373,7 @@ suspend inline fun TelegramBot.reply(
|
||||
// Animation
|
||||
|
||||
suspend inline fun TelegramBot.replyWithAnimation(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
animation: InputFile,
|
||||
thumb: InputFile? = null,
|
||||
text: String? = null,
|
||||
@ -406,7 +405,7 @@ suspend inline fun TelegramBot.replyWithAnimation(
|
||||
)
|
||||
|
||||
suspend inline fun TelegramBot.reply(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
animation: AnimationFile,
|
||||
text: String? = null,
|
||||
parseMode: ParseMode? = null,
|
||||
@ -421,7 +420,7 @@ suspend inline fun TelegramBot.reply(
|
||||
) = sendAnimation(to.chat, animation, text, parseMode, spoilered, duration, width, height, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||
|
||||
suspend inline fun TelegramBot.replyWithAnimation(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
animation: InputFile,
|
||||
entities: TextSourcesList,
|
||||
spoilered: Boolean = false,
|
||||
@ -451,7 +450,7 @@ suspend inline fun TelegramBot.replyWithAnimation(
|
||||
)
|
||||
|
||||
suspend inline fun TelegramBot.reply(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
animation: AnimationFile,
|
||||
entities: TextSourcesList,
|
||||
spoilered: Boolean = false,
|
||||
@ -468,7 +467,7 @@ suspend inline fun TelegramBot.reply(
|
||||
// Audio
|
||||
|
||||
suspend inline fun TelegramBot.replyWithAudio(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
audio: InputFile,
|
||||
thumb: InputFile? = null,
|
||||
text: String? = null,
|
||||
@ -483,7 +482,7 @@ suspend inline fun TelegramBot.replyWithAudio(
|
||||
) = sendAudio(to.chat, audio, thumb, text, parseMode, duration, performer, title, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||
|
||||
suspend inline fun TelegramBot.reply(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
audio: AudioFile,
|
||||
text: String? = null,
|
||||
parseMode: ParseMode? = null,
|
||||
@ -495,7 +494,7 @@ suspend inline fun TelegramBot.reply(
|
||||
) = sendAudio(to.chat, audio, text, parseMode, title, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||
|
||||
suspend inline fun TelegramBot.replyWithAudio(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
audio: InputFile,
|
||||
thumb: InputFile? = null,
|
||||
entities: TextSourcesList,
|
||||
@ -509,7 +508,7 @@ suspend inline fun TelegramBot.replyWithAudio(
|
||||
) = sendAudio(to.chat, audio, thumb, entities, duration, performer, title, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||
|
||||
suspend inline fun TelegramBot.reply(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
audio: AudioFile,
|
||||
entities: TextSourcesList,
|
||||
title: String? = null,
|
||||
@ -523,7 +522,7 @@ suspend inline fun TelegramBot.reply(
|
||||
// Documents
|
||||
|
||||
suspend inline fun TelegramBot.replyWithDocument(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
document: InputFile,
|
||||
thumb: InputFile? = null,
|
||||
text: String? = null,
|
||||
@ -536,7 +535,7 @@ suspend inline fun TelegramBot.replyWithDocument(
|
||||
) = sendDocument(to.chat, document, thumb, text, parseMode, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
|
||||
|
||||
suspend inline fun TelegramBot.reply(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
document: DocumentFile,
|
||||
text: String? = null,
|
||||
parseMode: ParseMode? = null,
|
||||
@ -548,7 +547,7 @@ suspend inline fun TelegramBot.reply(
|
||||
) = sendDocument(to.chat, document, text, parseMode, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
|
||||
|
||||
suspend inline fun TelegramBot.replyWithDocument(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
document: InputFile,
|
||||
thumb: InputFile? = null,
|
||||
entities: TextSourcesList,
|
||||
@ -560,7 +559,7 @@ suspend inline fun TelegramBot.replyWithDocument(
|
||||
) = sendDocument(to.chat, document, thumb, entities, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
|
||||
|
||||
suspend inline fun TelegramBot.reply(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
document: DocumentFile,
|
||||
entities: TextSourcesList,
|
||||
disableNotification: Boolean = false,
|
||||
@ -575,7 +574,7 @@ suspend inline fun TelegramBot.reply(
|
||||
|
||||
@RiskFeature(rawSendingMediaGroupsWarning)
|
||||
suspend inline fun TelegramBot.replyWithMediaGroup(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
media: List<MediaGroupMemberTelegramMedia>,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
@ -583,7 +582,7 @@ suspend inline fun TelegramBot.replyWithMediaGroup(
|
||||
) = sendMediaGroup(to.chat, media, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply)
|
||||
|
||||
suspend inline fun TelegramBot.replyWithPlaylist(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
media: List<AudioMediaGroupMemberTelegramMedia>,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
@ -591,7 +590,7 @@ suspend inline fun TelegramBot.replyWithPlaylist(
|
||||
) = sendPlaylist(to.chat, media, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply)
|
||||
|
||||
suspend inline fun TelegramBot.replyWithDocuments(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
media: List<DocumentMediaGroupMemberTelegramMedia>,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
@ -599,7 +598,7 @@ suspend inline fun TelegramBot.replyWithDocuments(
|
||||
) = sendDocumentsGroup(to.chat, media, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply)
|
||||
|
||||
suspend inline fun TelegramBot.replyWithGallery(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
media: List<VisualMediaGroupMemberTelegramMedia>,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
@ -610,7 +609,7 @@ suspend inline fun TelegramBot.replyWithGallery(
|
||||
// Photo
|
||||
|
||||
suspend inline fun TelegramBot.replyWithPhoto(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
fileId: InputFile,
|
||||
text: String? = null,
|
||||
parseMode: ParseMode? = null,
|
||||
@ -622,7 +621,7 @@ suspend inline fun TelegramBot.replyWithPhoto(
|
||||
) = sendPhoto(to.chat, fileId, text, parseMode, spoilered, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||
|
||||
suspend inline fun TelegramBot.reply(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
photo: Photo,
|
||||
text: String? = null,
|
||||
parseMode: ParseMode? = null,
|
||||
@ -634,7 +633,7 @@ suspend inline fun TelegramBot.reply(
|
||||
) = sendPhoto(to.chat, photo, text, parseMode, spoilered, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||
|
||||
suspend inline fun TelegramBot.reply(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
photoSize: PhotoSize,
|
||||
text: String? = null,
|
||||
parseMode: ParseMode? = null,
|
||||
@ -647,7 +646,7 @@ suspend inline fun TelegramBot.reply(
|
||||
|
||||
|
||||
suspend inline fun TelegramBot.replyWithPhoto(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
fileId: InputFile,
|
||||
entities: TextSourcesList,
|
||||
spoilered: Boolean = false,
|
||||
@ -658,7 +657,7 @@ suspend inline fun TelegramBot.replyWithPhoto(
|
||||
) = sendPhoto(to.chat, fileId, entities, spoilered, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||
|
||||
suspend inline fun TelegramBot.reply(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
photo: Photo,
|
||||
entities: TextSourcesList,
|
||||
spoilered: Boolean = false,
|
||||
@ -669,7 +668,7 @@ suspend inline fun TelegramBot.reply(
|
||||
) = sendPhoto(to.chat, photo, entities, spoilered, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||
|
||||
suspend inline fun TelegramBot.reply(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
photoSize: PhotoSize,
|
||||
entities: TextSourcesList,
|
||||
spoilered: Boolean = false,
|
||||
@ -683,7 +682,7 @@ suspend inline fun TelegramBot.reply(
|
||||
// Sticker
|
||||
|
||||
suspend inline fun TelegramBot.replyWithSticker(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
sticker: InputFile,
|
||||
emoji: String? = null,
|
||||
disableNotification: Boolean = false,
|
||||
@ -693,7 +692,7 @@ suspend inline fun TelegramBot.replyWithSticker(
|
||||
) = sendSticker(to.chat, sticker, to.threadIdOrNull, emoji, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||
|
||||
suspend inline fun TelegramBot.reply(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
sticker: Sticker,
|
||||
emoji: String? = null,
|
||||
disableNotification: Boolean = false,
|
||||
@ -706,7 +705,7 @@ suspend inline fun TelegramBot.reply(
|
||||
// Videos
|
||||
|
||||
suspend inline fun TelegramBot.replyWithVideo(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
video: InputFile,
|
||||
thumb: InputFile? = null,
|
||||
text: String? = null,
|
||||
@ -722,7 +721,7 @@ suspend inline fun TelegramBot.replyWithVideo(
|
||||
) = sendVideo(to.chat, video, thumb, text, parseMode, spoilered, duration, width, height, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||
|
||||
suspend inline fun TelegramBot.reply(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
video: VideoFile,
|
||||
text: String? = null,
|
||||
parseMode: ParseMode? = null,
|
||||
@ -734,7 +733,7 @@ suspend inline fun TelegramBot.reply(
|
||||
) = sendVideo(to.chat, video, text, parseMode, spoilered, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||
|
||||
suspend inline fun TelegramBot.replyWithVideo(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
video: InputFile,
|
||||
thumb: InputFile? = null,
|
||||
entities: TextSourcesList,
|
||||
@ -749,7 +748,7 @@ suspend inline fun TelegramBot.replyWithVideo(
|
||||
) = sendVideo(to.chat, video, thumb, entities, spoilered, duration, width, height, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||
|
||||
suspend inline fun TelegramBot.reply(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
video: VideoFile,
|
||||
entities: TextSourcesList,
|
||||
spoilered: Boolean = false,
|
||||
@ -763,7 +762,7 @@ suspend inline fun TelegramBot.reply(
|
||||
// VideoNotes
|
||||
|
||||
suspend inline fun TelegramBot.replyWithVideoNote(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
videoNote: InputFile,
|
||||
thumb: InputFile? = null,
|
||||
duration: Long? = null,
|
||||
@ -775,7 +774,7 @@ suspend inline fun TelegramBot.replyWithVideoNote(
|
||||
) = sendVideoNote(to.chat, videoNote, thumb, duration, size, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||
|
||||
suspend inline fun TelegramBot.reply(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
videoNote: VideoNoteFile,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
@ -787,7 +786,7 @@ suspend inline fun TelegramBot.reply(
|
||||
// Voice
|
||||
|
||||
suspend inline fun TelegramBot.replyWithVoice(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
voice: InputFile,
|
||||
text: String? = null,
|
||||
parseMode: ParseMode? = null,
|
||||
@ -799,7 +798,7 @@ suspend inline fun TelegramBot.replyWithVoice(
|
||||
) = sendVoice(to.chat, voice, text, parseMode, duration, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||
|
||||
suspend inline fun TelegramBot.reply(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
voice: VoiceFile,
|
||||
text: String? = null,
|
||||
parseMode: ParseMode? = null,
|
||||
@ -811,7 +810,7 @@ suspend inline fun TelegramBot.reply(
|
||||
|
||||
|
||||
suspend inline fun TelegramBot.replyWithVoice(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
voice: InputFile,
|
||||
entities: TextSourcesList,
|
||||
duration: Long? = null,
|
||||
@ -822,7 +821,7 @@ suspend inline fun TelegramBot.replyWithVoice(
|
||||
) = sendVoice(to.chat, voice, entities, duration, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||
|
||||
suspend inline fun TelegramBot.reply(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
voice: VoiceFile,
|
||||
entities: TextSourcesList,
|
||||
disableNotification: Boolean = false,
|
||||
@ -839,7 +838,7 @@ suspend inline fun TelegramBot.reply(
|
||||
* as a builder for that
|
||||
*/
|
||||
suspend inline fun TelegramBot.reply(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
title: String,
|
||||
description: String,
|
||||
payload: String,
|
||||
@ -867,7 +866,7 @@ suspend inline fun TelegramBot.reply(
|
||||
// Polls
|
||||
|
||||
suspend inline fun TelegramBot.reply(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
question: String,
|
||||
options: List<String>,
|
||||
isAnonymous: Boolean = true,
|
||||
@ -881,7 +880,7 @@ suspend inline fun TelegramBot.reply(
|
||||
) = sendRegularPoll(to.chat, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||
|
||||
suspend inline fun TelegramBot.reply(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
poll: RegularPoll,
|
||||
isClosed: Boolean = false,
|
||||
question: String = poll.question,
|
||||
@ -896,7 +895,7 @@ suspend inline fun TelegramBot.reply(
|
||||
) = sendRegularPoll(to.chat, poll, isClosed, question, options, isAnonymous, allowMultipleAnswers, closeInfo, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||
|
||||
suspend inline fun TelegramBot.reply(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
question: String,
|
||||
options: List<String>,
|
||||
correctOptionId: Int,
|
||||
@ -912,7 +911,7 @@ suspend inline fun TelegramBot.reply(
|
||||
) = sendQuizPoll(to.chat, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||
|
||||
suspend inline fun TelegramBot.reply(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
quizPoll: QuizPoll,
|
||||
isClosed: Boolean = false,
|
||||
question: String = quizPoll.question,
|
||||
@ -929,7 +928,7 @@ suspend inline fun TelegramBot.reply(
|
||||
) = sendQuizPoll(to.chat, isClosed, quizPoll, question, options, correctOptionId, isAnonymous, explanation, parseMode, closeInfo, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||
|
||||
suspend inline fun TelegramBot.reply(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
question: String,
|
||||
options: List<String>,
|
||||
correctOptionId: Int,
|
||||
@ -944,7 +943,7 @@ suspend inline fun TelegramBot.reply(
|
||||
) = sendQuizPoll(to.chat, question, options, correctOptionId, isAnonymous, isClosed, entities, closeInfo, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||
|
||||
suspend inline fun TelegramBot.reply(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
quizPoll: QuizPoll,
|
||||
entities: TextSourcesList,
|
||||
isClosed: Boolean = false,
|
||||
@ -961,7 +960,7 @@ suspend inline fun TelegramBot.reply(
|
||||
|
||||
|
||||
suspend inline fun TelegramBot.reply(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
poll: Poll,
|
||||
isClosed: Boolean = false,
|
||||
question: String = poll.question,
|
||||
@ -1006,7 +1005,7 @@ suspend inline fun TelegramBot.reply(
|
||||
|
||||
|
||||
suspend inline fun TelegramBot.reply(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
fromChatId: ChatIdentifier,
|
||||
messageId: MessageId,
|
||||
text: String? = null,
|
||||
@ -1030,7 +1029,7 @@ suspend inline fun TelegramBot.reply(
|
||||
)
|
||||
|
||||
suspend inline fun TelegramBot.reply(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
fromChat: Chat,
|
||||
messageId: MessageId,
|
||||
text: String? = null,
|
||||
@ -1042,8 +1041,8 @@ suspend inline fun TelegramBot.reply(
|
||||
) = reply(to, fromChat.id, messageId, text, parseMode, disableNotification, protectContent, allowSendingWithoutReply, replyMarkup)
|
||||
|
||||
suspend inline fun TelegramBot.reply(
|
||||
to: Message,
|
||||
copy: Message,
|
||||
to: AccessibleMessage,
|
||||
copy: AccessibleMessage,
|
||||
text: String? = null,
|
||||
parseMode: ParseMode? = null,
|
||||
disableNotification: Boolean = false,
|
||||
@ -1053,13 +1052,13 @@ suspend inline fun TelegramBot.reply(
|
||||
) = reply(to, copy.chat.id, copy.messageId, text, parseMode, disableNotification, protectContent, allowSendingWithoutReply, replyMarkup)
|
||||
|
||||
suspend fun TelegramBot.reply(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
content: MessageContent,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
): Message = execute(
|
||||
): AccessibleMessage = execute(
|
||||
content.createResend(
|
||||
to.chat.id,
|
||||
to.threadIdOrNull,
|
||||
@ -1077,7 +1076,7 @@ suspend fun TelegramBot.reply(
|
||||
* @see handleLiveLocation
|
||||
*/
|
||||
suspend fun TelegramBot.reply(
|
||||
message: Message,
|
||||
message: AccessibleMessage,
|
||||
locationsFlow: Flow<EditLiveLocationInfo>,
|
||||
liveTimeMillis: Long = defaultLivePeriodDelayMillis,
|
||||
disableNotification: Boolean = false,
|
||||
@ -1102,7 +1101,7 @@ suspend fun TelegramBot.reply(
|
||||
@JvmName("replyLiveLocationWithLocation")
|
||||
@JsName("replyLiveLocationWithLocation")
|
||||
suspend fun TelegramBot.reply(
|
||||
message: Message,
|
||||
message: AccessibleMessage,
|
||||
locationsFlow: Flow<Location>,
|
||||
liveTimeMillis: Long = defaultLivePeriodDelayMillis,
|
||||
disableNotification: Boolean = false,
|
||||
@ -1129,7 +1128,7 @@ suspend fun TelegramBot.reply(
|
||||
@JvmName("replyLiveLocationWithLatLong")
|
||||
@JsName("replyLiveLocationWithLatLong")
|
||||
suspend fun TelegramBot.reply(
|
||||
message: Message,
|
||||
message: AccessibleMessage,
|
||||
locationsFlow: Flow<Pair<Double, Double>>,
|
||||
liveTimeMillis: Long = defaultLivePeriodDelayMillis,
|
||||
disableNotification: Boolean = false,
|
||||
@ -1149,7 +1148,7 @@ suspend fun TelegramBot.reply(
|
||||
}
|
||||
|
||||
suspend fun TelegramBot.reply(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
mediaFile: TelegramMediaFile,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
@ -1233,7 +1232,7 @@ suspend fun TelegramBot.reply(
|
||||
}
|
||||
|
||||
suspend fun TelegramBot.reply(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
content: TextedMediaContent,
|
||||
text: String?,
|
||||
parseMode: ParseMode? = null,
|
||||
@ -1307,7 +1306,7 @@ suspend fun TelegramBot.reply(
|
||||
}
|
||||
|
||||
suspend fun TelegramBot.reply(
|
||||
to: Message,
|
||||
to: AccessibleMessage,
|
||||
content: TextedMediaContent,
|
||||
entities: TextSourcesList,
|
||||
disableNotification: Boolean = false,
|
||||
|
@ -23,7 +23,7 @@ import dev.inmo.tgbotapi.types.files.TelegramMediaFile
|
||||
import dev.inmo.tgbotapi.types.files.Sticker
|
||||
import dev.inmo.tgbotapi.types.games.Game
|
||||
import dev.inmo.tgbotapi.types.location.*
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||
import dev.inmo.tgbotapi.types.message.content.*
|
||||
import dev.inmo.tgbotapi.types.payments.LabeledPrice
|
||||
import dev.inmo.tgbotapi.types.payments.abstracts.Currency
|
||||
@ -1166,7 +1166,7 @@ suspend inline fun TelegramBot.reply(
|
||||
suspend inline fun TelegramBot.reply(
|
||||
toChatId: IdChatIdentifier,
|
||||
toMessageId: MessageId,
|
||||
copy: Message,
|
||||
copy: AccessibleMessage,
|
||||
text: String? = null,
|
||||
parseMode: ParseMode? = null,
|
||||
threadId: MessageThreadId? = toChatId.threadId,
|
||||
|
@ -1,16 +1,12 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.send
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.send.SendAction
|
||||
import dev.inmo.tgbotapi.requests.send.SetMessageReactions
|
||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.MessageId
|
||||
import dev.inmo.tgbotapi.types.MessageThreadId
|
||||
import dev.inmo.tgbotapi.types.actions.*
|
||||
import dev.inmo.tgbotapi.types.chat.Chat
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||
import dev.inmo.tgbotapi.types.reactions.Reaction
|
||||
import dev.inmo.tgbotapi.types.threadId
|
||||
|
||||
suspend fun TelegramBot.setMessageReactions(
|
||||
chatId: ChatIdentifier,
|
||||
@ -43,13 +39,13 @@ suspend fun TelegramBot.setMessageReaction(
|
||||
) = setMessageReaction(chat.id, messageId, reaction, big)
|
||||
|
||||
suspend fun TelegramBot.setMessageReactions(
|
||||
message: Message,
|
||||
message: AccessibleMessage,
|
||||
reactions: List<Reaction>,
|
||||
big: Boolean = false
|
||||
) = setMessageReactions(message.chat, message.messageId, reactions, big)
|
||||
|
||||
suspend fun TelegramBot.setMessageReaction(
|
||||
message: Message,
|
||||
message: AccessibleMessage,
|
||||
reaction: Reaction?,
|
||||
big: Boolean = false
|
||||
) = setMessageReaction(message.chat, message.messageId, reaction, big)
|
||||
|
@ -6,24 +6,24 @@ import dev.inmo.tgbotapi.extensions.utils.extensions.sourceUser
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.query.InlineQuery
|
||||
import dev.inmo.tgbotapi.types.chat.ChatJoinRequest
|
||||
import dev.inmo.tgbotapi.types.chat.member.ChatMemberUpdated
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||
import dev.inmo.tgbotapi.types.payments.PreCheckoutQuery
|
||||
import dev.inmo.tgbotapi.types.payments.ShippingQuery
|
||||
import dev.inmo.tgbotapi.types.queries.callback.CallbackQuery
|
||||
import dev.inmo.tgbotapi.types.update.abstracts.Update
|
||||
|
||||
/**
|
||||
* Allow only events from the same chat as base [Message]
|
||||
* Allow only events from the same chat as base [AccessibleMessage]
|
||||
*/
|
||||
val MessageFilterByChat: BehaviourContextAndTwoTypesReceiver<Boolean, Message, Update> = { message, update ->
|
||||
val MessageFilterByChat: BehaviourContextAndTwoTypesReceiver<Boolean, AccessibleMessage, Update> = { message, update ->
|
||||
update.sourceChat() ?.let {
|
||||
it.id == message.chat.id
|
||||
} != false
|
||||
}
|
||||
/**
|
||||
* Allow only events from the same chat as base [List] of [Message]
|
||||
* Allow only events from the same chat as base [List] of [AccessibleMessage]
|
||||
*/
|
||||
val MessagesFilterByChat: BehaviourContextAndTwoTypesReceiver<Boolean, List<Message>, Update> = { messages, update ->
|
||||
val MessagesFilterByChat: BehaviourContextAndTwoTypesReceiver<Boolean, List<AccessibleMessage>, Update> = { messages, update ->
|
||||
val sourceChatId = update.sourceChat() ?.id
|
||||
sourceChatId != null && messages.all { sourceChatId == it.chat.id }
|
||||
}
|
||||
|
@ -1,15 +1,13 @@
|
||||
package dev.inmo.tgbotapi.extensions.behaviour_builder.filters
|
||||
|
||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver
|
||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.SimpleFilter
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.*
|
||||
import dev.inmo.tgbotapi.types.message.content.MediaGroupContent
|
||||
import dev.inmo.tgbotapi.types.message.content.MediaGroupMessage
|
||||
import dev.inmo.tgbotapi.types.update.abstracts.Update
|
||||
|
||||
/**
|
||||
* Allow only messages which are not [MediaGroupMessage]
|
||||
*/
|
||||
val CommonMessageFilterExcludeMediaGroups = SimpleFilter<Message> {
|
||||
val CommonMessageFilterExcludeMediaGroups = SimpleFilter<AccessibleMessage> {
|
||||
it !is CommonMessage<*> || it.content !is MediaGroupContent<*>
|
||||
}
|
||||
|
@ -7,6 +7,6 @@ import dev.inmo.tgbotapi.utils.extensions.threadIdOrNull
|
||||
/**
|
||||
* Allow only messages which are not in some forum
|
||||
*/
|
||||
val MessageFilterForums = SimpleFilter<Message> {
|
||||
val MessageFilterForums = SimpleFilter<AccessibleMessage> {
|
||||
it.threadIdOrNull == null
|
||||
}
|
||||
|
@ -2,12 +2,12 @@ package dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories
|
||||
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.*
|
||||
|
||||
object ByChatMessageMarkerFactory : MarkerFactory<Message, Any> {
|
||||
override suspend fun invoke(data: Message) = data.chat
|
||||
object ByChatMessageMarkerFactory : MarkerFactory<AccessibleMessage, Any> {
|
||||
override suspend fun invoke(data: AccessibleMessage) = data.chat
|
||||
}
|
||||
|
||||
object ByUserMessageMarkerFactory : MarkerFactory<Message, Any> {
|
||||
override suspend fun invoke(data: Message) = when (data) {
|
||||
object ByUserMessageMarkerFactory : MarkerFactory<AccessibleMessage, Any> {
|
||||
override suspend fun invoke(data: AccessibleMessage) = when (data) {
|
||||
is FromUserMessage -> data.user
|
||||
is FromChannelGroupContentMessage<*> -> data.channel
|
||||
else -> data.chat // including anonymous
|
||||
|
@ -1,6 +1,5 @@
|
||||
package dev.inmo.tgbotapi.requests
|
||||
|
||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.update.abstracts.Update
|
||||
import dev.inmo.tgbotapi.types.update.abstracts.UpdateSerializerWithoutSerialization
|
||||
@ -15,7 +14,7 @@ private val updatesListSerializer = ListSerializer(
|
||||
* Request updates from Telegram Bot API system. It is important, that the result updates WILL NOT include
|
||||
* [dev.inmo.tgbotapi.types.update.MediaGroupUpdates.MediaGroupUpdate] objects due to the fact,
|
||||
* that it is internal abstraction and in fact any [dev.inmo.tgbotapi.types.message.abstracts.MediaGroupMessage]
|
||||
* is just a common [dev.inmo.tgbotapi.types.message.abstracts.Message]
|
||||
* is just a common [dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage]
|
||||
*
|
||||
* @see dev.inmo.tgbotapi.extensions.utils.updates.retrieving.updateHandlerWithMediaGroupsAdaptation
|
||||
* @see dev.inmo.tgbotapi.utils.convertWithMediaGroupUpdates
|
||||
|
@ -2,10 +2,10 @@ package dev.inmo.tgbotapi.types.chat
|
||||
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.colors.ColorId
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializeOnlySerializer
|
||||
import dev.inmo.tgbotapi.types.reactions.Reaction
|
||||
import korlibs.time.DateTime
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable(ExtendedChatSerializer.Companion::class)
|
||||
|
@ -1,9 +1,7 @@
|
||||
package dev.inmo.tgbotapi.types.giveaway
|
||||
|
||||
import dev.inmo.tgbotapi.types.chat.PreviewChat
|
||||
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.ChannelEvent
|
||||
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.ChatEvent
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.Transient
|
||||
|
||||
@ -12,5 +10,5 @@ data class GiveawayPrivateResults(
|
||||
override val chat: PreviewChat,
|
||||
override val unclaimedCount: Int,
|
||||
@Transient // TODO::Add message serializer
|
||||
val message: Message? = null
|
||||
val message: AccessibleMessage? = null
|
||||
) : GiveawayResults
|
||||
|
@ -3,7 +3,6 @@ package dev.inmo.tgbotapi.types.message
|
||||
import korlibs.time.DateTime
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.chat.ChannelChat
|
||||
import dev.inmo.tgbotapi.types.chat.CommonBot
|
||||
import dev.inmo.tgbotapi.types.chat.PreviewChannelChat
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.*
|
||||
@ -17,7 +16,7 @@ data class ChannelContentMessageImpl<T: MessageContent>(
|
||||
override val editDate: DateTime?,
|
||||
override val hasProtectedContent: Boolean,
|
||||
override val forwardInfo: ForwardInfo?,
|
||||
override val replyTo: Message?,
|
||||
override val replyTo: AccessibleMessage?,
|
||||
override val replyMarkup: InlineKeyboardMarkup?,
|
||||
override val senderBot: CommonBot?,
|
||||
override val authorSignature: AuthorSignature?,
|
||||
|
@ -1,6 +1,7 @@
|
||||
package dev.inmo.tgbotapi.types.message.ChatEvents
|
||||
|
||||
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.CommonEvent
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||
|
||||
data class PinnedMessage(
|
||||
|
@ -17,7 +17,7 @@ data class ConnectedFromChannelGroupContentMessageImpl<T : MessageContent>(
|
||||
override val forwardInfo: ForwardInfo?,
|
||||
override val editDate: DateTime?,
|
||||
override val hasProtectedContent: Boolean,
|
||||
override val replyTo: Message?,
|
||||
override val replyTo: AccessibleMessage?,
|
||||
override val replyMarkup: InlineKeyboardMarkup?,
|
||||
override val content: T,
|
||||
override val senderBot: CommonBot?,
|
||||
@ -33,7 +33,7 @@ data class UnconnectedFromChannelGroupContentMessageImpl<T: MessageContent>(
|
||||
override val forwardInfo: ForwardInfo?,
|
||||
override val editDate: DateTime?,
|
||||
override val hasProtectedContent: Boolean,
|
||||
override val replyTo: Message?,
|
||||
override val replyTo: AccessibleMessage?,
|
||||
override val replyMarkup: InlineKeyboardMarkup?,
|
||||
override val content: T,
|
||||
override val senderBot: CommonBot?,
|
||||
@ -48,7 +48,7 @@ data class AnonymousGroupContentMessageImpl<T : MessageContent>(
|
||||
override val forwardInfo: ForwardInfo?,
|
||||
override val editDate: DateTime?,
|
||||
override val hasProtectedContent: Boolean,
|
||||
override val replyTo: Message?,
|
||||
override val replyTo: AccessibleMessage?,
|
||||
override val replyMarkup: InlineKeyboardMarkup?,
|
||||
override val content: T,
|
||||
override val senderBot: CommonBot?,
|
||||
@ -64,7 +64,7 @@ data class CommonGroupContentMessageImpl<T : MessageContent>(
|
||||
override val forwardInfo: ForwardInfo?,
|
||||
override val editDate: DateTime?,
|
||||
override val hasProtectedContent: Boolean,
|
||||
override val replyTo: Message?,
|
||||
override val replyTo: AccessibleMessage?,
|
||||
override val replyMarkup: InlineKeyboardMarkup?,
|
||||
override val content: T,
|
||||
override val senderBot: CommonBot?,
|
||||
@ -80,7 +80,7 @@ data class FromChannelForumContentMessageImpl<T: MessageContent>(
|
||||
override val forwardInfo: ForwardInfo?,
|
||||
override val editDate: DateTime?,
|
||||
override val hasProtectedContent: Boolean,
|
||||
override val replyTo: Message?,
|
||||
override val replyTo: AccessibleMessage?,
|
||||
override val replyMarkup: InlineKeyboardMarkup?,
|
||||
override val content: T,
|
||||
override val senderBot: CommonBot?,
|
||||
@ -96,7 +96,7 @@ data class AnonymousForumContentMessageImpl<T : MessageContent>(
|
||||
override val forwardInfo: ForwardInfo?,
|
||||
override val editDate: DateTime?,
|
||||
override val hasProtectedContent: Boolean,
|
||||
override val replyTo: Message?,
|
||||
override val replyTo: AccessibleMessage?,
|
||||
override val replyMarkup: InlineKeyboardMarkup?,
|
||||
override val content: T,
|
||||
override val senderBot: CommonBot?,
|
||||
@ -113,7 +113,7 @@ data class CommonForumContentMessageImpl<T : MessageContent>(
|
||||
override val forwardInfo: ForwardInfo?,
|
||||
override val editDate: DateTime?,
|
||||
override val hasProtectedContent: Boolean,
|
||||
override val replyTo: Message?,
|
||||
override val replyTo: AccessibleMessage?,
|
||||
override val replyMarkup: InlineKeyboardMarkup?,
|
||||
override val content: T,
|
||||
override val senderBot: CommonBot?,
|
||||
|
@ -3,10 +3,9 @@ package dev.inmo.tgbotapi.types.message
|
||||
import korlibs.time.DateTime
|
||||
import dev.inmo.tgbotapi.types.MessageId
|
||||
import dev.inmo.tgbotapi.types.chat.User
|
||||
import dev.inmo.tgbotapi.types.chat.Chat
|
||||
import dev.inmo.tgbotapi.types.chat.PreviewChat
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.FromUserMessage
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||
import dev.inmo.tgbotapi.types.passport.PassportData
|
||||
|
||||
data class PassportMessage(
|
||||
@ -15,4 +14,4 @@ data class PassportMessage(
|
||||
override val from: User,
|
||||
override val date: DateTime,
|
||||
val passportData: PassportData
|
||||
) : Message, FromUserMessage
|
||||
) : AccessibleMessage, FromUserMessage
|
||||
|
@ -6,7 +6,7 @@ import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.chat.*
|
||||
import dev.inmo.tgbotapi.types.chat.CommonBot
|
||||
import dev.inmo.tgbotapi.types.chat.User
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.PrivateContentMessage
|
||||
import dev.inmo.tgbotapi.types.message.content.MessageContent
|
||||
|
||||
@ -19,7 +19,7 @@ data class PrivateContentMessageImpl<T: MessageContent>(
|
||||
override val editDate: DateTime?,
|
||||
override val hasProtectedContent: Boolean,
|
||||
override val forwardInfo: ForwardInfo?,
|
||||
override val replyTo: Message?,
|
||||
override val replyTo: AccessibleMessage?,
|
||||
override val replyMarkup: InlineKeyboardMarkup?,
|
||||
override val senderBot: CommonBot?,
|
||||
override val mediaGroupId: MediaGroupIdentifier?,
|
||||
|
@ -286,7 +286,7 @@ internal data class RawMessage(
|
||||
}
|
||||
}
|
||||
|
||||
val asMessage: Message by lazy {
|
||||
val asMessage: AccessibleMessage by lazy {
|
||||
if (date.date == 0L) {
|
||||
return@lazy InaccessibleMessage(
|
||||
chat,
|
||||
|
@ -2,6 +2,6 @@ package dev.inmo.tgbotapi.types.message.abstracts
|
||||
|
||||
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.ChatEvent
|
||||
|
||||
interface ChatEventMessage<T : ChatEvent> : Message {
|
||||
interface ChatEventMessage<T : ChatEvent> : AccessibleMessage {
|
||||
val chatEvent: T
|
||||
}
|
@ -2,7 +2,7 @@ package dev.inmo.tgbotapi.types.message.abstracts
|
||||
|
||||
import dev.inmo.tgbotapi.types.message.content.MessageContent
|
||||
|
||||
sealed interface CommonMessage<out T: MessageContent> : Message,
|
||||
sealed interface CommonMessage<out T: MessageContent> : AccessibleMessage,
|
||||
PossiblyForwardedMessage,
|
||||
PossiblyEditedMessage,
|
||||
PossiblyReplyMessage,
|
||||
|
@ -2,7 +2,7 @@ package dev.inmo.tgbotapi.types.message.abstracts
|
||||
|
||||
import dev.inmo.tgbotapi.types.message.content.MessageContent
|
||||
|
||||
interface ContentMessage<out T: MessageContent>: Message {
|
||||
interface ContentMessage<out T: MessageContent>: AccessibleMessage {
|
||||
val hasProtectedContent: Boolean
|
||||
val content: T
|
||||
|
||||
|
@ -2,4 +2,4 @@ package dev.inmo.tgbotapi.types.message.abstracts
|
||||
|
||||
import dev.inmo.tgbotapi.abstracts.FromUser
|
||||
|
||||
interface FromUserMessage : FromUser, Message
|
||||
interface FromUserMessage : FromUser, AccessibleMessage
|
||||
|
@ -1,12 +1,9 @@
|
||||
package dev.inmo.tgbotapi.types.message.abstracts
|
||||
|
||||
import dev.inmo.tgbotapi.abstracts.WithMessageId
|
||||
import korlibs.time.DateTime
|
||||
import dev.inmo.tgbotapi.abstracts.WithPreviewChat
|
||||
import dev.inmo.tgbotapi.abstracts.WithPreviewChatAndMessageId
|
||||
import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded
|
||||
import dev.inmo.tgbotapi.types.MessageId
|
||||
import dev.inmo.tgbotapi.types.chat.Chat
|
||||
import dev.inmo.tgbotapi.types.chat.PreviewChat
|
||||
import dev.inmo.tgbotapi.types.message.RawMessage
|
||||
import kotlinx.serialization.*
|
||||
@ -19,11 +16,13 @@ interface Message : WithPreviewChatAndMessageId {
|
||||
val date: DateTime
|
||||
}
|
||||
|
||||
interface AccessibleMessage : Message
|
||||
|
||||
@Serializable
|
||||
data class InaccessibleMessage(
|
||||
override val chat: PreviewChat,
|
||||
override val messageId: MessageId,
|
||||
) : Message {
|
||||
) : AccessibleMessage {
|
||||
override val date: DateTime
|
||||
get() = DateTime.invoke(0L)
|
||||
}
|
||||
@ -33,7 +32,7 @@ data class UnknownMessageType(
|
||||
override val chat: PreviewChat,
|
||||
override val date: DateTime,
|
||||
val insideException: Exception
|
||||
) : Message
|
||||
) : AccessibleMessage
|
||||
|
||||
internal class TelegramBotAPIMessageDeserializationStrategyClass<T> : DeserializationStrategy<T> {
|
||||
@OptIn(InternalSerializationApi::class)
|
||||
|
@ -2,6 +2,6 @@ package dev.inmo.tgbotapi.types.message.abstracts
|
||||
|
||||
import korlibs.time.DateTime
|
||||
|
||||
interface PossiblyEditedMessage : Message {
|
||||
interface PossiblyEditedMessage : AccessibleMessage {
|
||||
val editDate: DateTime?
|
||||
}
|
||||
|
@ -2,6 +2,6 @@ package dev.inmo.tgbotapi.types.message.abstracts
|
||||
|
||||
import dev.inmo.tgbotapi.types.message.ForwardInfo
|
||||
|
||||
interface PossiblyForwardedMessage : Message {
|
||||
interface PossiblyForwardedMessage : AccessibleMessage {
|
||||
val forwardInfo: ForwardInfo?
|
||||
}
|
@ -2,6 +2,6 @@ package dev.inmo.tgbotapi.types.message.abstracts
|
||||
|
||||
import dev.inmo.tgbotapi.types.message.payments.abstracts.PaymentInfo
|
||||
|
||||
interface PossiblyPaymentMessage : Message {
|
||||
interface PossiblyPaymentMessage : AccessibleMessage {
|
||||
val paymentInfo: PaymentInfo?
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
package dev.inmo.tgbotapi.types.message.abstracts
|
||||
|
||||
interface PossiblyReplyMessage {
|
||||
val replyTo: Message?
|
||||
val replyTo: AccessibleMessage?
|
||||
}
|
@ -2,6 +2,6 @@ package dev.inmo.tgbotapi.types.message.abstracts
|
||||
|
||||
import dev.inmo.tgbotapi.types.MessageThreadId
|
||||
|
||||
interface PossiblyTopicMessage : Message {
|
||||
interface PossiblyTopicMessage : AccessibleMessage {
|
||||
val threadId: MessageThreadId?
|
||||
}
|
||||
|
@ -2,6 +2,6 @@ package dev.inmo.tgbotapi.types.message.abstracts
|
||||
|
||||
import dev.inmo.tgbotapi.types.AuthorSignature
|
||||
|
||||
interface SignedMessage : Message {
|
||||
interface SignedMessage : AccessibleMessage {
|
||||
val authorSignature: AuthorSignature?
|
||||
}
|
@ -165,5 +165,5 @@ sealed interface ResendableContent {
|
||||
replyToMessageId: MessageId? = null,
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
): Request<out Message>
|
||||
): Request<out AccessibleMessage>
|
||||
}
|
||||
|
@ -10,7 +10,6 @@ import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.files.TelegramMediaFile
|
||||
import dev.inmo.tgbotapi.types.media.TelegramMedia
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSource
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
|
@ -7,8 +7,6 @@ import dev.inmo.tgbotapi.types.MessageId
|
||||
import dev.inmo.tgbotapi.types.MessageThreadId
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.chat.Chat
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.PossiblyForwardedMessage
|
||||
import dev.inmo.tgbotapi.types.stories.Story
|
||||
import kotlinx.serialization.Serializable
|
||||
|
@ -0,0 +1,9 @@
|
||||
package dev.inmo.tgbotapi.types.queries.callback
|
||||
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||
import dev.inmo.tgbotapi.types.message.content.MessageContent
|
||||
|
||||
sealed interface AbstractMessageCallbackQuery : CallbackQuery {
|
||||
val message: Message
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package dev.inmo.tgbotapi.types.queries.callback
|
||||
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.InaccessibleMessage
|
||||
|
||||
sealed interface InaccessibleMessageCallbackQuery : AbstractMessageCallbackQuery {
|
||||
override val message: InaccessibleMessage
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package dev.inmo.tgbotapi.types.queries.callback
|
||||
|
||||
import dev.inmo.tgbotapi.types.CallbackQueryIdentifier
|
||||
import dev.inmo.tgbotapi.types.chat.CommonUser
|
||||
import dev.inmo.tgbotapi.types.chat.User
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.InaccessibleMessage
|
||||
import dev.inmo.tgbotapi.types.message.content.MessageContent
|
||||
|
||||
data class InaccessibleMessageDataCallbackQuery(
|
||||
override val id: CallbackQueryIdentifier,
|
||||
override val from: CommonUser,
|
||||
override val chatInstance: String,
|
||||
override val message: InaccessibleMessage,
|
||||
override val data: String
|
||||
) : DataCallbackQuery, InaccessibleMessageCallbackQuery
|
@ -0,0 +1,16 @@
|
||||
package dev.inmo.tgbotapi.types.queries.callback
|
||||
|
||||
import dev.inmo.tgbotapi.types.CallbackQueryIdentifier
|
||||
import dev.inmo.tgbotapi.types.chat.CommonUser
|
||||
import dev.inmo.tgbotapi.types.chat.User
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.InaccessibleMessage
|
||||
import dev.inmo.tgbotapi.types.message.content.MessageContent
|
||||
|
||||
data class InaccessibleMessageGameShortNameCallbackQuery(
|
||||
override val id: CallbackQueryIdentifier,
|
||||
override val from: CommonUser,
|
||||
override val chatInstance: String,
|
||||
override val message: InaccessibleMessage,
|
||||
override val gameShortName: String
|
||||
) : GameShortNameCallbackQuery, InaccessibleMessageCallbackQuery
|
@ -3,6 +3,6 @@ package dev.inmo.tgbotapi.types.queries.callback
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
import dev.inmo.tgbotapi.types.message.content.MessageContent
|
||||
|
||||
sealed interface MessageCallbackQuery : CallbackQuery {
|
||||
val message: ContentMessage<MessageContent>
|
||||
sealed interface MessageCallbackQuery : AbstractMessageCallbackQuery {
|
||||
override val message: ContentMessage<MessageContent>
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ internal data class RawCallbackQuery(
|
||||
@SerialName(fromField)
|
||||
val from: CommonUser,
|
||||
@Serializable(TelegramBotAPIMessageDeserializeOnlySerializer::class)
|
||||
val message: ContentMessage<MessageContent>? = null,
|
||||
val message: Message? = null,
|
||||
@SerialName(inlineMessageIdField)
|
||||
val inlineMessageId: InlineMessageIdentifier? = null,
|
||||
@SerialName("chat_instance")
|
||||
@ -28,8 +28,26 @@ internal data class RawCallbackQuery(
|
||||
private var inited: CallbackQuery? = null
|
||||
fun asCallbackQuery(raw: String): CallbackQuery {
|
||||
return inited ?: when {
|
||||
message != null && data != null -> MessageDataCallbackQuery(id, from, chatInstance, message, data)
|
||||
message != null && gameShortName != null -> MessageGameShortNameCallbackQuery(id, from, chatInstance, message, gameShortName)
|
||||
message != null && data != null -> when {
|
||||
message is ContentMessage<*> -> MessageDataCallbackQuery(id, from, chatInstance, message, data)
|
||||
message is InaccessibleMessage -> InaccessibleMessageDataCallbackQuery(id, from, chatInstance, message, data)
|
||||
else -> UnknownCallbackQueryType(
|
||||
id,
|
||||
from,
|
||||
chatInstance,
|
||||
raw
|
||||
)
|
||||
}
|
||||
message != null && gameShortName != null -> when {
|
||||
message is ContentMessage<*> -> MessageGameShortNameCallbackQuery(id, from, chatInstance, message, gameShortName)
|
||||
message is InaccessibleMessage -> InaccessibleMessageGameShortNameCallbackQuery(id, from, chatInstance, message, gameShortName)
|
||||
else -> UnknownCallbackQueryType(
|
||||
id,
|
||||
from,
|
||||
chatInstance,
|
||||
raw
|
||||
)
|
||||
}
|
||||
inlineMessageId != null && data != null -> InlineMessageIdDataCallbackQuery(id, from, chatInstance, inlineMessageId, data)
|
||||
inlineMessageId != null && gameShortName != null -> InlineMessageIdGameShortNameCallbackQuery(id, from, chatInstance, inlineMessageId, gameShortName)
|
||||
else -> UnknownCallbackQueryType(
|
||||
|
@ -1,12 +1,12 @@
|
||||
package dev.inmo.tgbotapi.types.update
|
||||
|
||||
import dev.inmo.tgbotapi.types.UpdateIdentifier
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||
import dev.inmo.tgbotapi.types.update.abstracts.BaseSentMessageUpdate
|
||||
|
||||
data class ChannelPostUpdate(
|
||||
override val updateId: UpdateIdentifier,
|
||||
override val data: Message
|
||||
override val data: AccessibleMessage
|
||||
) : BaseSentMessageUpdate {
|
||||
override fun copy(newData: Message): BaseSentMessageUpdate = copy(updateId, newData)
|
||||
override fun copy(newData: AccessibleMessage): BaseSentMessageUpdate = copy(updateId, newData)
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
package dev.inmo.tgbotapi.types.update
|
||||
|
||||
import dev.inmo.tgbotapi.types.UpdateIdentifier
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||
import dev.inmo.tgbotapi.types.update.abstracts.BaseSentMessageUpdate
|
||||
|
||||
data class MessageUpdate(
|
||||
override val updateId: UpdateIdentifier,
|
||||
override val data: Message
|
||||
override val data: AccessibleMessage
|
||||
) : BaseSentMessageUpdate {
|
||||
override fun copy(newData: Message) = copy(updateId, newData)
|
||||
override fun copy(newData: AccessibleMessage) = copy(updateId, newData)
|
||||
}
|
||||
|
@ -28,11 +28,11 @@ internal data class RawUpdate constructor(
|
||||
@Serializable(TelegramBotAPIMessageDeserializeOnlySerializer::class)
|
||||
private val edited_message: CommonMessage<*>? = null,
|
||||
@Serializable(TelegramBotAPIMessageDeserializeOnlySerializer::class)
|
||||
private val message: Message? = null,
|
||||
private val message: AccessibleMessage? = null,
|
||||
@Serializable(TelegramBotAPIMessageDeserializeOnlySerializer::class)
|
||||
private val edited_channel_post: CommonMessage<*>? = null,
|
||||
@Serializable(TelegramBotAPIMessageDeserializeOnlySerializer::class)
|
||||
private val channel_post: Message? = null,
|
||||
private val channel_post: AccessibleMessage? = null,
|
||||
private val inline_query: RawInlineQuery? = null,
|
||||
private val chosen_inline_result: RawChosenInlineResult? = null,
|
||||
private val callback_query: RawCallbackQuery? = null,
|
||||
|
@ -1,7 +1,7 @@
|
||||
package dev.inmo.tgbotapi.types.update.abstracts
|
||||
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||
|
||||
interface BaseMessageUpdate : Update {
|
||||
override val data: Message
|
||||
override val data: AccessibleMessage
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
package dev.inmo.tgbotapi.types.update.abstracts
|
||||
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||
|
||||
interface BaseSentMessageUpdate : BaseMessageUpdate {
|
||||
fun copy(newData: Message): BaseSentMessageUpdate
|
||||
fun copy(newData: AccessibleMessage): BaseSentMessageUpdate
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package dev.inmo.tgbotapi.utils.extensions
|
||||
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.PossiblyTopicMessage
|
||||
|
||||
val Message.threadIdOrNull
|
||||
val AccessibleMessage.threadIdOrNull
|
||||
get() = (this as? PossiblyTopicMessage) ?.threadId
|
||||
|
@ -978,346 +978,346 @@ inline fun SecureValue.requireSecureValueWithTranslations(): SecureValueWithTran
|
||||
this as SecureValueWithTranslations
|
||||
|
||||
@PreviewFeature
|
||||
inline fun <T> Message.whenAnonymousGroupContentMessageImpl(block: (AnonymousGroupContentMessageImpl<MessageContent>) -> T) =
|
||||
inline fun <T> AccessibleMessage.whenAnonymousGroupContentMessageImpl(block: (AnonymousGroupContentMessageImpl<MessageContent>) -> T) =
|
||||
asAnonymousGroupContentMessageImpl()?.let(block)
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.asAnonymousGroupContentMessageImpl(): AnonymousGroupContentMessageImpl<MessageContent>? =
|
||||
inline fun AccessibleMessage.asAnonymousGroupContentMessageImpl(): AnonymousGroupContentMessageImpl<MessageContent>? =
|
||||
this as? AnonymousGroupContentMessageImpl<MessageContent>
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.requireAnonymousGroupContentMessageImpl(): AnonymousGroupContentMessageImpl<MessageContent> =
|
||||
inline fun AccessibleMessage.requireAnonymousGroupContentMessageImpl(): AnonymousGroupContentMessageImpl<MessageContent> =
|
||||
this as AnonymousGroupContentMessageImpl<MessageContent>
|
||||
|
||||
@PreviewFeature
|
||||
inline fun <T> Message.whenChannelContentMessageImpl(block: (UnconnectedFromChannelGroupContentMessageImpl<MessageContent>) -> T) =
|
||||
inline fun <T> AccessibleMessage.whenChannelContentMessageImpl(block: (UnconnectedFromChannelGroupContentMessageImpl<MessageContent>) -> T) =
|
||||
asChannelContentMessageImpl()?.let(block)
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.asChannelContentMessageImpl(): UnconnectedFromChannelGroupContentMessageImpl<MessageContent>? =
|
||||
inline fun AccessibleMessage.asChannelContentMessageImpl(): UnconnectedFromChannelGroupContentMessageImpl<MessageContent>? =
|
||||
this as? UnconnectedFromChannelGroupContentMessageImpl<MessageContent>
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.requireChannelContentMessageImpl(): UnconnectedFromChannelGroupContentMessageImpl<MessageContent> =
|
||||
inline fun AccessibleMessage.requireChannelContentMessageImpl(): UnconnectedFromChannelGroupContentMessageImpl<MessageContent> =
|
||||
this as UnconnectedFromChannelGroupContentMessageImpl<MessageContent>
|
||||
|
||||
@PreviewFeature
|
||||
inline fun <T> Message.whenPassportMessage(block: (PassportMessage) -> T) = asPassportMessage()?.let(block)
|
||||
inline fun <T> AccessibleMessage.whenPassportMessage(block: (PassportMessage) -> T) = asPassportMessage()?.let(block)
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.asPassportMessage(): PassportMessage? = this as? PassportMessage
|
||||
inline fun AccessibleMessage.asPassportMessage(): PassportMessage? = this as? PassportMessage
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.requirePassportMessage(): PassportMessage = this as PassportMessage
|
||||
inline fun AccessibleMessage.requirePassportMessage(): PassportMessage = this as PassportMessage
|
||||
|
||||
@PreviewFeature
|
||||
inline fun <T> Message.whenPrivateContentMessageImpl(block: (PrivateContentMessageImpl<MessageContent>) -> T) =
|
||||
inline fun <T> AccessibleMessage.whenPrivateContentMessageImpl(block: (PrivateContentMessageImpl<MessageContent>) -> T) =
|
||||
asPrivateContentMessageImpl()?.let(block)
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.asPrivateContentMessageImpl(): PrivateContentMessageImpl<MessageContent>? =
|
||||
inline fun AccessibleMessage.asPrivateContentMessageImpl(): PrivateContentMessageImpl<MessageContent>? =
|
||||
this as? PrivateContentMessageImpl<MessageContent>
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.requirePrivateContentMessageImpl(): PrivateContentMessageImpl<MessageContent> =
|
||||
inline fun AccessibleMessage.requirePrivateContentMessageImpl(): PrivateContentMessageImpl<MessageContent> =
|
||||
this as PrivateContentMessageImpl<MessageContent>
|
||||
|
||||
@PreviewFeature
|
||||
inline fun <T> Message.whenChannelEventMessage(block: (ChannelEventMessage<ChannelEvent>) -> T) =
|
||||
inline fun <T> AccessibleMessage.whenChannelEventMessage(block: (ChannelEventMessage<ChannelEvent>) -> T) =
|
||||
asChannelEventMessage()?.let(block)
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.asChannelEventMessage(): ChannelEventMessage<ChannelEvent>? =
|
||||
inline fun AccessibleMessage.asChannelEventMessage(): ChannelEventMessage<ChannelEvent>? =
|
||||
this as? ChannelEventMessage<ChannelEvent>
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.requireChannelEventMessage(): ChannelEventMessage<ChannelEvent> =
|
||||
inline fun AccessibleMessage.requireChannelEventMessage(): ChannelEventMessage<ChannelEvent> =
|
||||
this as ChannelEventMessage<ChannelEvent>
|
||||
|
||||
@PreviewFeature
|
||||
inline fun <T> Message.whenCommonGroupEventMessage(block: (CommonGroupEventMessage<GroupEvent>) -> T) =
|
||||
inline fun <T> AccessibleMessage.whenCommonGroupEventMessage(block: (CommonGroupEventMessage<GroupEvent>) -> T) =
|
||||
asCommonGroupEventMessage()?.let(block)
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.asCommonGroupEventMessage(): CommonGroupEventMessage<GroupEvent>? =
|
||||
inline fun AccessibleMessage.asCommonGroupEventMessage(): CommonGroupEventMessage<GroupEvent>? =
|
||||
this as? CommonGroupEventMessage<GroupEvent>
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.requireCommonGroupEventMessage(): CommonGroupEventMessage<GroupEvent> =
|
||||
inline fun AccessibleMessage.requireCommonGroupEventMessage(): CommonGroupEventMessage<GroupEvent> =
|
||||
this as CommonGroupEventMessage<GroupEvent>
|
||||
|
||||
@PreviewFeature
|
||||
inline fun <T> Message.whenCommonSupergroupEventMessage(block: (CommonSupergroupEventMessage<SupergroupEvent>) -> T) =
|
||||
inline fun <T> AccessibleMessage.whenCommonSupergroupEventMessage(block: (CommonSupergroupEventMessage<SupergroupEvent>) -> T) =
|
||||
asCommonSupergroupEventMessage()?.let(block)
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.asCommonSupergroupEventMessage(): CommonSupergroupEventMessage<SupergroupEvent>? =
|
||||
inline fun AccessibleMessage.asCommonSupergroupEventMessage(): CommonSupergroupEventMessage<SupergroupEvent>? =
|
||||
this as? CommonSupergroupEventMessage<SupergroupEvent>
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.requireCommonSupergroupEventMessage(): CommonSupergroupEventMessage<SupergroupEvent> =
|
||||
inline fun AccessibleMessage.requireCommonSupergroupEventMessage(): CommonSupergroupEventMessage<SupergroupEvent> =
|
||||
this as CommonSupergroupEventMessage<SupergroupEvent>
|
||||
|
||||
@PreviewFeature
|
||||
inline fun <T> Message.whenAnonymousGroupContentMessage(block: (AnonymousGroupContentMessage<MessageContent>) -> T) =
|
||||
inline fun <T> AccessibleMessage.whenAnonymousGroupContentMessage(block: (AnonymousGroupContentMessage<MessageContent>) -> T) =
|
||||
asAnonymousGroupContentMessage()?.let(block)
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.asAnonymousGroupContentMessage(): AnonymousGroupContentMessage<MessageContent>? =
|
||||
inline fun AccessibleMessage.asAnonymousGroupContentMessage(): AnonymousGroupContentMessage<MessageContent>? =
|
||||
this as? AnonymousGroupContentMessage<MessageContent>
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.requireAnonymousGroupContentMessage(): AnonymousGroupContentMessage<MessageContent> =
|
||||
inline fun AccessibleMessage.requireAnonymousGroupContentMessage(): AnonymousGroupContentMessage<MessageContent> =
|
||||
this as AnonymousGroupContentMessage<MessageContent>
|
||||
|
||||
@PreviewFeature
|
||||
inline fun <T> Message.whenChannelContentMessage(block: (ChannelContentMessage<MessageContent>) -> T) =
|
||||
inline fun <T> AccessibleMessage.whenChannelContentMessage(block: (ChannelContentMessage<MessageContent>) -> T) =
|
||||
asChannelContentMessage()?.let(block)
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.asChannelContentMessage(): ChannelContentMessage<MessageContent>? =
|
||||
inline fun AccessibleMessage.asChannelContentMessage(): ChannelContentMessage<MessageContent>? =
|
||||
this as? ChannelContentMessage<MessageContent>
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.requireChannelContentMessage(): ChannelContentMessage<MessageContent> =
|
||||
inline fun AccessibleMessage.requireChannelContentMessage(): ChannelContentMessage<MessageContent> =
|
||||
this as ChannelContentMessage<MessageContent>
|
||||
|
||||
@PreviewFeature
|
||||
inline fun <T> Message.whenConnectedFromChannelGroupContentMessage(block: (ConnectedFromChannelGroupContentMessage<MessageContent>) -> T) =
|
||||
inline fun <T> AccessibleMessage.whenConnectedFromChannelGroupContentMessage(block: (ConnectedFromChannelGroupContentMessage<MessageContent>) -> T) =
|
||||
asConnectedFromChannelGroupContentMessage()?.let(block)
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.asConnectedFromChannelGroupContentMessage(): ConnectedFromChannelGroupContentMessage<MessageContent>? =
|
||||
inline fun AccessibleMessage.asConnectedFromChannelGroupContentMessage(): ConnectedFromChannelGroupContentMessage<MessageContent>? =
|
||||
this as? ConnectedFromChannelGroupContentMessage<MessageContent>
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.requireConnectedFromChannelGroupContentMessage(): ConnectedFromChannelGroupContentMessage<MessageContent> =
|
||||
inline fun AccessibleMessage.requireConnectedFromChannelGroupContentMessage(): ConnectedFromChannelGroupContentMessage<MessageContent> =
|
||||
this as ConnectedFromChannelGroupContentMessage<MessageContent>
|
||||
|
||||
@PreviewFeature
|
||||
inline fun <T> Message.whenUnconnectedFromChannelGroupContentMessage(block: (UnconnectedFromChannelGroupContentMessage<MessageContent>) -> T) =
|
||||
inline fun <T> AccessibleMessage.whenUnconnectedFromChannelGroupContentMessage(block: (UnconnectedFromChannelGroupContentMessage<MessageContent>) -> T) =
|
||||
asUnconnectedFromChannelGroupContentMessage()?.let(block)
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.asUnconnectedFromChannelGroupContentMessage(): UnconnectedFromChannelGroupContentMessage<MessageContent>? =
|
||||
inline fun AccessibleMessage.asUnconnectedFromChannelGroupContentMessage(): UnconnectedFromChannelGroupContentMessage<MessageContent>? =
|
||||
this as? UnconnectedFromChannelGroupContentMessage<MessageContent>
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.requireUnconnectedFromChannelGroupContentMessage(): UnconnectedFromChannelGroupContentMessage<MessageContent> =
|
||||
inline fun AccessibleMessage.requireUnconnectedFromChannelGroupContentMessage(): UnconnectedFromChannelGroupContentMessage<MessageContent> =
|
||||
this as UnconnectedFromChannelGroupContentMessage<MessageContent>
|
||||
|
||||
@PreviewFeature
|
||||
inline fun <T> Message.whenChatEventMessage(block: (ChatEventMessage<ChatEvent>) -> T) =
|
||||
inline fun <T> AccessibleMessage.whenChatEventMessage(block: (ChatEventMessage<ChatEvent>) -> T) =
|
||||
asChatEventMessage()?.let(block)
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.asChatEventMessage(): ChatEventMessage<ChatEvent>? = this as? ChatEventMessage<ChatEvent>
|
||||
inline fun AccessibleMessage.asChatEventMessage(): ChatEventMessage<ChatEvent>? = this as? ChatEventMessage<ChatEvent>
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.requireChatEventMessage(): ChatEventMessage<ChatEvent> = this as ChatEventMessage<ChatEvent>
|
||||
inline fun AccessibleMessage.requireChatEventMessage(): ChatEventMessage<ChatEvent> = this as ChatEventMessage<ChatEvent>
|
||||
|
||||
@PreviewFeature
|
||||
inline fun <T> Message.whenCommonGroupContentMessage(block: (CommonGroupContentMessage<MessageContent>) -> T) =
|
||||
inline fun <T> AccessibleMessage.whenCommonGroupContentMessage(block: (CommonGroupContentMessage<MessageContent>) -> T) =
|
||||
asCommonGroupContentMessage()?.let(block)
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.asCommonGroupContentMessage(): CommonGroupContentMessage<MessageContent>? =
|
||||
inline fun AccessibleMessage.asCommonGroupContentMessage(): CommonGroupContentMessage<MessageContent>? =
|
||||
this as? CommonGroupContentMessage<MessageContent>
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.requireCommonGroupContentMessage(): CommonGroupContentMessage<MessageContent> =
|
||||
inline fun AccessibleMessage.requireCommonGroupContentMessage(): CommonGroupContentMessage<MessageContent> =
|
||||
this as CommonGroupContentMessage<MessageContent>
|
||||
|
||||
@PreviewFeature
|
||||
inline fun <T> Message.whenCommonMessage(block: (CommonMessage<MessageContent>) -> T) = asCommonMessage()?.let(block)
|
||||
inline fun <T> AccessibleMessage.whenCommonMessage(block: (CommonMessage<MessageContent>) -> T) = asCommonMessage()?.let(block)
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.asCommonMessage(): CommonMessage<MessageContent>? = this as? CommonMessage<MessageContent>
|
||||
inline fun AccessibleMessage.asCommonMessage(): CommonMessage<MessageContent>? = this as? CommonMessage<MessageContent>
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.requireCommonMessage(): CommonMessage<MessageContent> = this as CommonMessage<MessageContent>
|
||||
inline fun AccessibleMessage.requireCommonMessage(): CommonMessage<MessageContent> = this as CommonMessage<MessageContent>
|
||||
|
||||
@PreviewFeature
|
||||
inline fun <T> Message.whenContentMessage(block: (ContentMessage<MessageContent>) -> T) = asContentMessage()?.let(block)
|
||||
inline fun <T> AccessibleMessage.whenContentMessage(block: (ContentMessage<MessageContent>) -> T) = asContentMessage()?.let(block)
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.asContentMessage(): ContentMessage<MessageContent>? = this as? ContentMessage<MessageContent>
|
||||
inline fun AccessibleMessage.asContentMessage(): ContentMessage<MessageContent>? = this as? ContentMessage<MessageContent>
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.requireContentMessage(): ContentMessage<MessageContent> = this as ContentMessage<MessageContent>
|
||||
inline fun AccessibleMessage.requireContentMessage(): ContentMessage<MessageContent> = this as ContentMessage<MessageContent>
|
||||
|
||||
@PreviewFeature
|
||||
inline fun <T> Message.whenFromChannelGroupContentMessage(block: (FromChannelGroupContentMessage<MessageContent>) -> T) =
|
||||
inline fun <T> AccessibleMessage.whenFromChannelGroupContentMessage(block: (FromChannelGroupContentMessage<MessageContent>) -> T) =
|
||||
asFromChannelGroupContentMessage()?.let(block)
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.asFromChannelGroupContentMessage(): FromChannelGroupContentMessage<MessageContent>? =
|
||||
inline fun AccessibleMessage.asFromChannelGroupContentMessage(): FromChannelGroupContentMessage<MessageContent>? =
|
||||
this as? FromChannelGroupContentMessage<MessageContent>
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.requireFromChannelGroupContentMessage(): FromChannelGroupContentMessage<MessageContent> =
|
||||
inline fun AccessibleMessage.requireFromChannelGroupContentMessage(): FromChannelGroupContentMessage<MessageContent> =
|
||||
this as FromChannelGroupContentMessage<MessageContent>
|
||||
|
||||
@PreviewFeature
|
||||
inline fun <T> Message.whenGroupEventMessage(block: (GroupEventMessage<GroupEvent>) -> T) =
|
||||
inline fun <T> AccessibleMessage.whenGroupEventMessage(block: (GroupEventMessage<GroupEvent>) -> T) =
|
||||
asGroupEventMessage()?.let(block)
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.asGroupEventMessage(): GroupEventMessage<GroupEvent>? = this as? GroupEventMessage<GroupEvent>
|
||||
inline fun AccessibleMessage.asGroupEventMessage(): GroupEventMessage<GroupEvent>? = this as? GroupEventMessage<GroupEvent>
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.requireGroupEventMessage(): GroupEventMessage<GroupEvent> = this as GroupEventMessage<GroupEvent>
|
||||
inline fun AccessibleMessage.requireGroupEventMessage(): GroupEventMessage<GroupEvent> = this as GroupEventMessage<GroupEvent>
|
||||
|
||||
@PreviewFeature
|
||||
inline fun <T> Message.whenPrivateEventMessage(block: (PrivateEventMessage<PrivateEvent>) -> T) =
|
||||
inline fun <T> AccessibleMessage.whenPrivateEventMessage(block: (PrivateEventMessage<PrivateEvent>) -> T) =
|
||||
asPrivateEventMessage()?.let(block)
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.asPrivateEventMessage(): PrivateEventMessage<PrivateEvent>? =
|
||||
inline fun AccessibleMessage.asPrivateEventMessage(): PrivateEventMessage<PrivateEvent>? =
|
||||
this as? PrivateEventMessage<PrivateEvent>
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.requirePrivateEventMessage(): PrivateEventMessage<PrivateEvent> =
|
||||
inline fun AccessibleMessage.requirePrivateEventMessage(): PrivateEventMessage<PrivateEvent> =
|
||||
this as PrivateEventMessage<PrivateEvent>
|
||||
|
||||
@PreviewFeature
|
||||
inline fun <T> Message.whenGroupContentMessage(block: (GroupContentMessage<MessageContent>) -> T) =
|
||||
inline fun <T> AccessibleMessage.whenGroupContentMessage(block: (GroupContentMessage<MessageContent>) -> T) =
|
||||
asGroupContentMessage()?.let(block)
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.asGroupContentMessage(): GroupContentMessage<MessageContent>? =
|
||||
inline fun AccessibleMessage.asGroupContentMessage(): GroupContentMessage<MessageContent>? =
|
||||
this as? GroupContentMessage<MessageContent>
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.requireGroupContentMessage(): GroupContentMessage<MessageContent> =
|
||||
inline fun AccessibleMessage.requireGroupContentMessage(): GroupContentMessage<MessageContent> =
|
||||
this as GroupContentMessage<MessageContent>
|
||||
|
||||
@PreviewFeature
|
||||
inline fun <T> Message.whenMediaGroupMessage(block: (MediaGroupMessage<MediaGroupPartContent>) -> T) =
|
||||
inline fun <T> AccessibleMessage.whenMediaGroupMessage(block: (MediaGroupMessage<MediaGroupPartContent>) -> T) =
|
||||
asMediaGroupMessage()?.let(block)
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.asMediaGroupMessage(): MediaGroupMessage<MediaGroupPartContent>? =
|
||||
inline fun AccessibleMessage.asMediaGroupMessage(): MediaGroupMessage<MediaGroupPartContent>? =
|
||||
this as? MediaGroupMessage<MediaGroupPartContent>
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.requireMediaGroupMessage(): MediaGroupMessage<MediaGroupPartContent> =
|
||||
inline fun AccessibleMessage.requireMediaGroupMessage(): MediaGroupMessage<MediaGroupPartContent> =
|
||||
this as MediaGroupMessage<MediaGroupPartContent>
|
||||
|
||||
@PreviewFeature
|
||||
inline fun <T> Message.whenPossiblyEditedMessage(block: (PossiblyEditedMessage) -> T) =
|
||||
inline fun <T> AccessibleMessage.whenPossiblyEditedMessage(block: (PossiblyEditedMessage) -> T) =
|
||||
asPossiblyEditedMessage()?.let(block)
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.asPossiblyEditedMessage(): PossiblyEditedMessage? = this as? PossiblyEditedMessage
|
||||
inline fun AccessibleMessage.asPossiblyEditedMessage(): PossiblyEditedMessage? = this as? PossiblyEditedMessage
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.requirePossiblyEditedMessage(): PossiblyEditedMessage = this as PossiblyEditedMessage
|
||||
inline fun AccessibleMessage.requirePossiblyEditedMessage(): PossiblyEditedMessage = this as PossiblyEditedMessage
|
||||
|
||||
@PreviewFeature
|
||||
inline fun <T> Message.whenPossiblyReplyMessage(block: (PossiblyReplyMessage) -> T) =
|
||||
inline fun <T> AccessibleMessage.whenPossiblyReplyMessage(block: (PossiblyReplyMessage) -> T) =
|
||||
asPossiblyReplyMessage()?.let(block)
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.asPossiblyReplyMessage(): PossiblyReplyMessage? = this as? PossiblyReplyMessage
|
||||
inline fun AccessibleMessage.asPossiblyReplyMessage(): PossiblyReplyMessage? = this as? PossiblyReplyMessage
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.requirePossiblyReplyMessage(): PossiblyReplyMessage = this as PossiblyReplyMessage
|
||||
inline fun AccessibleMessage.requirePossiblyReplyMessage(): PossiblyReplyMessage = this as PossiblyReplyMessage
|
||||
|
||||
@PreviewFeature
|
||||
inline fun <T> Message.whenPossiblyForwardedMessage(block: (PossiblyForwardedMessage) -> T) =
|
||||
inline fun <T> AccessibleMessage.whenPossiblyForwardedMessage(block: (PossiblyForwardedMessage) -> T) =
|
||||
asPossiblyForwardedMessage()?.let(block)
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.asPossiblyForwardedMessage(): PossiblyForwardedMessage? = this as? PossiblyForwardedMessage
|
||||
inline fun AccessibleMessage.asPossiblyForwardedMessage(): PossiblyForwardedMessage? = this as? PossiblyForwardedMessage
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.requirePossiblyForwardedMessage(): PossiblyForwardedMessage = this as PossiblyForwardedMessage
|
||||
inline fun AccessibleMessage.requirePossiblyForwardedMessage(): PossiblyForwardedMessage = this as PossiblyForwardedMessage
|
||||
|
||||
@PreviewFeature
|
||||
inline fun <T> Message.whenPossiblyPaymentMessage(block: (PossiblyPaymentMessage) -> T) =
|
||||
inline fun <T> AccessibleMessage.whenPossiblyPaymentMessage(block: (PossiblyPaymentMessage) -> T) =
|
||||
asPossiblyPaymentMessage()?.let(block)
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.asPossiblyPaymentMessage(): PossiblyPaymentMessage? = this as? PossiblyPaymentMessage
|
||||
inline fun AccessibleMessage.asPossiblyPaymentMessage(): PossiblyPaymentMessage? = this as? PossiblyPaymentMessage
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.requirePossiblyPaymentMessage(): PossiblyPaymentMessage = this as PossiblyPaymentMessage
|
||||
inline fun AccessibleMessage.requirePossiblyPaymentMessage(): PossiblyPaymentMessage = this as PossiblyPaymentMessage
|
||||
|
||||
@PreviewFeature
|
||||
inline fun <T> Message.whenPrivateContentMessage(block: (PrivateContentMessage<MessageContent>) -> T) =
|
||||
inline fun <T> AccessibleMessage.whenPrivateContentMessage(block: (PrivateContentMessage<MessageContent>) -> T) =
|
||||
asPrivateContentMessage()?.let(block)
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.asPrivateContentMessage(): PrivateContentMessage<MessageContent>? =
|
||||
inline fun AccessibleMessage.asPrivateContentMessage(): PrivateContentMessage<MessageContent>? =
|
||||
this as? PrivateContentMessage<MessageContent>
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.requirePrivateContentMessage(): PrivateContentMessage<MessageContent> =
|
||||
inline fun AccessibleMessage.requirePrivateContentMessage(): PrivateContentMessage<MessageContent> =
|
||||
this as PrivateContentMessage<MessageContent>
|
||||
|
||||
@PreviewFeature
|
||||
inline fun <T> Message.whenPublicContentMessage(block: (PublicContentMessage<MessageContent>) -> T) =
|
||||
inline fun <T> AccessibleMessage.whenPublicContentMessage(block: (PublicContentMessage<MessageContent>) -> T) =
|
||||
asPublicContentMessage()?.let(block)
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.asPublicContentMessage(): PublicContentMessage<MessageContent>? =
|
||||
inline fun AccessibleMessage.asPublicContentMessage(): PublicContentMessage<MessageContent>? =
|
||||
this as? PublicContentMessage<MessageContent>
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.requirePublicContentMessage(): PublicContentMessage<MessageContent> =
|
||||
inline fun AccessibleMessage.requirePublicContentMessage(): PublicContentMessage<MessageContent> =
|
||||
this as PublicContentMessage<MessageContent>
|
||||
|
||||
@PreviewFeature
|
||||
inline fun <T> Message.whenSignedMessage(block: (SignedMessage) -> T) = asSignedMessage()?.let(block)
|
||||
inline fun <T> AccessibleMessage.whenSignedMessage(block: (SignedMessage) -> T) = asSignedMessage()?.let(block)
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.asSignedMessage(): SignedMessage? = this as? SignedMessage
|
||||
inline fun AccessibleMessage.asSignedMessage(): SignedMessage? = this as? SignedMessage
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.requireSignedMessage(): SignedMessage = this as SignedMessage
|
||||
inline fun AccessibleMessage.requireSignedMessage(): SignedMessage = this as SignedMessage
|
||||
|
||||
@PreviewFeature
|
||||
inline fun <T> Message.whenSupergroupEventMessage(block: (SupergroupEventMessage<SupergroupEvent>) -> T) =
|
||||
inline fun <T> AccessibleMessage.whenSupergroupEventMessage(block: (SupergroupEventMessage<SupergroupEvent>) -> T) =
|
||||
asSupergroupEventMessage()?.let(block)
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.asSupergroupEventMessage(): SupergroupEventMessage<SupergroupEvent>? =
|
||||
inline fun AccessibleMessage.asSupergroupEventMessage(): SupergroupEventMessage<SupergroupEvent>? =
|
||||
this as? SupergroupEventMessage<SupergroupEvent>
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.requireSupergroupEventMessage(): SupergroupEventMessage<SupergroupEvent> =
|
||||
inline fun AccessibleMessage.requireSupergroupEventMessage(): SupergroupEventMessage<SupergroupEvent> =
|
||||
this as SupergroupEventMessage<SupergroupEvent>
|
||||
|
||||
@PreviewFeature
|
||||
inline fun <T> Message.whenUnknownMessageType(block: (UnknownMessageType) -> T) = asUnknownMessageType()?.let(block)
|
||||
inline fun <T> AccessibleMessage.whenUnknownMessageType(block: (UnknownMessageType) -> T) = asUnknownMessageType()?.let(block)
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.asUnknownMessageType(): UnknownMessageType? = this as? UnknownMessageType
|
||||
inline fun AccessibleMessage.asUnknownMessageType(): UnknownMessageType? = this as? UnknownMessageType
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.requireUnknownMessageType(): UnknownMessageType = this as UnknownMessageType
|
||||
inline fun AccessibleMessage.requireUnknownMessageType(): UnknownMessageType = this as UnknownMessageType
|
||||
|
||||
@PreviewFeature
|
||||
inline fun <T> Message.whenPossiblySentViaBotCommonMessage(block: (PossiblySentViaBotCommonMessage<MessageContent>) -> T) =
|
||||
inline fun <T> AccessibleMessage.whenPossiblySentViaBotCommonMessage(block: (PossiblySentViaBotCommonMessage<MessageContent>) -> T) =
|
||||
asPossiblySentViaBotCommonMessage()?.let(block)
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.asPossiblySentViaBotCommonMessage(): PossiblySentViaBotCommonMessage<MessageContent>? =
|
||||
inline fun AccessibleMessage.asPossiblySentViaBotCommonMessage(): PossiblySentViaBotCommonMessage<MessageContent>? =
|
||||
this as? PossiblySentViaBotCommonMessage<MessageContent>
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.requirePossiblySentViaBotCommonMessage(): PossiblySentViaBotCommonMessage<MessageContent> =
|
||||
inline fun AccessibleMessage.requirePossiblySentViaBotCommonMessage(): PossiblySentViaBotCommonMessage<MessageContent> =
|
||||
this as PossiblySentViaBotCommonMessage<MessageContent>
|
||||
|
||||
@PreviewFeature
|
||||
inline fun <T> Message.whenFromUserMessage(block: (FromUserMessage) -> T) = asFromUserMessage()?.let(block)
|
||||
inline fun <T> AccessibleMessage.whenFromUserMessage(block: (FromUserMessage) -> T) = asFromUserMessage()?.let(block)
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.asFromUserMessage(): FromUserMessage? = this as? FromUserMessage
|
||||
inline fun AccessibleMessage.asFromUserMessage(): FromUserMessage? = this as? FromUserMessage
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.requireFromUserMessage(): FromUserMessage = this as FromUserMessage
|
||||
inline fun AccessibleMessage.requireFromUserMessage(): FromUserMessage = this as FromUserMessage
|
||||
|
||||
@PreviewFeature
|
||||
inline fun <T> BotAction.whenFindLocationAction(block: (FindLocationAction) -> T) = asFindLocationAction()?.let(block)
|
||||
|
@ -260,6 +260,7 @@ import dev.inmo.tgbotapi.types.message.CommonSupergroupEventMessage
|
||||
import dev.inmo.tgbotapi.types.message.ForwardInfo
|
||||
import dev.inmo.tgbotapi.types.message.PassportMessage
|
||||
import dev.inmo.tgbotapi.types.message.PrivateEventMessage
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.AnonymousForumContentMessage
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.AnonymousGroupContentMessage
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ChannelContentMessage
|
||||
@ -275,6 +276,7 @@ import dev.inmo.tgbotapi.types.message.abstracts.FromChannelGroupContentMessage
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.FromUserMessage
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.GroupContentMessage
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.GroupEventMessage
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.InaccessibleMessage
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.PossiblyEditedMessage
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.PossiblyForwardedMessage
|
||||
@ -414,9 +416,13 @@ import dev.inmo.tgbotapi.types.polls.QuizPoll
|
||||
import dev.inmo.tgbotapi.types.polls.RegularPoll
|
||||
import dev.inmo.tgbotapi.types.polls.ScheduledCloseInfo
|
||||
import dev.inmo.tgbotapi.types.polls.UnknownPollType
|
||||
import dev.inmo.tgbotapi.types.queries.callback.AbstractMessageCallbackQuery
|
||||
import dev.inmo.tgbotapi.types.queries.callback.CallbackQuery
|
||||
import dev.inmo.tgbotapi.types.queries.callback.DataCallbackQuery
|
||||
import dev.inmo.tgbotapi.types.queries.callback.GameShortNameCallbackQuery
|
||||
import dev.inmo.tgbotapi.types.queries.callback.InaccessibleMessageCallbackQuery
|
||||
import dev.inmo.tgbotapi.types.queries.callback.InaccessibleMessageDataCallbackQuery
|
||||
import dev.inmo.tgbotapi.types.queries.callback.InaccessibleMessageGameShortNameCallbackQuery
|
||||
import dev.inmo.tgbotapi.types.queries.callback.InlineMessageIdCallbackQuery
|
||||
import dev.inmo.tgbotapi.types.queries.callback.InlineMessageIdDataCallbackQuery
|
||||
import dev.inmo.tgbotapi.types.queries.callback.InlineMessageIdGameShortNameCallbackQuery
|
||||
@ -841,6 +847,16 @@ public inline fun WithUser.pollAnswerOrThrow(): PollAnswer = this as
|
||||
public inline fun <T> WithUser.ifPollAnswer(block: (PollAnswer) -> T): T? = pollAnswerOrNull()
|
||||
?.let(block)
|
||||
|
||||
public inline fun WithUser.abstractMessageCallbackQueryOrNull(): AbstractMessageCallbackQuery? =
|
||||
this as? dev.inmo.tgbotapi.types.queries.callback.AbstractMessageCallbackQuery
|
||||
|
||||
public inline fun WithUser.abstractMessageCallbackQueryOrThrow(): AbstractMessageCallbackQuery =
|
||||
this as dev.inmo.tgbotapi.types.queries.callback.AbstractMessageCallbackQuery
|
||||
|
||||
public inline fun <T>
|
||||
WithUser.ifAbstractMessageCallbackQuery(block: (AbstractMessageCallbackQuery) -> T): T? =
|
||||
abstractMessageCallbackQueryOrNull() ?.let(block)
|
||||
|
||||
public inline fun WithUser.callbackQueryOrNull(): CallbackQuery? = this as?
|
||||
dev.inmo.tgbotapi.types.queries.callback.CallbackQuery
|
||||
|
||||
@ -878,6 +894,42 @@ public inline fun <T>
|
||||
WithUser.ifGameShortNameCallbackQuery(block: (GameShortNameCallbackQuery) -> T): T? =
|
||||
gameShortNameCallbackQueryOrNull() ?.let(block)
|
||||
|
||||
public inline fun WithUser.inaccessibleMessageCallbackQueryOrNull():
|
||||
InaccessibleMessageCallbackQuery? = this as?
|
||||
dev.inmo.tgbotapi.types.queries.callback.InaccessibleMessageCallbackQuery
|
||||
|
||||
public inline fun WithUser.inaccessibleMessageCallbackQueryOrThrow():
|
||||
InaccessibleMessageCallbackQuery = this as
|
||||
dev.inmo.tgbotapi.types.queries.callback.InaccessibleMessageCallbackQuery
|
||||
|
||||
public inline fun <T>
|
||||
WithUser.ifInaccessibleMessageCallbackQuery(block: (InaccessibleMessageCallbackQuery) -> T): T?
|
||||
= inaccessibleMessageCallbackQueryOrNull() ?.let(block)
|
||||
|
||||
public inline fun WithUser.inaccessibleMessageDataCallbackQueryOrNull():
|
||||
InaccessibleMessageDataCallbackQuery? = this as?
|
||||
dev.inmo.tgbotapi.types.queries.callback.InaccessibleMessageDataCallbackQuery
|
||||
|
||||
public inline fun WithUser.inaccessibleMessageDataCallbackQueryOrThrow():
|
||||
InaccessibleMessageDataCallbackQuery = this as
|
||||
dev.inmo.tgbotapi.types.queries.callback.InaccessibleMessageDataCallbackQuery
|
||||
|
||||
public inline fun <T>
|
||||
WithUser.ifInaccessibleMessageDataCallbackQuery(block: (InaccessibleMessageDataCallbackQuery) -> T):
|
||||
T? = inaccessibleMessageDataCallbackQueryOrNull() ?.let(block)
|
||||
|
||||
public inline fun WithUser.inaccessibleMessageGameShortNameCallbackQueryOrNull():
|
||||
InaccessibleMessageGameShortNameCallbackQuery? = this as?
|
||||
dev.inmo.tgbotapi.types.queries.callback.InaccessibleMessageGameShortNameCallbackQuery
|
||||
|
||||
public inline fun WithUser.inaccessibleMessageGameShortNameCallbackQueryOrThrow():
|
||||
InaccessibleMessageGameShortNameCallbackQuery = this as
|
||||
dev.inmo.tgbotapi.types.queries.callback.InaccessibleMessageGameShortNameCallbackQuery
|
||||
|
||||
public inline fun <T>
|
||||
WithUser.ifInaccessibleMessageGameShortNameCallbackQuery(block: (InaccessibleMessageGameShortNameCallbackQuery) -> T):
|
||||
T? = inaccessibleMessageGameShortNameCallbackQueryOrNull() ?.let(block)
|
||||
|
||||
public inline fun WithUser.inlineMessageIdCallbackQueryOrNull(): InlineMessageIdCallbackQuery? =
|
||||
this as? dev.inmo.tgbotapi.types.queries.callback.InlineMessageIdCallbackQuery
|
||||
|
||||
@ -3396,6 +3448,24 @@ public inline fun <T>
|
||||
Message.ifCommonForumContentMessage(block: (CommonForumContentMessage<MessageContent>) -> T): T?
|
||||
= commonForumContentMessageOrNull() ?.let(block)
|
||||
|
||||
public inline fun Message.accessibleMessageOrNull(): AccessibleMessage? = this as?
|
||||
dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||
|
||||
public inline fun Message.accessibleMessageOrThrow(): AccessibleMessage = this as
|
||||
dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||
|
||||
public inline fun <T> Message.ifAccessibleMessage(block: (AccessibleMessage) -> T): T? =
|
||||
accessibleMessageOrNull() ?.let(block)
|
||||
|
||||
public inline fun Message.inaccessibleMessageOrNull(): InaccessibleMessage? = this as?
|
||||
dev.inmo.tgbotapi.types.message.abstracts.InaccessibleMessage
|
||||
|
||||
public inline fun Message.inaccessibleMessageOrThrow(): InaccessibleMessage = this as
|
||||
dev.inmo.tgbotapi.types.message.abstracts.InaccessibleMessage
|
||||
|
||||
public inline fun <T> Message.ifInaccessibleMessage(block: (InaccessibleMessage) -> T): T? =
|
||||
inaccessibleMessageOrNull() ?.let(block)
|
||||
|
||||
public inline fun Message.unknownMessageTypeOrNull(): UnknownMessageType? = this as?
|
||||
dev.inmo.tgbotapi.types.message.abstracts.UnknownMessageType
|
||||
|
||||
|
@ -8,7 +8,7 @@ import dev.inmo.tgbotapi.types.MessageId
|
||||
import dev.inmo.tgbotapi.types.MessageThreadId
|
||||
import dev.inmo.tgbotapi.types.Username
|
||||
import dev.inmo.tgbotapi.types.chat.Chat
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||
import dev.inmo.tgbotapi.types.threadId
|
||||
import dev.inmo.tgbotapi.utils.extensions.threadIdOrNull
|
||||
|
||||
@ -32,43 +32,43 @@ inline fun WithPreviewChat.sameChat(chat: Chat) =
|
||||
* @return true in case if [this] message is placed in the same chat that [other]
|
||||
*/
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun WithPreviewChat.sameChat(other: Message) = sameChat(other.chat)
|
||||
inline fun WithPreviewChat.sameChat(other: AccessibleMessage) = sameChat(other.chat)
|
||||
|
||||
/**
|
||||
* @return true in case if [this] message is from the same chat (with id == [chatId]) and [this] [Message.messageId]
|
||||
* @return true in case if [this] message is from the same chat (with id == [chatId]) and [this] [AccessibleMessage.messageId]
|
||||
* equal [messageId] identifier
|
||||
*/
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun Message.sameMessage(
|
||||
inline fun AccessibleMessage.sameMessage(
|
||||
chatId: ChatIdentifier,
|
||||
messageId: MessageId
|
||||
) = sameChat(chatId) && this.messageId == messageId
|
||||
|
||||
/**
|
||||
* @return true in case if [this] message is from the same [chat] and [this] [Message.messageId] equal [messageId]
|
||||
* @return true in case if [this] message is from the same [chat] and [this] [AccessibleMessage.messageId] equal [messageId]
|
||||
* identifier
|
||||
*/
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun Message.sameMessage(
|
||||
inline fun AccessibleMessage.sameMessage(
|
||||
chat: Chat,
|
||||
messageId: MessageId
|
||||
) = sameChat(chat) && this.messageId == messageId
|
||||
|
||||
/**
|
||||
* @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
|
||||
* and have equal [AccessibleMessage.messageId] identifier
|
||||
*/
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun Message.sameMessage(other: Message) = sameMessage(other.chat, other.messageId)
|
||||
inline fun AccessibleMessage.sameMessage(other: AccessibleMessage) = sameMessage(other.chat, other.messageId)
|
||||
|
||||
/**
|
||||
* Thread is the same thing that topic
|
||||
*
|
||||
* @return true in case if [this] message is in the chat [chatId] and topic [threadId]. The same here means that these
|
||||
* messages from one chat and have equal [Message.threadIdOrNull] identifier
|
||||
* messages from one chat and have equal [AccessibleMessage.threadIdOrNull] identifier
|
||||
*/
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun Message.sameTopic(
|
||||
inline fun AccessibleMessage.sameTopic(
|
||||
chatId: ChatIdentifier,
|
||||
threadId: MessageThreadId? = chatId.threadId
|
||||
) = sameChat(chatId) && threadIdOrNull == threadId
|
||||
@ -77,10 +77,10 @@ inline fun Message.sameTopic(
|
||||
* Thread is the same thing that topic
|
||||
*
|
||||
* @return true in case if [this] message is in the chat [chatId] and topic [threadId]. The same here means that these
|
||||
* messages from one chat and have equal [Message.threadIdOrNull] identifier
|
||||
* messages from one chat and have equal [AccessibleMessage.threadIdOrNull] identifier
|
||||
*/
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun Message.sameThread(
|
||||
inline fun AccessibleMessage.sameThread(
|
||||
chatId: ChatIdentifier,
|
||||
threadId: MessageThreadId? = chatId.threadId
|
||||
) = sameTopic(chatId, threadId)
|
||||
@ -89,10 +89,10 @@ inline fun Message.sameThread(
|
||||
* Thread is the same thing that topic
|
||||
*
|
||||
* @return true in case if [this] message is from the [chat] and topic [threadId]. The same here means that these
|
||||
* messages from one chat and have equal [Message.threadIdOrNull] identifier
|
||||
* messages from one chat and have equal [AccessibleMessage.threadIdOrNull] identifier
|
||||
*/
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun Message.sameTopic(
|
||||
inline fun AccessibleMessage.sameTopic(
|
||||
chat: Chat,
|
||||
threadId: MessageThreadId? = chat.id.threadId
|
||||
) = sameTopic(chat.id, threadId)
|
||||
@ -101,10 +101,10 @@ inline fun Message.sameTopic(
|
||||
* Thread is the same thing that topic
|
||||
*
|
||||
* @return true in case if [this] message is from the [chat] and topic [threadId]. The same here means that these
|
||||
* messages from one chat and have equal [Message.threadIdOrNull] identifier
|
||||
* messages from one chat and have equal [AccessibleMessage.threadIdOrNull] identifier
|
||||
*/
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun Message.sameThread(
|
||||
inline fun AccessibleMessage.sameThread(
|
||||
chat: Chat,
|
||||
threadId: MessageThreadId? = chat.id.threadId
|
||||
) = sameThread(chat.id, threadId)
|
||||
@ -113,16 +113,16 @@ inline fun Message.sameThread(
|
||||
* Thread is the same thing that topic
|
||||
*
|
||||
* @return true in case if [this] message is from the same chat and topic as [other]. The same here means that these
|
||||
* messages from one chat and have equal [Message.threadIdOrNull] identifier
|
||||
* messages from one chat and have equal [AccessibleMessage.threadIdOrNull] identifier
|
||||
*/
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun Message.sameTopic(other: Message) = sameTopic(other.chat, other.threadIdOrNull)
|
||||
inline fun AccessibleMessage.sameTopic(other: AccessibleMessage) = sameTopic(other.chat, other.threadIdOrNull)
|
||||
|
||||
/**
|
||||
* Thread is the same thing that topic
|
||||
*
|
||||
* @return true in case if [this] message is in the same topic as the [other]. The same here means that these messages
|
||||
* from one chat and have equal [Message.threadIdOrNull] identifier
|
||||
* from one chat and have equal [AccessibleMessage.threadIdOrNull] identifier
|
||||
*/
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun Message.sameThread(other: Message) = sameTopic(other)
|
||||
inline fun AccessibleMessage.sameThread(other: AccessibleMessage) = sameTopic(other)
|
||||
|
@ -18,9 +18,8 @@ import dev.inmo.tgbotapi.utils.PreviewFeature
|
||||
|
||||
fun CallbackQuery.sourceChat() = when (this) {
|
||||
is InlineMessageIdDataCallbackQuery -> null
|
||||
is MessageDataCallbackQuery -> message.chat
|
||||
is AbstractMessageCallbackQuery -> message.chat
|
||||
is InlineMessageIdGameShortNameCallbackQuery -> null
|
||||
is MessageGameShortNameCallbackQuery -> message.chat
|
||||
is UnknownCallbackQueryType -> null
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,7 @@ import dev.inmo.tgbotapi.types.location.Location
|
||||
import dev.inmo.tgbotapi.types.message.ChatEvents.*
|
||||
import dev.inmo.tgbotapi.types.message.ChatEvents.voice.*
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ConnectedFromChannelGroupContentMessage
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||
import dev.inmo.tgbotapi.types.message.content.TextContent
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
@ -22,58 +23,58 @@ import dev.inmo.tgbotapi.types.venue.Venue
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
|
||||
@RiskFeature(RawFieldsUsageWarning)
|
||||
inline val Message.from: User?
|
||||
inline val AccessibleMessage.from: User?
|
||||
get() = asFromUser() ?.from
|
||||
@RiskFeature(RawFieldsUsageWarning)
|
||||
inline val Message.sender_chat: PublicChat?
|
||||
inline val AccessibleMessage.sender_chat: PublicChat?
|
||||
get() = asFromChannelGroupContentMessage() ?.senderChat
|
||||
@RiskFeature(RawFieldsUsageWarning)
|
||||
inline val Message.forward_from: User?
|
||||
inline val AccessibleMessage.forward_from: User?
|
||||
get() = asPossiblyForwardedMessage() ?.forwardInfo ?.asUserForwardInfo() ?.from
|
||||
@RiskFeature(RawFieldsUsageWarning)
|
||||
inline val Message.forward_from_chat: Chat?
|
||||
inline val AccessibleMessage.forward_from_chat: Chat?
|
||||
get() = asPossiblyForwardedMessage() ?.forwardInfo ?.asForwardFromPublicChatInfo() ?.chat
|
||||
@RiskFeature(RawFieldsUsageWarning)
|
||||
inline val Message.forward_from_message_id: MessageId?
|
||||
inline val AccessibleMessage.forward_from_message_id: MessageId?
|
||||
get() = asPossiblyForwardedMessage() ?.forwardInfo ?.fromChannelOrNull() ?.messageId
|
||||
@RiskFeature(RawFieldsUsageWarning)
|
||||
inline val Message.forward_signature: ForwardSignature?
|
||||
inline val AccessibleMessage.forward_signature: ForwardSignature?
|
||||
get() = asPossiblyForwardedMessage() ?.forwardInfo ?.fromChannelOrNull() ?.signature
|
||||
@RiskFeature(RawFieldsUsageWarning)
|
||||
inline val Message.forward_sender_name: ForwardSenderName?
|
||||
inline val AccessibleMessage.forward_sender_name: ForwardSenderName?
|
||||
get() = asPossiblyForwardedMessage() ?.forwardInfo ?.asAnonymousForwardInfo() ?.senderName
|
||||
@RiskFeature(RawFieldsUsageWarning)
|
||||
inline val Message.forward_date: TelegramDate?
|
||||
inline val AccessibleMessage.forward_date: TelegramDate?
|
||||
get() = asPossiblyForwardedMessage() ?.forwardInfo ?.dateOfOriginal
|
||||
@RiskFeature(RawFieldsUsageWarning)
|
||||
inline val Message.is_automatic_forward: Boolean?
|
||||
inline val AccessibleMessage.is_automatic_forward: Boolean?
|
||||
get() = this is ConnectedFromChannelGroupContentMessage<*>
|
||||
@RiskFeature(RawFieldsUsageWarning)
|
||||
inline val Message.reply_to_message: Message?
|
||||
inline val AccessibleMessage.reply_to_message: AccessibleMessage?
|
||||
get() = asPossiblyReplyMessage() ?.replyTo
|
||||
@RiskFeature(RawFieldsUsageWarning)
|
||||
inline val Message.via_bot: CommonBot?
|
||||
inline val AccessibleMessage.via_bot: CommonBot?
|
||||
get() = asPossiblySentViaBotCommonMessage() ?.senderBot
|
||||
@RiskFeature(RawFieldsUsageWarning)
|
||||
inline val Message.edit_date: TelegramDate?
|
||||
inline val AccessibleMessage.edit_date: TelegramDate?
|
||||
get() = asPossiblyEditedMessage() ?.editDate ?.toTelegramDate()
|
||||
@RiskFeature(RawFieldsUsageWarning)
|
||||
inline val Message.has_protected_content: Boolean?
|
||||
inline val AccessibleMessage.has_protected_content: Boolean?
|
||||
get() = asContentMessage() ?.hasProtectedContent
|
||||
@RiskFeature(RawFieldsUsageWarning)
|
||||
inline val Message.media_group_id: MediaGroupIdentifier?
|
||||
inline val AccessibleMessage.media_group_id: MediaGroupIdentifier?
|
||||
get() = asMediaGroupMessage() ?.mediaGroupId
|
||||
@RiskFeature(RawFieldsUsageWarning)
|
||||
inline val Message.author_signature: AuthorSignature?
|
||||
inline val AccessibleMessage.author_signature: AuthorSignature?
|
||||
get() = asSignedMessage() ?.authorSignature
|
||||
@RiskFeature(RawFieldsUsageWarning)
|
||||
inline val Message.text: String?
|
||||
inline val AccessibleMessage.text: String?
|
||||
get() = asContentMessage() ?.content ?.asTextContent() ?.text
|
||||
@RiskFeature(RawFieldsUsageWarning)
|
||||
inline val Message.entities: TextSourcesList?
|
||||
inline val AccessibleMessage.entities: TextSourcesList?
|
||||
get() = asContentMessage() ?.content ?.asTextContent() ?.textSources
|
||||
@RiskFeature(RawFieldsUsageWarning)
|
||||
inline val Message.caption: String?
|
||||
inline val AccessibleMessage.caption: String?
|
||||
get() = whenContentMessage {
|
||||
if (it.content !is TextContent) {
|
||||
it.content.asTextedInput() ?.text
|
||||
@ -82,7 +83,7 @@ inline val Message.caption: String?
|
||||
}
|
||||
}
|
||||
@RiskFeature(RawFieldsUsageWarning)
|
||||
inline val Message.caption_entities: TextSourcesList?
|
||||
inline val AccessibleMessage.caption_entities: TextSourcesList?
|
||||
get() = whenContentMessage {
|
||||
if (it.content !is TextContent) {
|
||||
it.content.asTextedInput() ?.textSources
|
||||
@ -91,117 +92,117 @@ inline val Message.caption_entities: TextSourcesList?
|
||||
}
|
||||
}
|
||||
@RiskFeature(RawFieldsUsageWarning)
|
||||
inline val Message.audio: AudioFile?
|
||||
inline val AccessibleMessage.audio: AudioFile?
|
||||
get() = asContentMessage() ?.content ?.asAudioContent() ?.media
|
||||
@RiskFeature(RawFieldsUsageWarning)
|
||||
inline val Message.document: DocumentFile?
|
||||
inline val AccessibleMessage.document: DocumentFile?
|
||||
get() = asContentMessage() ?.content ?.asDocumentContent() ?.media
|
||||
@RiskFeature(RawFieldsUsageWarning)
|
||||
inline val Message.animation: AnimationFile?
|
||||
inline val AccessibleMessage.animation: AnimationFile?
|
||||
get() = asContentMessage() ?.content ?.asAnimationContent() ?.media
|
||||
@RiskFeature(RawFieldsUsageWarning)
|
||||
inline val Message.game: Game?
|
||||
inline val AccessibleMessage.game: Game?
|
||||
get() = asContentMessage() ?.content ?.asGameContent() ?.game
|
||||
@RiskFeature(RawFieldsUsageWarning)
|
||||
inline val Message.photo: Photo?
|
||||
inline val AccessibleMessage.photo: Photo?
|
||||
get() = asContentMessage() ?.content ?.asPhotoContent() ?.mediaCollection
|
||||
@RiskFeature(RawFieldsUsageWarning)
|
||||
inline val Message.sticker: Sticker?
|
||||
inline val AccessibleMessage.sticker: Sticker?
|
||||
get() = asContentMessage() ?.content ?.asStickerContent() ?.media
|
||||
@RiskFeature(RawFieldsUsageWarning)
|
||||
inline val Message.video: VideoFile?
|
||||
inline val AccessibleMessage.video: VideoFile?
|
||||
get() = asContentMessage() ?.content ?.asVideoContent() ?.media
|
||||
@RiskFeature(RawFieldsUsageWarning)
|
||||
inline val Message.voice: VoiceFile?
|
||||
inline val AccessibleMessage.voice: VoiceFile?
|
||||
get() = asContentMessage() ?.content ?.asVoiceContent() ?.media
|
||||
@RiskFeature(RawFieldsUsageWarning)
|
||||
inline val Message.video_note: VideoNoteFile?
|
||||
inline val AccessibleMessage.video_note: VideoNoteFile?
|
||||
get() = asContentMessage() ?.content ?.asVideoNoteContent() ?.media
|
||||
@RiskFeature(RawFieldsUsageWarning)
|
||||
inline val Message.contact: Contact?
|
||||
inline val AccessibleMessage.contact: Contact?
|
||||
get() = asContentMessage() ?.content ?.asContactContent() ?.contact
|
||||
@RiskFeature(RawFieldsUsageWarning)
|
||||
inline val Message.location: Location?
|
||||
inline val AccessibleMessage.location: Location?
|
||||
get() = asContentMessage() ?.content ?.asLocationContent() ?.location
|
||||
@RiskFeature(RawFieldsUsageWarning)
|
||||
inline val Message.venue: Venue?
|
||||
inline val AccessibleMessage.venue: Venue?
|
||||
get() = asContentMessage() ?.content ?.asVenueContent() ?.venue
|
||||
@RiskFeature(RawFieldsUsageWarning)
|
||||
inline val Message.poll: Poll?
|
||||
inline val AccessibleMessage.poll: Poll?
|
||||
get() = asContentMessage() ?.content ?.asPollContent() ?.poll
|
||||
@RiskFeature(RawFieldsUsageWarning)
|
||||
inline val Message.invoice: Invoice?
|
||||
inline val AccessibleMessage.invoice: Invoice?
|
||||
get() = asContentMessage() ?.content ?.asInvoiceContent() ?.invoice
|
||||
@RiskFeature(RawFieldsUsageWarning)
|
||||
inline val Message.dice: Dice?
|
||||
inline val AccessibleMessage.dice: Dice?
|
||||
get() = asContentMessage() ?.content ?.asDiceContent() ?.dice
|
||||
@RiskFeature(RawFieldsUsageWarning)
|
||||
inline val Message.new_chat_members: List<User>?
|
||||
inline val AccessibleMessage.new_chat_members: List<User>?
|
||||
get() = asChatEventMessage() ?.chatEvent ?.asNewChatMembers() ?.members
|
||||
@RiskFeature(RawFieldsUsageWarning)
|
||||
inline val Message.left_chat_member: User?
|
||||
inline val AccessibleMessage.left_chat_member: User?
|
||||
get() = asChatEventMessage() ?.chatEvent ?.asLeftChatMember() ?.user
|
||||
@RiskFeature(RawFieldsUsageWarning)
|
||||
inline val Message.new_chat_title: String?
|
||||
inline val AccessibleMessage.new_chat_title: String?
|
||||
get() = asChatEventMessage() ?.chatEvent ?.asNewChatTitle() ?.title
|
||||
@RiskFeature(RawFieldsUsageWarning)
|
||||
inline val Message.new_chat_photo: Photo?
|
||||
inline val AccessibleMessage.new_chat_photo: Photo?
|
||||
get() = asChatEventMessage() ?.chatEvent ?.asNewChatPhoto() ?.photo
|
||||
@RiskFeature(RawFieldsUsageWarning)
|
||||
inline val Message.delete_chat_photo: Boolean
|
||||
inline val AccessibleMessage.delete_chat_photo: Boolean
|
||||
get() = asChatEventMessage() ?.chatEvent is DeleteChatPhoto
|
||||
@RiskFeature(RawFieldsUsageWarning)
|
||||
inline val Message.group_chat_created: Boolean
|
||||
inline val AccessibleMessage.group_chat_created: Boolean
|
||||
get() = asChatEventMessage() ?.chatEvent is GroupChatCreated
|
||||
@RiskFeature(RawFieldsUsageWarning)
|
||||
inline val Message.supergroup_chat_created: Boolean
|
||||
inline val AccessibleMessage.supergroup_chat_created: Boolean
|
||||
get() = asChatEventMessage() ?.chatEvent is SupergroupChatCreated
|
||||
@RiskFeature(RawFieldsUsageWarning)
|
||||
inline val Message.channel_chat_created: Boolean
|
||||
inline val AccessibleMessage.channel_chat_created: Boolean
|
||||
get() = asChatEventMessage() ?.chatEvent is ChannelChatCreated
|
||||
@RiskFeature(RawFieldsUsageWarning)
|
||||
inline val Message.migrate_to_chat_id: IdChatIdentifier?
|
||||
inline val AccessibleMessage.migrate_to_chat_id: IdChatIdentifier?
|
||||
get() = asChatEventMessage() ?.chatEvent ?.asGroupChatCreated() ?.migratedTo
|
||||
@RiskFeature(RawFieldsUsageWarning)
|
||||
inline val Message.migrate_from_chat_id: IdChatIdentifier?
|
||||
inline val AccessibleMessage.migrate_from_chat_id: IdChatIdentifier?
|
||||
get() = asChatEventMessage() ?.chatEvent ?.let {
|
||||
it ?.asSupergroupChatCreated() ?.migratedFrom ?: it ?.asMigratedToSupergroup() ?.migratedFrom
|
||||
}
|
||||
@RiskFeature(RawFieldsUsageWarning)
|
||||
inline val Message.pinned_message: Message?
|
||||
inline val AccessibleMessage.pinned_message: Message?
|
||||
get() = asChatEventMessage() ?.chatEvent ?.asPinnedMessage() ?.message
|
||||
@RiskFeature(RawFieldsUsageWarning)
|
||||
inline val Message.successful_payment: SuccessfulPayment?
|
||||
inline val AccessibleMessage.successful_payment: SuccessfulPayment?
|
||||
get() = asChatEventMessage() ?.chatEvent ?.asSuccessfulPaymentEvent() ?.payment
|
||||
|
||||
@RiskFeature(RawFieldsUsageWarning)
|
||||
inline val Message.video_chat_scheduled: VideoChatScheduled?
|
||||
inline val AccessibleMessage.video_chat_scheduled: VideoChatScheduled?
|
||||
get() = asChatEventMessage() ?.chatEvent ?.asVideoChatScheduled()
|
||||
@RiskFeature(RawFieldsUsageWarning)
|
||||
inline val Message.video_chat_started: VideoChatStarted?
|
||||
inline val AccessibleMessage.video_chat_started: VideoChatStarted?
|
||||
get() = asChatEventMessage() ?.chatEvent ?.asVideoChatStarted()
|
||||
@RiskFeature(RawFieldsUsageWarning)
|
||||
inline val Message.video_chat_ended: VideoChatEnded?
|
||||
inline val AccessibleMessage.video_chat_ended: VideoChatEnded?
|
||||
get() = asChatEventMessage() ?.chatEvent ?.asVideoChatEnded()
|
||||
@RiskFeature(RawFieldsUsageWarning)
|
||||
inline val Message.video_chat_participants_invited: VideoChatParticipantsInvited?
|
||||
inline val AccessibleMessage.video_chat_participants_invited: VideoChatParticipantsInvited?
|
||||
get() = asChatEventMessage() ?.chatEvent ?.asVideoChatParticipantsInvited()
|
||||
|
||||
@RiskFeature(RawFieldsUsageWarning)
|
||||
inline val Message.message_auto_delete_timer_changed: MessageAutoDeleteTimerChanged?
|
||||
inline val AccessibleMessage.message_auto_delete_timer_changed: MessageAutoDeleteTimerChanged?
|
||||
get() = asChatEventMessage() ?.chatEvent ?.asMessageAutoDeleteTimerChanged()
|
||||
|
||||
@RiskFeature(RawFieldsUsageWarning)
|
||||
inline val Message.connected_website: String?
|
||||
inline val AccessibleMessage.connected_website: String?
|
||||
get() = asChatEventMessage() ?.chatEvent ?.asUserLoggedIn() ?.domain
|
||||
@RiskFeature(RawFieldsUsageWarning)
|
||||
inline val Message.proximity_alert_triggered: ProximityAlertTriggered?
|
||||
inline val AccessibleMessage.proximity_alert_triggered: ProximityAlertTriggered?
|
||||
get() = asChatEventMessage() ?.chatEvent ?.asProximityAlertTriggered()
|
||||
|
||||
@RiskFeature(RawFieldsUsageWarning)
|
||||
inline val Message.passport_data: PassportData?
|
||||
inline val AccessibleMessage.passport_data: PassportData?
|
||||
get() = asPassportMessage() ?.passportData
|
||||
|
||||
@RiskFeature(RawFieldsUsageWarning)
|
||||
inline val Message.reply_markup: InlineKeyboardMarkup?
|
||||
inline val AccessibleMessage.reply_markup: InlineKeyboardMarkup?
|
||||
get() = asCommonMessage() ?.replyMarkup
|
||||
|
@ -2,7 +2,7 @@ package dev.inmo.tgbotapi.extensions.utils.formatting
|
||||
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.chat.*
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||
import dev.inmo.tgbotapi.types.message.textsources.link
|
||||
import io.ktor.http.encodeURLQueryComponent
|
||||
|
||||
@ -69,7 +69,7 @@ fun makeLinkToMessage(
|
||||
): String = makeLinkToMessage(chatId.chatId, messageId, chatId.threadId)
|
||||
|
||||
/**
|
||||
* Link which can be used as by any user to get access to [Message]. Returns null in case when there are no
|
||||
* Link which can be used as by any user to get access to [AccessibleMessage]. Returns null in case when there are no
|
||||
* known way to build link (for [PrivateChat]s, for example)
|
||||
*/
|
||||
fun makeLinkToMessage(
|
||||
@ -88,7 +88,7 @@ fun makeLinkToMessage(
|
||||
/**
|
||||
* @see makeLinkToMessage
|
||||
*/
|
||||
val Message.messageLink: String?
|
||||
val AccessibleMessage.messageLink: String?
|
||||
get() = makeLinkToMessage(
|
||||
chat,
|
||||
messageId
|
||||
|
@ -2,7 +2,7 @@ package dev.inmo.tgbotapi.extensions.utils.updates
|
||||
|
||||
import dev.inmo.tgbotapi.extensions.utils.*
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.CommonMessage
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||
import dev.inmo.tgbotapi.types.message.content.TextContent
|
||||
import dev.inmo.tgbotapi.types.message.textsources.BotCommandTextSource
|
||||
import dev.inmo.tgbotapi.utils.extensions.threadIdOrNull
|
||||
@ -58,10 +58,10 @@ fun CommonMessage<*>.hasNoCommands(): Boolean = !this.hasCommands()
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @return true if this [Message] is from forum ([threadIdOrNull] is not null). False otherwise.
|
||||
* @return true if this [AccessibleMessage] is from forum ([threadIdOrNull] is not null). False otherwise.
|
||||
* @see notForumMessage
|
||||
*/
|
||||
fun Message.forumMessage(): Boolean = threadIdOrNull != null
|
||||
fun AccessibleMessage.forumMessage(): Boolean = threadIdOrNull != null
|
||||
|
||||
/**
|
||||
* A predicate to test that message has not been sent in the forum.
|
||||
@ -76,7 +76,7 @@ fun Message.forumMessage(): Boolean = threadIdOrNull != null
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @return true if this [Message] is not from forum ([threadIdOrNull] is not null). False otherwise.
|
||||
* @return true if this [AccessibleMessage] is not from forum ([threadIdOrNull] is not null). False otherwise.
|
||||
* @see forumMessage
|
||||
*/
|
||||
fun Message.notForumMessage(): Boolean = !forumMessage()
|
||||
fun AccessibleMessage.notForumMessage(): Boolean = !forumMessage()
|
||||
|
Loading…
Reference in New Issue
Block a user