update dependencies

This commit is contained in:
InsanusMokrassar 2021-10-01 16:40:04 +06:00
parent 40bd8d0987
commit 5b98c5f821
44 changed files with 12 additions and 1987 deletions

View File

@ -2,6 +2,14 @@
## 0.36.0
**ALL PREVIOUS DEPRECATIONS HAVE BEEN REMOVED**
* `Common`:
* `Version`:
* `Serialization`: `1.2.2` -> `1.3.0`
* `Ktor`: `1.6.3` -> `1.6.4`
* `MicroUtils`: `0.5.28` -> `0.5.31`
## 0.35.9
* `Common`:

View File

@ -7,10 +7,10 @@ kotlin.incremental.js=true
kotlin_version=1.5.31
kotlin_coroutines_version=1.5.2
kotlin_serialisation_runtime_version=1.2.2
kotlin_serialisation_runtime_version=1.3.0
klock_version=2.4.3
uuid_version=0.3.1
ktor_version=1.6.3
ktor_version=1.6.4
micro_utils_version=0.5.31

View File

@ -1,79 +0,0 @@
package dev.inmo.tgbotapi.CommonAbstracts
import dev.inmo.tgbotapi.types.MessageEntity.textsources.*
import dev.inmo.tgbotapi.types.MessageEntity.textsources.MultilevelTextSource
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
import dev.inmo.tgbotapi.types.MessageEntity.textsources.separateForCaption
import dev.inmo.tgbotapi.types.MessageEntity.textsources.separateForMessage
import dev.inmo.tgbotapi.types.MessageEntity.textsources.separateForText
import dev.inmo.tgbotapi.types.captionLength
import dev.inmo.tgbotapi.types.textLength
import dev.inmo.tgbotapi.utils.extensions.makeString
const val DirectInvocationOfTextSourceConstructor =
"It is strongly not recommended to use constructors directly instead of factory methods"
@Deprecated(
"Replaced",
ReplaceWith("TextSourcesList", "dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList")
)
typealias TextSourcesList = TextSourcesList
@Deprecated("Replaced", ReplaceWith("TextSource", "dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource"))
typealias TextSource = TextSource
@Suppress("NOTHING_TO_INLINE")
@Deprecated("Replaced", ReplaceWith("plus", "dev.inmo.tgbotapi.types.MessageEntity.textsources.plus"))
inline operator fun TextSource.plus(other: TextSource) =
listOf(this, other)
@Suppress("NOTHING_TO_INLINE")
@Deprecated("Replaced", ReplaceWith("plus", "dev.inmo.tgbotapi.types.MessageEntity.textsources.plus"))
inline operator fun TextSource.plus(other: List<TextSource>) =
listOf(this) + other
@Suppress("NOTHING_TO_INLINE")
@Deprecated("Replaced", ReplaceWith("plus", "dev.inmo.tgbotapi.types.MessageEntity.textsources.plus"))
inline operator fun TextSource.plus(text: String) =
listOf(this, regular(text))
@Suppress("NOTHING_TO_INLINE")
@Deprecated("Replaced", ReplaceWith("plus", "dev.inmo.tgbotapi.types.MessageEntity.textsources.plus"))
inline operator fun List<TextSource>.plus(text: String) = this + regular(text)
@Deprecated(
"Replaced",
ReplaceWith("MultilevelTextSource", "dev.inmo.tgbotapi.types.MessageEntity.textsources.MultilevelTextSource")
)
typealias MultilevelTextSource = MultilevelTextSource
@Deprecated("Replaced", ReplaceWith("makeString()", "dev.inmo.tgbotapi.utils.extensions.makeString"))
fun List<TextSource>.makeString() = makeString()
@Deprecated(
"Replaced",
ReplaceWith("separateForMessage", "dev.inmo.tgbotapi.types.MessageEntity.textsources.separateForMessage")
)
fun List<TextSource>.separateForMessage(limit: IntRange, numberOfParts: Int? = null) =
separateForMessage(limit, numberOfParts)
/**
* This method will prepare [TextSource]s list for messages. Remember, that first part will be separated with
* [captionLength] and all others with
*/
@Deprecated(
"Replaced",
ReplaceWith("separateForCaption", "dev.inmo.tgbotapi.types.MessageEntity.textsources.separateForCaption")
)
fun List<TextSource>.separateForCaption() = separateForCaption()
/**
* This method will prepare [TextSource]s list for messages with [textLength]
*/
@Suppress("NOTHING_TO_INLINE")
@Deprecated(
"Replaced",
ReplaceWith("separateForText", "dev.inmo.tgbotapi.types.MessageEntity.textsources.separateForText")
)
inline fun List<TextSource>.separateForText() = separateForText()

View File

@ -35,7 +35,4 @@ class MultipartRequestCallFactory : AbstractRequestCallFactory() {
}
)
}
@Deprecated("Use class MultipartRequestCallFactory() constructor call instead of just MultipartRequestCallFactory")
companion object : KtorCallFactory by MultipartRequestCallFactory()
}

View File

@ -20,7 +20,4 @@ class SimpleRequestCallFactory : AbstractRequestCallFactory() {
ContentType.Application.Json
)
}
@Deprecated("Use class SimpleRequestCallFactory() constructor call instead of just SimpleRequestCallFactory")
companion object : KtorCallFactory by SimpleRequestCallFactory()
}

View File

@ -64,21 +64,11 @@ data class MultipartFile (
val filename: String = file.storageFileInfo.fileName
) : InputFile() {
override val fileId: String = file.storageFileInfo.generateCustomName()
@Deprecated("This constructor is redundant. Use constructor without mime type")
constructor(file: StorageFile, mimeType: String, filename: String): this(file, filename)
}
@Suppress("NOTHING_TO_INLINE", "unused")
inline fun StorageFile.asMultipartFile() = MultipartFile(this)
@Deprecated("This method is redundant. Use asMultipartFile without mime type")
@Suppress("NOTHING_TO_INLINE", "unused")
inline fun ByteArray.asMultipartFile(
fileName: String,
mimeType: MimeType
) = MultipartFile(asStorageFile(fileName))
@Suppress("NOTHING_TO_INLINE", "unused")
suspend inline fun ByteReadChannel.asMultipartFile(
fileName: String

View File

@ -18,6 +18,3 @@ data class GetChatMemberCount(
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
}
@Deprecated("Renamed", ReplaceWith("GetChatMemberCount", "dev.inmo.tgbotapi.requests.chat.get.GetChatMemberCount"))
typealias GetChatMembersCount = GetChatMemberCount

View File

@ -23,6 +23,3 @@ data class BanChatMember(
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
}
@Deprecated("Renamed", ReplaceWith("BanChatMember", "dev.inmo.tgbotapi.requests.chat.members.BanChatMember"))
typealias KickChatMember = BanChatMember

View File

@ -10,6 +10,3 @@ data class LeftChatMemberImpl(@SerialName(userField) override val user: User) :
@Required
private val type: String = "left"
}
@Deprecated("Renamed", ReplaceWith("LeftChatMemberImpl", "dev.inmo.tgbotapi.types.ChatMember.LeftChatMemberImpl"))
typealias LeftChatMember = LeftChatMemberImpl

View File

@ -10,6 +10,3 @@ data class MemberChatMemberImpl(@SerialName(userField) override val user: User)
@Required
private val type: String = "member"
}
@Deprecated("Renamed", ReplaceWith("MemberChatMember", "dev.inmo.tgbotapi.types.ChatMember.MemberChatMemberImpl"))
typealias MemberChatMember = MemberChatMemberImpl

View File

@ -1,6 +0,0 @@
package dev.inmo.tgbotapi.types.InlineQueries.abstracts
import dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult.ChosenInlineResult
@Deprecated("Replaced", ReplaceWith("ChosenInlineResult", "dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult.ChosenInlineResult"))
typealias ChosenInlineResult = ChosenInlineResult

View File

@ -1,6 +0,0 @@
package dev.inmo.tgbotapi.types.InlineQueries.abstracts
import dev.inmo.tgbotapi.types.InlineQueries.query.InlineQuery
@Deprecated("Replaced", ReplaceWith("InlineQuery", "dev.inmo.tgbotapi.types.InlineQueries.query.InlineQuery"))
typealias InlineQuery = InlineQuery

View File

@ -1,6 +0,0 @@
package dev.inmo.tgbotapi.types.InlineQueries.abstracts
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent
@Deprecated("Replaced", ReplaceWith("InputMessageContent", "dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent"))
typealias InputMessageContent = InputMessageContent

View File

@ -2,7 +2,6 @@ package dev.inmo.tgbotapi.types.MessageEntity.textsources
import dev.inmo.tgbotapi.types.captionLength
import dev.inmo.tgbotapi.types.textLength
import dev.inmo.tgbotapi.utils.extensions.makeString
import kotlinx.serialization.Serializable
const val DirectInvocationOfTextSourceConstructor = "It is strongly not recommended to use constructors directly instead of factory methods"
@ -43,8 +42,6 @@ sealed interface MultilevelTextSource : TextSource {
}
}
@Deprecated("Replaced", ReplaceWith("makeString()", "dev.inmo.tgbotapi.utils.extensions.makeString"))
fun TextSourcesList.makeString() = makeString(null)
fun List<TextSource>.separateForMessage(limit: IntRange, numberOfParts: Int? = null): List<List<TextSource>> {
if (isEmpty()) {
return emptyList()

View File

@ -26,6 +26,3 @@ data class ReplyForce(
}
}
}
@Deprecated("Renamed", ReplaceWith("ReplyForce", "dev.inmo.tgbotapi.types.buttons.ReplyForce"))
typealias ForceReply = ReplyForce

View File

@ -24,8 +24,5 @@ data class PathedFile(
}
}
@Deprecated("Use fileName property instead", ReplaceWith("fileName"))
val PathedFile.filename: FileName
get() = filePath.filenameFromUrl
fun TelegramAPIUrlsKeeper.resolveFileURL(file: PathedFile): String = "$fileBaseUrl/${file.filePath}"
fun PathedFile.fullUrl(keeper: TelegramAPIUrlsKeeper): String = keeper.resolveFileURL(this)

View File

@ -32,61 +32,6 @@ interface FlowsUpdatesFilter : UpdatesFilter {
val chatMemberUpdatesFlow: Flow<CommonChatMemberUpdatedUpdate>
val myChatMemberUpdatesFlow: Flow<MyChatMemberUpdatedUpdate>
val unknownUpdatesFlow: Flow<UnknownUpdate>
@Deprecated("Renamed", ReplaceWith("messagesFlow"))
val messageFlow: Flow<MessageUpdate>
get() = messagesFlow
@Deprecated("Renamed", ReplaceWith("messageMediaGroupsFlow"))
val messageMediaGroupFlow: Flow<MessageMediaGroupUpdate>
get() = messageMediaGroupsFlow
@Deprecated("Renamed", ReplaceWith("editedMessagesFlow"))
val editedMessageFlow: Flow<EditMessageUpdate>
get() = editedMessagesFlow
@Deprecated("Renamed", ReplaceWith("editedMessageMediaGroupsFlow"))
val editedMessageMediaGroupFlow: Flow<EditMessageMediaGroupUpdate>
get() = editedMessageMediaGroupsFlow
@Deprecated("Renamed", ReplaceWith("channelPostsFlow"))
val channelPostFlow: Flow<ChannelPostUpdate>
get() = channelPostsFlow
@Deprecated("Renamed", ReplaceWith("channelPostMediaGroupsFlow"))
val channelPostMediaGroupFlow: Flow<ChannelPostMediaGroupUpdate>
get() = channelPostMediaGroupsFlow
@Deprecated("Renamed", ReplaceWith("editedChannelPostsFlow"))
val editedChannelPostFlow: Flow<EditChannelPostUpdate>
get() = editedChannelPostsFlow
@Deprecated("Renamed", ReplaceWith("editedChannelPostMediaGroupsFlow"))
val editedChannelPostMediaGroupFlow: Flow<EditChannelPostMediaGroupUpdate>
get() = editedChannelPostMediaGroupsFlow
@Deprecated("Renamed", ReplaceWith("chosenInlineResultsFlow"))
val chosenInlineResultFlow: Flow<ChosenInlineResultUpdate>
get() = chosenInlineResultsFlow
@Deprecated("Renamed", ReplaceWith("inlineQueriesFlow"))
val inlineQueryFlow: Flow<InlineQueryUpdate>
get() = inlineQueriesFlow
@Deprecated("Renamed", ReplaceWith("callbackQueriesFlow"))
val callbackQueryFlow: Flow<CallbackQueryUpdate>
get() = callbackQueriesFlow
@Deprecated("Renamed", ReplaceWith("shippingQueriesFlow"))
val shippingQueryFlow: Flow<ShippingQueryUpdate>
get() = shippingQueriesFlow
@Deprecated("Renamed", ReplaceWith("preCheckoutQueriesFlow"))
val preCheckoutQueryFlow: Flow<PreCheckoutQueryUpdate>
get() = preCheckoutQueriesFlow
@Deprecated("Renamed", ReplaceWith("pollsFlow"))
val pollFlow: Flow<PollUpdate>
get() = pollsFlow
@Deprecated("Renamed", ReplaceWith("pollAnswersFlow"))
val pollAnswerFlow: Flow<PollAnswerUpdate>
get() = pollAnswersFlow
@Deprecated("Renamed", ReplaceWith("chatMemberUpdatesFlow"))
val chatMemberUpdatedFlow: Flow<CommonChatMemberUpdatedUpdate>
get() = chatMemberUpdatesFlow
@Deprecated("Renamed", ReplaceWith("myChatMemberUpdatesFlow"))
val myChatMemberUpdatedFlow: Flow<MyChatMemberUpdatedUpdate>
get() = myChatMemberUpdatesFlow
@Deprecated("Renamed", ReplaceWith("unknownUpdatesFlow"))
val unknownUpdateTypeFlow: Flow<UnknownUpdate>
get() = unknownUpdatesFlow
}
/**

View File

@ -16,12 +16,6 @@ import kotlinx.serialization.Serializable
data class StorageFileInfo(
val fileName: String
) {
@Deprecated("This constructor is redundant. Use constructor without mime type")
constructor(
contentType: String,
fileName: String
): this(fileName)
/**
* This methods is required for random generation of name for keeping warranties about unique file name
*/
@ -45,18 +39,6 @@ data class StorageFile(
get() = inputSource()
}
@Deprecated("This constructor is redundant. Use constructor without mime type")
@Suppress("NOTHING_TO_INLINE")
inline fun StorageFile(
fileName: String,
bytes: ByteArray,
mimeType: MimeType
) = StorageFile(
StorageFileInfo(fileName)
) {
ByteReadPacket(bytes)
}
@Suppress("NOTHING_TO_INLINE")
inline fun StorageFile(
fileName: String,
@ -81,13 +63,6 @@ inline fun ByteArray.asStorageFile(
fileName: String
) = StorageFile(fileName, this)
@Deprecated("This constructor is redundant. Use constructor without mime type")
@Suppress("NOTHING_TO_INLINE", "unused")
inline fun ByteArray.asStorageFile(
fileName: String,
mimeType: MimeType
) = asStorageFile(fileName)
@Suppress("NOTHING_TO_INLINE", "unused")
suspend inline fun ByteReadChannel.asStorageFile(
fileName: String

View File

@ -6,28 +6,3 @@ import dev.inmo.tgbotapi.requests.abstracts.FileId
import dev.inmo.tgbotapi.types.files.PathedFile
import dev.inmo.tgbotapi.types.files.abstracts.TelegramMediaFile
import dev.inmo.tgbotapi.types.message.content.abstracts.MediaContent
@Deprecated("Replaced", ReplaceWith("downloadFile", "dev.inmo.tgbotapi.extensions.api.files.downloadFile"))
suspend fun TelegramBot.downloadFile(
filePath: String
): ByteArray = downloadFile(filePath)
@Deprecated("Replaced", ReplaceWith("downloadFile", "dev.inmo.tgbotapi.extensions.api.files.downloadFile"))
suspend fun TelegramBot.downloadFile(
pathedFile: PathedFile
): ByteArray = downloadFile(pathedFile)
@Deprecated("Replaced", ReplaceWith("downloadFile", "dev.inmo.tgbotapi.extensions.api.files.downloadFile"))
suspend fun TelegramBot.downloadFile(
fileId: FileId
): ByteArray = downloadFile(fileId)
@Deprecated("Replaced", ReplaceWith("downloadFile", "dev.inmo.tgbotapi.extensions.api.files.downloadFile"))
suspend fun TelegramBot.downloadFile(
file: TelegramMediaFile
): ByteArray = downloadFile(file)
@Deprecated("Replaced", ReplaceWith("downloadFile", "dev.inmo.tgbotapi.extensions.api.files.downloadFile"))
suspend fun TelegramBot.downloadFile(
file: MediaContent
): ByteArray = downloadFile(file)

View File

@ -12,13 +12,3 @@ suspend fun TelegramBot.getChatMemberCount(
suspend fun TelegramBot.getChatMemberCount(
chat: PublicChat
) = getChatMemberCount(chat.id)
@Deprecated("Renamed", ReplaceWith("getChatMemberCount", "dev.inmo.tgbotapi.extensions.api.chat.get.getChatMemberCount"))
suspend fun TelegramBot.getChatMembersCount(
chatId: ChatIdentifier
) = getChatMemberCount(chatId)
@Deprecated("Renamed", ReplaceWith("getChatMemberCount", "dev.inmo.tgbotapi.extensions.api.chat.get.getChatMemberCount"))
suspend fun TelegramBot.getChatMembersCount(
chat: PublicChat
) = getChatMemberCount(chat)

View File

@ -32,35 +32,3 @@ suspend fun TelegramBot.banChatMember(
untilDate: TelegramDate? = null,
revokeMessages: Boolean? = null
) = banChatMember(chat.id, user.id, untilDate, revokeMessages)
@Deprecated("Renamed", ReplaceWith("banChatMember", "dev.inmo.tgbotapi.extensions.api.chat.members.banChatMember"))
suspend fun TelegramBot.kickChatMember(
chatId: ChatIdentifier,
userId: UserId,
untilDate: TelegramDate? = null,
revokeMessages: Boolean? = null
) = banChatMember(chatId, userId, untilDate, revokeMessages)
@Deprecated("Renamed", ReplaceWith("banChatMember", "dev.inmo.tgbotapi.extensions.api.chat.members.banChatMember"))
suspend fun TelegramBot.kickChatMember(
chat: PublicChat,
userId: UserId,
untilDate: TelegramDate? = null,
revokeMessages: Boolean? = null
) = banChatMember(chat, userId, untilDate, revokeMessages)
@Deprecated("Renamed", ReplaceWith("banChatMember", "dev.inmo.tgbotapi.extensions.api.chat.members.banChatMember"))
suspend fun TelegramBot.kickChatMember(
chatId: ChatId,
user: User,
untilDate: TelegramDate? = null,
revokeMessages: Boolean? = null
) = banChatMember(chatId, user, untilDate, revokeMessages)
@Deprecated("Renamed", ReplaceWith("banChatMember", "dev.inmo.tgbotapi.extensions.api.chat.members.banChatMember"))
suspend fun TelegramBot.kickChatMember(
chat: PublicChat,
user: User,
untilDate: TelegramDate? = null,
revokeMessages: Boolean? = null
) = banChatMember(chat, user, untilDate, revokeMessages)

View File

@ -56,39 +56,3 @@ suspend fun TelegramBot.sendGame(
) = sendGame(
chat.id, game.title, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
)
@Deprecated(
"Replaced",
ReplaceWith("replyWithGame", "dev.inmo.tgbotapi.extensions.api.send.replyWithGame")
)
suspend inline fun TelegramBot.replyWithGame(
to: Message,
gameShortName: String,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = replyWithGame(to, gameShortName, disableNotification, allowSendingWithoutReply, replyMarkup)
@Deprecated(
"Replaced",
ReplaceWith("replyWithGame", "dev.inmo.tgbotapi.extensions.api.send.replyWithGame")
)
suspend inline fun TelegramBot.replyWithGame(
to: Message,
game: Game,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = replyWithGame(to, game, disableNotification, allowSendingWithoutReply, replyMarkup)
@Deprecated(
"Replaced",
ReplaceWith("reply", "dev.inmo.tgbotapi.extensions.api.send.reply")
)
suspend inline fun TelegramBot.reply(
to: Message,
game: Game,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = reply(to, game, disableNotification, allowSendingWithoutReply, replyMarkup)

View File

@ -159,128 +159,3 @@ suspend fun TelegramBot.sendAnimation(
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendAnimation(chat.id, animation, entities, duration, width, height, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
@Deprecated(
"Replaced",
ReplaceWith("replyWithAnimation", "dev.inmo.tgbotapi.extensions.api.send.replyWithAnimation")
)
suspend inline fun TelegramBot.replyWithAnimation(
to: Message,
animation: InputFile,
thumb: InputFile? = null,
entities: TextSourcesList,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = replyWithAnimation(
to,
animation,
entities,
thumb,
duration,
width,
height,
disableNotification,
allowSendingWithoutReply,
replyMarkup
)
@Deprecated(
"Replaced",
ReplaceWith("reply", "dev.inmo.tgbotapi.extensions.api.send.reply")
)
suspend inline fun TelegramBot.replyWithAnimation(
to: Message,
animation: AnimationFile,
entities: TextSourcesList,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = reply(to, animation, entities, duration, width, height, disableNotification, allowSendingWithoutReply, replyMarkup)
@Deprecated(
"Replaced",
ReplaceWith("reply", "dev.inmo.tgbotapi.extensions.api.send.reply")
)
suspend inline fun TelegramBot.reply(
to: Message,
animation: AnimationFile,
entities: TextSourcesList,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = reply(to, animation, entities, duration, width, height, disableNotification, allowSendingWithoutReply, replyMarkup)
@Deprecated(
"Replaced",
ReplaceWith("replyWithAnimation", "dev.inmo.tgbotapi.extensions.api.send.replyWithAnimation")
)
suspend inline fun TelegramBot.replyWithAnimation(
to: Message,
animation: InputFile,
thumb: InputFile? = null,
text: String? = null,
parseMode: ParseMode? = null,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = replyWithAnimation(
to,
animation,
thumb,
text,
parseMode,
duration,
width,
height,
disableNotification,
allowSendingWithoutReply,
replyMarkup
)
@Deprecated(
"Replaced",
ReplaceWith("replyWithAnimation", "dev.inmo.tgbotapi.extensions.api.send.replyWithAnimation")
)
suspend inline fun TelegramBot.replyWithAnimation(
to: Message,
animation: AnimationFile,
text: String? = null,
parseMode: ParseMode? = null,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = reply(to, animation, text, parseMode, duration, width, height, disableNotification, allowSendingWithoutReply, replyMarkup)
@Deprecated(
"Replaced",
ReplaceWith("reply", "dev.inmo.tgbotapi.extensions.api.send.reply")
)
suspend inline fun TelegramBot.reply(
to: Message,
animation: AnimationFile,
text: String? = null,
parseMode: ParseMode? = null,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = reply(to, animation, text, parseMode, duration, width, height, disableNotification, allowSendingWithoutReply, replyMarkup)

View File

@ -147,97 +147,3 @@ suspend inline fun TelegramBot.sendAudio(
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendAudio(chat.id, audio, entities, title, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
@Deprecated(
"Replaced",
ReplaceWith("replyWithAudio", "dev.inmo.tgbotapi.extensions.api.send.replyWithAudio")
)
suspend inline fun TelegramBot.replyWithAudio(
to: Message,
audio: InputFile,
thumb: InputFile? = null,
text: String? = null,
parseMode: ParseMode? = null,
duration: Long? = null,
performer: String? = null,
title: String? = null,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = replyWithAudio(to, audio, thumb, text, parseMode, duration, performer, title, disableNotification, allowSendingWithoutReply, replyMarkup)
@Deprecated(
"Replaced",
ReplaceWith("reply", "dev.inmo.tgbotapi.extensions.api.send.reply")
)
suspend inline fun TelegramBot.replyWithAudio(
to: Message,
audio: AudioFile,
text: String? = null,
parseMode: ParseMode? = null,
title: String? = null,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = reply(to, audio, text, parseMode, title, disableNotification, allowSendingWithoutReply, replyMarkup)
@Deprecated(
"Replaced",
ReplaceWith("reply", "dev.inmo.tgbotapi.extensions.api.send.reply")
)
suspend inline fun TelegramBot.reply(
to: Message,
audio: AudioFile,
text: String? = null,
parseMode: ParseMode? = null,
title: String? = null,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = reply(to, audio, text, parseMode, title, disableNotification, allowSendingWithoutReply, replyMarkup)
@Deprecated(
"Replaced",
ReplaceWith("replyWithAudio", "dev.inmo.tgbotapi.extensions.api.send.replyWithAudio")
)
suspend inline fun TelegramBot.replyWithAudio(
to: Message,
audio: InputFile,
thumb: InputFile? = null,
entities: TextSourcesList,
duration: Long? = null,
performer: String? = null,
title: String? = null,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = replyWithAudio(to, audio, thumb, entities, duration, performer, title, disableNotification, allowSendingWithoutReply, replyMarkup)
@Deprecated(
"Replaced",
ReplaceWith("reply", "dev.inmo.tgbotapi.extensions.api.send.reply")
)
suspend inline fun TelegramBot.replyWithAudio(
to: Message,
audio: AudioFile,
entities: TextSourcesList,
title: String? = null,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = reply(to, audio, entities, title, disableNotification, allowSendingWithoutReply, replyMarkup)
@Deprecated(
"Replaced",
ReplaceWith("reply", "dev.inmo.tgbotapi.extensions.api.send.repl")
)
suspend inline fun TelegramBot.reply(
to: Message,
audio: AudioFile,
entities: TextSourcesList,
title: String? = null,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = reply(to, audio, entities, title, disableNotification, allowSendingWithoutReply, replyMarkup)

View File

@ -138,93 +138,3 @@ suspend inline fun TelegramBot.sendDocument(
replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null
) = sendDocument(chat.id, document, entities, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
@Deprecated(
"Replaced",
ReplaceWith("replyWithDocument", "dev.inmo.tgbotapi.extensions.api.send.replyWithDocument")
)
suspend inline fun TelegramBot.replyWithDocument(
to: Message,
document: InputFile,
thumb: InputFile? = null,
text: String? = null,
parseMode: ParseMode? = null,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null
) = replyWithDocument(to, document, thumb, text, parseMode, disableNotification, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
@Deprecated(
"Replaced",
ReplaceWith("reply", "dev.inmo.tgbotapi.extensions.api.send.reply")
)
suspend inline fun TelegramBot.replyWithDocument(
to: Message,
document: DocumentFile,
text: String? = null,
parseMode: ParseMode? = null,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null
) = reply(to, document, text, parseMode, disableNotification, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
@Deprecated(
"Replaced",
ReplaceWith("reply", "dev.inmo.tgbotapi.extensions.api.send.reply")
)
suspend inline fun TelegramBot.reply(
to: Message,
document: DocumentFile,
text: String? = null,
parseMode: ParseMode? = null,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null
) = reply(to, document, text, parseMode, disableNotification, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
@Deprecated(
"Replaced",
ReplaceWith("replyWithDocument", "dev.inmo.tgbotapi.extensions.api.send.replyWithDocument")
)
suspend inline fun TelegramBot.replyWithDocument(
to: Message,
document: InputFile,
thumb: InputFile? = null,
entities: TextSourcesList,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null
) = replyWithDocument(to, document, thumb, entities, disableNotification, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
@Deprecated(
"Replaced",
ReplaceWith("reply", "dev.inmo.tgbotapi.extensions.api.send.reply")
)
suspend inline fun TelegramBot.replyWithDocument(
to: Message,
document: DocumentFile,
entities: TextSourcesList,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null
) = reply(to, document, entities, disableNotification, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
@Deprecated(
"Replaced",
ReplaceWith("reply", "dev.inmo.tgbotapi.extensions.api.send.reply")
)
suspend inline fun TelegramBot.reply(
to: Message,
document: DocumentFile,
entities: TextSourcesList,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null
) = reply(to, document, entities, disableNotification, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)

View File

@ -127,60 +127,3 @@ suspend fun TelegramBot.sendVisualMediaGroup(
) = sendVisualMediaGroup(
chat.id, media, disableNotification, replyToMessageId, allowSendingWithoutReply
)
@Deprecated(
"Replaced",
ReplaceWith("replyWithMediaGroup", "dev.inmo.tgbotapi.extensions.api.send.replyWithMediaGroup")
)
@RiskFeature(rawSendingMediaGroupsWarning)
suspend inline fun TelegramBot.replyWithMediaGroup(
to: Message,
media: List<MediaGroupMemberInputMedia>,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null
) = replyWithMediaGroup(to, media, disableNotification, allowSendingWithoutReply)
@Deprecated(
"Replaced",
ReplaceWith("replyWithPlaylist", "dev.inmo.tgbotapi.extensions.api.send.replyWithPlaylist")
)
suspend inline fun TelegramBot.replyWithPlaylist(
to: Message,
media: List<AudioMediaGroupMemberInputMedia>,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null
) = replyWithPlaylist(to, media, disableNotification, allowSendingWithoutReply)
@Deprecated(
"Replaced",
ReplaceWith("replyWithDocuments", "dev.inmo.tgbotapi.extensions.api.send.replyWithDocuments")
)
suspend inline fun TelegramBot.replyWithDocumentsGroup(
to: Message,
media: List<DocumentMediaGroupMemberInputMedia>,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null
) = replyWithDocuments(to, media, disableNotification, allowSendingWithoutReply)
@Deprecated(
"Replaced",
ReplaceWith("replyWithGallery", "dev.inmo.tgbotapi.extensions.api.send.replyWithGallery")
)
suspend inline fun TelegramBot.replyWithVisualMediaGroup(
to: Message,
media: List<VisualMediaGroupMemberInputMedia>,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null
) = replyWithGallery(to, media, disableNotification, allowSendingWithoutReply)
@Deprecated(
"Replaced",
ReplaceWith("replyWithMediaGroup", "dev.inmo.tgbotapi.extensions.api.send.replyWithMediaGroup")
)
suspend inline fun TelegramBot.reply(
to: Message,
media: List<MediaGroupMemberInputMedia>,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null
) = replyWithMediaGroup(to, media, disableNotification, allowSendingWithoutReply)

View File

@ -120,86 +120,3 @@ suspend inline fun TelegramBot.sendPhoto(
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPhoto(chat.id, photo, entities, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
@Deprecated(
"Replaced",
ReplaceWith("replyWithPhoto", "dev.inmo.tgbotapi.extensions.api.send.replyWithPhoto")
)
suspend inline fun TelegramBot.replyWithPhoto(
to: Message,
fileId: InputFile,
text: String? = null,
parseMode: ParseMode? = null,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = replyWithPhoto(to, fileId, text, parseMode, disableNotification, allowSendingWithoutReply, replyMarkup)
@Deprecated(
"Replaced",
ReplaceWith("reply", "dev.inmo.tgbotapi.extensions.api.send.reply")
)
suspend inline fun TelegramBot.replyWithPhoto(
to: Message,
photo: Photo,
text: String? = null,
parseMode: ParseMode? = null,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = reply(to, photo, text, parseMode, disableNotification, allowSendingWithoutReply, replyMarkup)
@Deprecated(
"Replaced",
ReplaceWith("reply", "dev.inmo.tgbotapi.extensions.api.send.reply")
)
suspend inline fun TelegramBot.reply(
to: Message,
photo: Photo,
text: String? = null,
parseMode: ParseMode? = null,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = reply(to, photo, text, parseMode, disableNotification, allowSendingWithoutReply, replyMarkup)
@Deprecated(
"Replaced",
ReplaceWith("replyWithPhoto", "dev.inmo.tgbotapi.extensions.api.send.replyWithPhoto")
)
suspend inline fun TelegramBot.replyWithPhoto(
to: Message,
fileId: InputFile,
entities: TextSourcesList,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = replyWithPhoto(to, fileId, entities, disableNotification, allowSendingWithoutReply, replyMarkup)
@Deprecated(
"Replaced",
ReplaceWith("reply", "dev.inmo.tgbotapi.extensions.api.send.reply")
)
suspend inline fun TelegramBot.replyWithPhoto(
to: Message,
photo: Photo,
entities: TextSourcesList,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = reply(to, photo, entities, disableNotification, allowSendingWithoutReply, replyMarkup)
@Deprecated(
"Replaced",
ReplaceWith("reply", "dev.inmo.tgbotapi.extensions.api.send.reply")
)
suspend inline fun TelegramBot.reply(
to: Message,
photo: Photo,
entities: TextSourcesList,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = reply(to, photo, entities, disableNotification, allowSendingWithoutReply, replyMarkup)

View File

@ -49,40 +49,3 @@ suspend fun TelegramBot.sendSticker(
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendSticker(chat, sticker.fileId, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
@Deprecated(
"Replaced",
ReplaceWith("replyWithSticker", "dev.inmo.tgbotapi.extensions.api.send.replyWithSticker")
)
suspend inline fun TelegramBot.replyWithSticker(
to: Message,
sticker: InputFile,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = replyWithSticker(to, sticker, disableNotification, allowSendingWithoutReply, replyMarkup)
@Deprecated(
"Replaced",
ReplaceWith("reply", "dev.inmo.tgbotapi.extensions.api.send.reply")
)
suspend inline fun TelegramBot.replyWithSticker(
to: Message,
sticker: Sticker,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = reply(to, sticker, disableNotification, allowSendingWithoutReply, replyMarkup)
@Deprecated(
"Replaced",
ReplaceWith("reply", "dev.inmo.tgbotapi.extensions.api.send.reply")
)
suspend inline fun TelegramBot.reply(
to: Message,
sticker: Sticker,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = reply(to, sticker, disableNotification, allowSendingWithoutReply, replyMarkup)

View File

@ -146,93 +146,3 @@ suspend inline fun TelegramBot.sendVideo(
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVideo(chat.id, video, entities, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
@Deprecated(
"Replaced",
ReplaceWith("replyWithVideo", "dev.inmo.tgbotapi.extensions.api.send.replyWithVideo")
)
suspend inline fun TelegramBot.replyWithVideo(
to: Message,
video: InputFile,
thumb: InputFile? = null,
text: String? = null,
parseMode: ParseMode? = null,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = replyWithVideo(to, video, thumb, text, parseMode, duration, width, height, disableNotification, allowSendingWithoutReply, replyMarkup)
@Deprecated(
"Replaced",
ReplaceWith("reply", "dev.inmo.tgbotapi.extensions.api.send.reply")
)
suspend inline fun TelegramBot.replyWithVideo(
to: Message,
video: VideoFile,
text: String? = null,
parseMode: ParseMode? = null,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = reply(to, video, text, parseMode, disableNotification, allowSendingWithoutReply, replyMarkup)
@Deprecated(
"Replaced",
ReplaceWith("reply", "dev.inmo.tgbotapi.extensions.api.send.reply")
)
suspend inline fun TelegramBot.reply(
to: Message,
video: VideoFile,
text: String? = null,
parseMode: ParseMode? = null,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = reply(to, video, text, parseMode, disableNotification, allowSendingWithoutReply, replyMarkup)
@Deprecated(
"Replaced",
ReplaceWith("replyWithVideo", "dev.inmo.tgbotapi.extensions.api.send.replyWithVideo")
)
suspend inline fun TelegramBot.replyWithVideo(
to: Message,
video: InputFile,
thumb: InputFile? = null,
entities: TextSourcesList,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = replyWithVideo(to, video, thumb, entities, duration, width, height, disableNotification, allowSendingWithoutReply, replyMarkup)
@Deprecated(
"Replaced",
ReplaceWith("reply", "dev.inmo.tgbotapi.extensions.api.send.reply")
)
suspend inline fun TelegramBot.replyWithVideo(
to: Message,
video: VideoFile,
entities: TextSourcesList,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = reply(to, video, entities, disableNotification, allowSendingWithoutReply, replyMarkup)
@Deprecated(
"Replaced",
ReplaceWith("reply", "dev.inmo.tgbotapi.extensions.api.send.reply")
)
suspend inline fun TelegramBot.reply(
to: Message,
video: VideoFile,
entities: TextSourcesList,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = reply(to, video, entities, disableNotification, allowSendingWithoutReply, replyMarkup)

View File

@ -1,8 +1,6 @@
package dev.inmo.tgbotapi.extensions.api.send.media
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.extensions.api.send.reply
import dev.inmo.tgbotapi.extensions.api.send.replyWithVideoNote
import dev.inmo.tgbotapi.requests.abstracts.InputFile
import dev.inmo.tgbotapi.requests.send.media.SendVideoNote
import dev.inmo.tgbotapi.types.ChatIdentifier
@ -10,7 +8,6 @@ import dev.inmo.tgbotapi.types.MessageIdentifier
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.abstracts.Chat
import dev.inmo.tgbotapi.types.files.VideoNoteFile
import dev.inmo.tgbotapi.types.message.abstracts.Message
suspend fun TelegramBot.sendVideoNote(
chatId: ChatIdentifier,
@ -67,43 +64,3 @@ suspend fun TelegramBot.sendVideoNote(
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVideoNote(chat.id, videoNote, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
@Deprecated(
"Replaced",
ReplaceWith("replyWithVideoNote", "dev.inmo.tgbotapi.extensions.api.send.replyWithVideoNote")
)
suspend inline fun TelegramBot.replyWithVideoNote(
to: Message,
videoNote: InputFile,
thumb: InputFile? = null,
duration: Long? = null,
size: Int? = null,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = replyWithVideoNote(to, videoNote, thumb, duration, size, disableNotification, allowSendingWithoutReply, replyMarkup)
@Deprecated(
"Replaced",
ReplaceWith("reply", "dev.inmo.tgbotapi.extensions.api.send.reply")
)
suspend inline fun TelegramBot.replyWithVideoNote(
to: Message,
videoNote: VideoNoteFile,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = reply(to, videoNote, disableNotification, allowSendingWithoutReply, replyMarkup)
@Deprecated(
"Replaced",
ReplaceWith("reply", "dev.inmo.tgbotapi.extensions.api.send.reply")
)
suspend inline fun TelegramBot.reply(
to: Message,
videoNote: VideoNoteFile,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = reply(to, videoNote, disableNotification, allowSendingWithoutReply, replyMarkup)

View File

@ -129,88 +129,3 @@ suspend inline fun TelegramBot.sendVoice(
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVoice(chat.id, voice, entities, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
@Deprecated(
"Replaced",
ReplaceWith("replyWithVoice", "dev.inmo.tgbotapi.extensions.api.send.replyWithVoice")
)
suspend inline fun TelegramBot.replyWithVoice(
to: Message,
voice: InputFile,
text: String? = null,
parseMode: ParseMode? = null,
duration: Long? = null,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = replyWithVoice(to, voice, text, parseMode, duration, disableNotification, allowSendingWithoutReply, replyMarkup)
@Deprecated(
"Replaced",
ReplaceWith("reply", "dev.inmo.tgbotapi.extensions.api.send.reply")
)
suspend inline fun TelegramBot.replyWithVoice(
to: Message,
voice: VoiceFile,
text: String? = null,
parseMode: ParseMode? = null,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = reply(to, voice, text, parseMode, disableNotification, allowSendingWithoutReply, replyMarkup)
@Deprecated(
"Replaced",
ReplaceWith("reply", "dev.inmo.tgbotapi.extensions.api.send.reply")
)
suspend inline fun TelegramBot.reply(
to: Message,
voice: VoiceFile,
text: String? = null,
parseMode: ParseMode? = null,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = reply(to, voice, text, parseMode, disableNotification, allowSendingWithoutReply, replyMarkup)
@Deprecated(
"Replaced",
ReplaceWith("replyWithVoice", "dev.inmo.tgbotapi.extensions.api.send.replyWithVoice")
)
suspend inline fun TelegramBot.replyWithVoice(
to: Message,
voice: InputFile,
entities: TextSourcesList,
duration: Long? = null,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = replyWithVoice(to, voice, entities, duration, disableNotification, allowSendingWithoutReply, replyMarkup)
@Deprecated(
"Replaced",
ReplaceWith("reply", "dev.inmo.tgbotapi.extensions.api.send.reply")
)
suspend inline fun TelegramBot.replyWithVoice(
to: Message,
voice: VoiceFile,
entities: TextSourcesList,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = reply(to, voice, entities, disableNotification, allowSendingWithoutReply, replyMarkup)
@Deprecated(
"Replaced",
ReplaceWith("reply", "dev.inmo.tgbotapi.extensions.api.send.reply")
)
suspend inline fun TelegramBot.reply(
to: Message,
voice: VoiceFile,
entities: TextSourcesList,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = reply(to, voice, entities, disableNotification, allowSendingWithoutReply, replyMarkup)

View File

@ -60,32 +60,3 @@ suspend fun TelegramBot.sendInvoice(
allowSendingWithoutReply: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null
) = sendInvoice(user.id, title, description, payload, providerToken, currency, prices, maxTipAmount, suggestedTipAmounts, startParameter, providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
@Deprecated(
"Replaced",
ReplaceWith("reply", "dev.inmo.tgbotapi.extensions.api.send.reply")
)
suspend inline fun TelegramBot.replyWithInvoice(
to: Message,
title: String,
description: String,
payload: String,
providerToken: String,
currency: Currency,
prices: List<LabeledPrice>,
maxTipAmount: Int? = null,
suggestedTipAmounts: List<Int>? = null,
startParameter: StartParameter? = null,
providerData: String? = null,
requireName: Boolean = false,
requirePhoneNumber: Boolean = false,
requireEmail: Boolean = false,
requireShippingAddress: Boolean = false,
shouldSendPhoneNumberToProvider: Boolean = false,
shouldSendEmailToProvider: Boolean = false,
priceDependOnShipAddress: Boolean = false,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null
) = reply(to, title, description, payload, providerToken, currency, prices, maxTipAmount, suggestedTipAmounts, startParameter, providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress, disableNotification, allowSendingWithoutReply, replyMarkup)

View File

@ -227,114 +227,3 @@ suspend inline fun TelegramBot.sendQuizPoll(
) = sendQuizPoll(
chat.id, question, options, correctOptionId, isAnonymous, isClosed, entities, closeInfo, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
)
@Deprecated(
"Replaced",
ReplaceWith("reply", "dev.inmo.tgbotapi.extensions.api.send.reply")
)
suspend inline fun TelegramBot.replyWithRegularPoll(
to: Message,
question: String,
options: List<String>,
isAnonymous: Boolean = true,
isClosed: Boolean = false,
allowMultipleAnswers: Boolean = false,
closeInfo: ScheduledCloseInfo? = null,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = reply(to, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, disableNotification, allowSendingWithoutReply, replyMarkup)
@Deprecated(
"Replaced",
ReplaceWith("reply", "dev.inmo.tgbotapi.extensions.api.send.reply")
)
suspend inline fun TelegramBot.replyWithRegularPoll(
to: Message,
poll: RegularPoll,
isClosed: Boolean = false,
question: String = poll.question,
options: List<String> = poll.options.map { it.text },
isAnonymous: Boolean = poll.isAnonymous,
allowMultipleAnswers: Boolean = poll.allowMultipleAnswers,
closeInfo: ScheduledCloseInfo? = null,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = reply(to, poll, isClosed, question, options, isAnonymous, allowMultipleAnswers, closeInfo, disableNotification, allowSendingWithoutReply, replyMarkup)
@Deprecated(
"Replaced",
ReplaceWith("reply", "dev.inmo.tgbotapi.extensions.api.send.reply")
)
suspend inline fun TelegramBot.replyWithQuizPoll(
to: Message,
question: String,
options: List<String>,
correctOptionId: Int,
isAnonymous: Boolean = true,
isClosed: Boolean = false,
explanation: String? = null,
parseMode: ParseMode? = null,
closeInfo: ScheduledCloseInfo? = null,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = reply(to, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, disableNotification, allowSendingWithoutReply, replyMarkup)
@Deprecated(
"Replaced",
ReplaceWith("reply", "dev.inmo.tgbotapi.extensions.api.send.reply")
)
suspend inline fun TelegramBot.replyWithQuizPoll(
to: Message,
isClosed: Boolean = false,
quizPoll: QuizPoll,
question: String = quizPoll.question,
options: List<String> = quizPoll.options.map { it.text },
correctOptionId: Int = quizPoll.correctOptionId ?: error("Correct option ID must be provided by income QuizPoll or by developer"),
isAnonymous: Boolean = quizPoll.isAnonymous,
explanation: String? = null,
parseMode: ParseMode? = null,
closeInfo: ScheduledCloseInfo? = null,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = reply(to, quizPoll, isClosed, question, options, correctOptionId, isAnonymous, explanation, parseMode, closeInfo, disableNotification, allowSendingWithoutReply, replyMarkup)
@Deprecated(
"Replaced",
ReplaceWith("reply", "dev.inmo.tgbotapi.extensions.api.send.reply")
)
suspend inline fun TelegramBot.replyWithQuizPoll(
to: Message,
question: String,
options: List<String>,
correctOptionId: Int,
isAnonymous: Boolean = true,
isClosed: Boolean = false,
entities: TextSourcesList,
closeInfo: ScheduledCloseInfo? = null,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = reply(to, question, options, correctOptionId, isAnonymous, isClosed)
@Deprecated(
"Replaced",
ReplaceWith("reply", "dev.inmo.tgbotapi.extensions.api.send.reply")
)
suspend inline fun TelegramBot.replyWithQuizPoll(
to: Message,
isClosed: Boolean = false,
quizPoll: QuizPoll,
question: String = quizPoll.question,
options: List<String> = quizPoll.options.map { it.text },
correctOptionId: Int = quizPoll.correctOptionId ?: error("Correct option ID must be provided by income QuizPoll or by developer"),
isAnonymous: Boolean = quizPoll.isAnonymous,
entities: TextSourcesList,
closeInfo: ScheduledCloseInfo? = null,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = reply(to, quizPoll, entities, isClosed, question, options, correctOptionId, isAnonymous, closeInfo, disableNotification, allowSendingWithoutReply, replyMarkup)

View File

@ -16,36 +16,6 @@ import kotlinx.coroutines.plus
*/
expect var defaultCoroutineScopeProvider: () -> CoroutineScope
/**
* Use this method in case you wish to make some additional actions with [flowUpdatesFilter].
*
* **WARNING** This method WILL NOT launch any listening of updates. Use something like
* [startGettingOfUpdatesByLongPolling] or tools for work with webhooks
*
* @see [BehaviourContext]
* @see startGettingOfUpdatesByLongPolling
*/
@PreviewFeature
@Deprecated("Parameters has been reordered. Replace scope and flowUpdatesFilter for correct order")
suspend fun TelegramBot.buildBehaviour(
scope: CoroutineScope,
flowUpdatesFilter: FlowsUpdatesFilter,
defaultExceptionsHandler: ExceptionHandler<Unit>? = null,
block: BehaviourContextReceiver<Unit>
) {
BehaviourContext(
this,
scope.let {
if (defaultExceptionsHandler == null) {
it
} else {
it + ContextSafelyExceptionHandler(defaultExceptionsHandler)
}
},
flowUpdatesFilter
).block()
}
/**
* Use this method in case you wish to make some additional actions with [flowUpdatesFilter].
*
@ -90,8 +60,8 @@ suspend fun TelegramBot.buildBehaviour(
block: BehaviourContextReceiver<Unit>
) = FlowsUpdatesFilter().let {
buildBehaviour(
scope,
it,
scope,
defaultExceptionsHandler,
block
)

View File

@ -20,115 +20,6 @@ internal suspend inline fun <reified T : CallbackQuery> BehaviourContext.onCallb
(it.asCallbackQueryUpdate() ?.data as? T) ?.let(::listOfNotNull)
}
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onDataCallbackQuery(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: SimpleFilter<DataCallbackQuery>? = null,
markerFactory: MarkerFactory<in DataCallbackQuery, Any> = ByUserCallbackQueryMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, DataCallbackQuery>
) = onCallbackQuery(
additionalFilter,
if (includeFilterByChatInBehaviourSubContext) CallbackQueryFilterByUser else null,
markerFactory,
scenarioReceiver
)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onGameShortNameCallbackQuery(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: SimpleFilter<GameShortNameCallbackQuery>? = null,
markerFactory: MarkerFactory<in GameShortNameCallbackQuery, Any> = ByUserCallbackQueryMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, GameShortNameCallbackQuery>
) = onCallbackQuery(
additionalFilter,
if (includeFilterByChatInBehaviourSubContext) CallbackQueryFilterByUser else null,
markerFactory,
scenarioReceiver
)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onInlineMessageIdCallbackQuery(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: SimpleFilter<InlineMessageIdCallbackQuery>? = null,
markerFactory: MarkerFactory<in InlineMessageIdCallbackQuery, Any> = ByUserCallbackQueryMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, InlineMessageIdCallbackQuery>
) = onCallbackQuery(
additionalFilter,
if (includeFilterByChatInBehaviourSubContext) CallbackQueryFilterByUser else null,
markerFactory,
scenarioReceiver
)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onInlineMessageIdDataCallbackQuery(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: SimpleFilter<InlineMessageIdDataCallbackQuery>? = null,
markerFactory: MarkerFactory<in InlineMessageIdDataCallbackQuery, Any> = ByUserCallbackQueryMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, InlineMessageIdDataCallbackQuery>
) = onCallbackQuery(
additionalFilter,
if (includeFilterByChatInBehaviourSubContext) CallbackQueryFilterByUser else null,
markerFactory,
scenarioReceiver
)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onInlineMessageIdGameShortNameCallbackQuery(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: SimpleFilter<InlineMessageIdGameShortNameCallbackQuery>? = null,
markerFactory: MarkerFactory<in InlineMessageIdGameShortNameCallbackQuery, Any> = ByUserCallbackQueryMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, InlineMessageIdGameShortNameCallbackQuery>
) = onCallbackQuery(
additionalFilter,
if (includeFilterByChatInBehaviourSubContext) CallbackQueryFilterByUser else null,
markerFactory,
scenarioReceiver
)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onMessageCallbackQuery(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: SimpleFilter<MessageCallbackQuery>? = null,
markerFactory: MarkerFactory<in MessageCallbackQuery, Any> = ByUserCallbackQueryMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, MessageCallbackQuery>
) = onCallbackQuery(
additionalFilter,
if (includeFilterByChatInBehaviourSubContext) CallbackQueryFilterByUser else null,
markerFactory,
scenarioReceiver
)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onMessageDataCallbackQuery(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: SimpleFilter<MessageDataCallbackQuery>? = null,
markerFactory: MarkerFactory<in MessageDataCallbackQuery, Any> = ByUserCallbackQueryMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, MessageDataCallbackQuery>
) = onCallbackQuery(
additionalFilter,
if (includeFilterByChatInBehaviourSubContext) CallbackQueryFilterByUser else null,
markerFactory,
scenarioReceiver
)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onMessageGameShortNameCallbackQuery(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: SimpleFilter<MessageGameShortNameCallbackQuery>? = null,
markerFactory: MarkerFactory<in MessageGameShortNameCallbackQuery, Any> = ByUserCallbackQueryMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, MessageGameShortNameCallbackQuery>
) = onCallbackQuery(
additionalFilter,
if (includeFilterByChatInBehaviourSubContext) CallbackQueryFilterByUser else null,
markerFactory,
scenarioReceiver
)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onUnknownCallbackQueryType(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: SimpleFilter<UnknownCallbackQueryType>? = null,
markerFactory: MarkerFactory<in UnknownCallbackQueryType, Any> = ByUserCallbackQueryMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, UnknownCallbackQueryType>
) = onCallbackQuery(
additionalFilter,
if (includeFilterByChatInBehaviourSubContext) CallbackQueryFilterByUser else null,
markerFactory,
scenarioReceiver
)
/**
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,

View File

@ -22,45 +22,6 @@ internal suspend inline fun <reified U : ChatMemberUpdatedUpdate> BehaviourConte
((it as? U) ?.data) ?.let(::listOfNotNull)
}
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onChatMemberUpdated(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: SimpleFilter<ChatMemberUpdated>? = null,
markerFactory: MarkerFactory<ChatMemberUpdated, Any> = ByChatChatMemberUpdatedMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, ChatMemberUpdated>
) = onChatMemberUpdatedInternal<ChatMemberUpdatedUpdate>(
additionalFilter,
if (includeFilterByChatInBehaviourSubContext) ChatMemberUpdatedFilterByChat else null,
markerFactory,
scenarioReceiver
)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onCommonChatMemberUpdated(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: SimpleFilter<ChatMemberUpdated>? = null,
markerFactory: MarkerFactory<ChatMemberUpdated, Any> = ByChatChatMemberUpdatedMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, ChatMemberUpdated>
) = onChatMemberUpdatedInternal<CommonChatMemberUpdatedUpdate>(
additionalFilter,
if (includeFilterByChatInBehaviourSubContext) ChatMemberUpdatedFilterByChat else null,
markerFactory,
scenarioReceiver
)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onMyChatMemberUpdated(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: SimpleFilter<ChatMemberUpdated>? = null,
markerFactory: MarkerFactory<ChatMemberUpdated, Any> = ByChatChatMemberUpdatedMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, ChatMemberUpdated>
) = onChatMemberUpdatedInternal<MyChatMemberUpdatedUpdate>(
additionalFilter,
if (includeFilterByChatInBehaviourSubContext) ChatMemberUpdatedFilterByChat else null,
markerFactory,
scenarioReceiver
)
/**
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call

View File

@ -15,118 +15,6 @@ import dev.inmo.tgbotapi.types.message.content.TextContent
import dev.inmo.tgbotapi.types.update.abstracts.Update
import kotlinx.coroutines.Job
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.command(
commandRegex: Regex,
requireOnlyCommandInMessage: Boolean = true,
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: CommonMessageFilter<TextContent>? = null,
markerFactory: MarkerFactory<in CommonMessage<TextContent>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, CommonMessage<TextContent>>
): Job = onText(
includeFilterByChatInBehaviourSubContext,
CommonMessageFilter<TextContent> { message ->
val content = message.content
val textSources = content.textSources
val sizeRequirement = if (requireOnlyCommandInMessage) {
textSources.size == 1
} else {
true
}
sizeRequirement && textSources.any {
commandRegex.matches(it.asBotCommandTextSource() ?.command ?: return@any false)
} && (additionalFilter ?.invoke(message) != false)
}.let {
additionalFilter ?.times(it) ?: it
},
markerFactory,
scenarioReceiver
)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.command(
command: String,
requireOnlyCommandInMessage: Boolean = true,
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: CommonMessageFilter<TextContent>? = null,
markerFactory: MarkerFactory<in CommonMessage<TextContent>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, CommonMessage<TextContent>>
) = command(command.toRegex(), requireOnlyCommandInMessage, includeFilterByChatInBehaviourSubContext, additionalFilter, markerFactory, scenarioReceiver)
@Deprecated(OldAPITriggersDeprecationText)
suspend inline fun BehaviourContext.onCommand(
commandRegex: Regex,
requireOnlyCommandInMessage: Boolean = true,
includeFilterByChatInBehaviourSubContext: Boolean,
noinline additionalFilter: CommonMessageFilter<TextContent>? = null,
markerFactory: MarkerFactory<in CommonMessage<TextContent>, Any> = ByChatMessageMarkerFactory,
noinline scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, CommonMessage<TextContent>>
): Job = command(commandRegex, requireOnlyCommandInMessage, includeFilterByChatInBehaviourSubContext, additionalFilter, markerFactory, scenarioReceiver)
@Deprecated(OldAPITriggersDeprecationText)
suspend inline fun BehaviourContext.onCommand(
command: String,
requireOnlyCommandInMessage: Boolean = true,
includeFilterByChatInBehaviourSubContext: Boolean,
noinline additionalFilter: CommonMessageFilter<TextContent>? = null,
markerFactory: MarkerFactory<in CommonMessage<TextContent>, Any> = ByChatMessageMarkerFactory,
noinline scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, CommonMessage<TextContent>>
): Job = onCommand(command.toRegex(), requireOnlyCommandInMessage, includeFilterByChatInBehaviourSubContext, additionalFilter, markerFactory, scenarioReceiver)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.commandWithArgs(
commandRegex: Regex,
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: CommonMessageFilter<TextContent>? = null,
markerFactory: MarkerFactory<in CommonMessage<TextContent>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: BehaviourContextAndTwoTypesReceiver<Unit, CommonMessage<TextContent>, Array<String>>
) = command(
commandRegex,
requireOnlyCommandInMessage = false,
includeFilterByChatInBehaviourSubContext = includeFilterByChatInBehaviourSubContext,
additionalFilter = additionalFilter,
markerFactory = markerFactory
) {
val args = it.parseCommandsWithParams().let { commandsWithArgs ->
val key = commandsWithArgs.keys.firstOrNull { it.matches(commandRegex) } ?: return@let null
commandsWithArgs[key]
} ?: emptyArray()
scenarioReceiver(it, args)
}
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.commandWithArgs(
command: String,
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: CommonMessageFilter<TextContent>? = null,
markerFactory: MarkerFactory<in CommonMessage<TextContent>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: BehaviourContextAndTwoTypesReceiver<Unit, CommonMessage<TextContent>, Array<String>>
) = commandWithArgs(
command.toRegex(),
includeFilterByChatInBehaviourSubContext = includeFilterByChatInBehaviourSubContext,
additionalFilter = additionalFilter,
markerFactory = markerFactory,
scenarioReceiver = scenarioReceiver
)
@Deprecated(OldAPITriggersDeprecationText)
suspend inline fun BehaviourContext.onCommandWithArgs(
commandRegex: Regex,
includeFilterByChatInBehaviourSubContext: Boolean,
noinline additionalFilter: CommonMessageFilter<TextContent>? = null,
markerFactory: MarkerFactory<in CommonMessage<TextContent>, Any> = ByChatMessageMarkerFactory,
noinline scenarioReceiver: BehaviourContextAndTwoTypesReceiver<Unit, CommonMessage<TextContent>, Array<String>>
): Job = commandWithArgs(commandRegex, includeFilterByChatInBehaviourSubContext, additionalFilter, markerFactory, scenarioReceiver)
@Deprecated(OldAPITriggersDeprecationText)
suspend inline fun BehaviourContext.onCommandWithArgs(
command: String,
includeFilterByChatInBehaviourSubContext: Boolean,
noinline additionalFilter: CommonMessageFilter<TextContent>? = null,
markerFactory: MarkerFactory<in CommonMessage<TextContent>, Any> = ByChatMessageMarkerFactory,
noinline scenarioReceiver: BehaviourContextAndTwoTypesReceiver<Unit, CommonMessage<TextContent>, Array<String>>
): Job = onCommandWithArgs(command.toRegex(), includeFilterByChatInBehaviourSubContext, additionalFilter, markerFactory, scenarioReceiver)
suspend fun BehaviourContext.command(
commandRegex: Regex,

View File

@ -37,267 +37,6 @@ internal suspend inline fun <reified T : MessageContent> BehaviourContext.onCont
}
}
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onContentMessage(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: CommonMessageFilter<MessageContent>? = null,
includeMediaGroups: Boolean = true,
markerFactory: MarkerFactory<in CommonMessage<MessageContent>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, CommonMessage<MessageContent>>
) = onContent(
additionalFilter ?: if (includeMediaGroups) null else CommonMessageFilterExcludeMediaGroups,
if (includeFilterByChatInBehaviourSubContext) { MessageFilterByChat } else null,
markerFactory,
scenarioReceiver
)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onContact(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: CommonMessageFilter<ContactContent>? = null,
markerFactory: MarkerFactory<in CommonMessage<ContactContent>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, CommonMessage<ContactContent>>
) = onContent(
additionalFilter ?: CommonMessageFilterExcludeMediaGroups,
if (includeFilterByChatInBehaviourSubContext) { MessageFilterByChat } else null,
markerFactory,
scenarioReceiver
)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onDice(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: CommonMessageFilter<DiceContent>? = null,
markerFactory: MarkerFactory<in CommonMessage<DiceContent>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, CommonMessage<DiceContent>>
) = onContent(
additionalFilter ?: CommonMessageFilterExcludeMediaGroups,
if (includeFilterByChatInBehaviourSubContext) { MessageFilterByChat } else null,
markerFactory,
scenarioReceiver
)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onGame(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: CommonMessageFilter<GameContent>? = null,
markerFactory: MarkerFactory<in CommonMessage<GameContent>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, CommonMessage<GameContent>>
) = onContent(
additionalFilter ?: CommonMessageFilterExcludeMediaGroups,
if (includeFilterByChatInBehaviourSubContext) { MessageFilterByChat } else null,
markerFactory,
scenarioReceiver
)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onLocation(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: CommonMessageFilter<LocationContent>? = null,
markerFactory: MarkerFactory<in CommonMessage<LocationContent>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, CommonMessage<LocationContent>>
) = onContent(
additionalFilter ?: CommonMessageFilterExcludeMediaGroups,
if (includeFilterByChatInBehaviourSubContext) { MessageFilterByChat } else null,
markerFactory,
scenarioReceiver
)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onPoll(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: CommonMessageFilter<PollContent>? = null,
markerFactory: MarkerFactory<in CommonMessage<PollContent>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, CommonMessage<PollContent>>
) = onContent(
additionalFilter ?: CommonMessageFilterExcludeMediaGroups,
if (includeFilterByChatInBehaviourSubContext) { MessageFilterByChat } else null,
markerFactory,
scenarioReceiver
)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onText(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: CommonMessageFilter<TextContent>? = null,
markerFactory: MarkerFactory<in CommonMessage<TextContent>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, CommonMessage<TextContent>>
) = onContent(
additionalFilter ?: CommonMessageFilterExcludeMediaGroups,
if (includeFilterByChatInBehaviourSubContext) { MessageFilterByChat } else null,
markerFactory,
scenarioReceiver
)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onVenue(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: CommonMessageFilter<VenueContent>? = null,
markerFactory: MarkerFactory<in CommonMessage<VenueContent>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, CommonMessage<VenueContent>>
) = onContent(
additionalFilter ?: CommonMessageFilterExcludeMediaGroups,
if (includeFilterByChatInBehaviourSubContext) { MessageFilterByChat } else null,
markerFactory,
scenarioReceiver
)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onAudioMediaGroup(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: CommonMessageFilter<AudioMediaGroupContent>? = null,
markerFactory: MarkerFactory<in CommonMessage<AudioMediaGroupContent>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, CommonMessage<AudioMediaGroupContent>>
) = onContent(
additionalFilter,
if (includeFilterByChatInBehaviourSubContext) { MessageFilterByChat } else null,
markerFactory,
scenarioReceiver
)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onDocumentMediaGroupContent(
includeFilterByChatInBehaviourSubContext: Boolean,
includeMediaGroups: Boolean = true,
additionalFilter: CommonMessageFilter<DocumentMediaGroupContent>? = null,
markerFactory: MarkerFactory<in CommonMessage<DocumentMediaGroupContent>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, CommonMessage<DocumentMediaGroupContent>>
) = onContent(
additionalFilter ?: if (includeMediaGroups) null else CommonMessageFilterExcludeMediaGroups,
if (includeFilterByChatInBehaviourSubContext) { MessageFilterByChat } else null,
markerFactory,
scenarioReceiver
)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onMediaCollection(
includeFilterByChatInBehaviourSubContext: Boolean,
includeMediaGroups: Boolean = false,
additionalFilter: SimpleFilter<CommonMessage<MediaCollectionContent<TelegramMediaFile>>>? = null,
markerFactory: MarkerFactory<in CommonMessage<MediaCollectionContent<TelegramMediaFile>>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, CommonMessage<MediaCollectionContent<TelegramMediaFile>>>
) = onContent(
additionalFilter ?: if (includeMediaGroups) null else CommonMessageFilterExcludeMediaGroups,
if (includeFilterByChatInBehaviourSubContext) { MessageFilterByChat } else null,
markerFactory,
scenarioReceiver
)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onMedia(
includeFilterByChatInBehaviourSubContext: Boolean,
includeMediaGroups: Boolean = true,
additionalFilter: CommonMessageFilter<MediaContent>? = null,
markerFactory: MarkerFactory<in CommonMessage<MediaContent>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, CommonMessage<MediaContent>>
) = onContent(
additionalFilter ?: if (includeMediaGroups) null else CommonMessageFilterExcludeMediaGroups,
if (includeFilterByChatInBehaviourSubContext) { MessageFilterByChat } else null,
markerFactory,
scenarioReceiver
)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onAnimation(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: CommonMessageFilter<AnimationContent>? = null,
markerFactory: MarkerFactory<in CommonMessage<AnimationContent>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, CommonMessage<AnimationContent>>
) = onContent(
additionalFilter ?: CommonMessageFilterExcludeMediaGroups,
if (includeFilterByChatInBehaviourSubContext) { MessageFilterByChat } else null,
markerFactory,
scenarioReceiver
)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onAudio(
includeFilterByChatInBehaviourSubContext: Boolean,
includeMediaGroups: Boolean = false,
additionalFilter: CommonMessageFilter<AudioContent>? = null,
markerFactory: MarkerFactory<in CommonMessage<AudioContent>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, CommonMessage<AudioContent>>
) = onContent(
additionalFilter ?: if (includeMediaGroups) null else CommonMessageFilterExcludeMediaGroups,
if (includeFilterByChatInBehaviourSubContext) { MessageFilterByChat } else null,
markerFactory,
scenarioReceiver
)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onDocument(
includeFilterByChatInBehaviourSubContext: Boolean,
includeMediaGroups: Boolean = false,
additionalFilter: CommonMessageFilter<DocumentContent>? = null,
markerFactory: MarkerFactory<in CommonMessage<DocumentContent>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, CommonMessage<DocumentContent>>
) = onContent(
additionalFilter ?: if (includeMediaGroups) null else CommonMessageFilterExcludeMediaGroups,
if (includeFilterByChatInBehaviourSubContext) { MessageFilterByChat } else null,
markerFactory,
scenarioReceiver
)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onPhoto(
includeFilterByChatInBehaviourSubContext: Boolean,
includeMediaGroups: Boolean = false,
additionalFilter: CommonMessageFilter<PhotoContent>? = null,
markerFactory: MarkerFactory<in CommonMessage<PhotoContent>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, CommonMessage<PhotoContent>>
) = onContent(
additionalFilter ?: if (includeMediaGroups) null else CommonMessageFilterExcludeMediaGroups,
if (includeFilterByChatInBehaviourSubContext) { MessageFilterByChat } else null,
markerFactory,
scenarioReceiver
)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onSticker(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: CommonMessageFilter<StickerContent>? = null,
markerFactory: MarkerFactory<in CommonMessage<StickerContent>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, CommonMessage<StickerContent>>
) = onContent(
additionalFilter ?: CommonMessageFilterExcludeMediaGroups,
if (includeFilterByChatInBehaviourSubContext) { MessageFilterByChat } else null,
markerFactory,
scenarioReceiver
)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onVideo(
includeFilterByChatInBehaviourSubContext: Boolean,
includeMediaGroups: Boolean = false,
additionalFilter: CommonMessageFilter<VideoContent>? = null,
markerFactory: MarkerFactory<in CommonMessage<VideoContent>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, CommonMessage<VideoContent>>
) = onContent(
additionalFilter ?: if (includeMediaGroups) null else CommonMessageFilterExcludeMediaGroups,
if (includeFilterByChatInBehaviourSubContext) { MessageFilterByChat } else null,
markerFactory,
scenarioReceiver
)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onVideoNote(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: CommonMessageFilter<VideoNoteContent>? = null,
markerFactory: MarkerFactory<in CommonMessage<VideoNoteContent>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, CommonMessage<VideoNoteContent>>
) = onContent(
additionalFilter ?: CommonMessageFilterExcludeMediaGroups,
if (includeFilterByChatInBehaviourSubContext) { MessageFilterByChat } else null,
markerFactory,
scenarioReceiver
)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onVoice(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: CommonMessageFilter<VoiceContent>? = null,
markerFactory: MarkerFactory<in CommonMessage<VoiceContent>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, CommonMessage<VoiceContent>>
) = onContent(
additionalFilter ?: CommonMessageFilterExcludeMediaGroups,
if (includeFilterByChatInBehaviourSubContext) { MessageFilterByChat } else null,
markerFactory,
scenarioReceiver
)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onInvoice(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: CommonMessageFilter<InvoiceContent>? = null,
markerFactory: MarkerFactory<in CommonMessage<InvoiceContent>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, CommonMessage<InvoiceContent>>
) = onContent(
additionalFilter ?: CommonMessageFilterExcludeMediaGroups,
if (includeFilterByChatInBehaviourSubContext) { MessageFilterByChat } else null,
markerFactory,
scenarioReceiver
)
/**
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call

View File

@ -24,150 +24,6 @@ internal suspend inline fun <reified T : ChatEvent> BehaviourContext.onEvent(
(it.asBaseSentMessageUpdate() ?.data ?.asChatEventMessage() ?.takeIf { it.chatEvent is T } as? ChatEventMessage<T>) ?.let(::listOfNotNull)
}
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onChannelEvent(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: SimpleFilter<ChatEventMessage<ChannelEvent>>? = null,
markerFactory: MarkerFactory<in ChatEventMessage<ChannelEvent>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, ChatEventMessage<ChannelEvent>>
) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onChatEvent(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: SimpleFilter<ChatEventMessage<ChatEvent>>? = null,
markerFactory: MarkerFactory<in ChatEventMessage<ChatEvent>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, ChatEventMessage<ChatEvent>>
) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onVoiceChatEvent(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: SimpleFilter<ChatEventMessage<VoiceChatEvent>>? = null,
markerFactory: MarkerFactory<in ChatEventMessage<VoiceChatEvent>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, ChatEventMessage<VoiceChatEvent>>
) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onVoiceChatStartedEvent(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: SimpleFilter<ChatEventMessage<VoiceChatStarted>>? = null,
markerFactory: MarkerFactory<in ChatEventMessage<VoiceChatStarted>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, ChatEventMessage<VoiceChatStarted>>
) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onVoiceChatEndedEvent(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: SimpleFilter<ChatEventMessage<VoiceChatEnded>>? = null,
markerFactory: MarkerFactory<in ChatEventMessage<VoiceChatEnded>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, ChatEventMessage<VoiceChatEnded>>
) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onVoiceChatParticipantsInvitedEvent(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: SimpleFilter<ChatEventMessage<VoiceChatParticipantsInvited>>? = null,
markerFactory: MarkerFactory<in ChatEventMessage<VoiceChatParticipantsInvited>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, ChatEventMessage<VoiceChatParticipantsInvited>>
) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onMessageAutoDeleteTimerChangedEvent(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: SimpleFilter<ChatEventMessage<MessageAutoDeleteTimerChanged>>? = null,
markerFactory: MarkerFactory<in ChatEventMessage<MessageAutoDeleteTimerChanged>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, ChatEventMessage<MessageAutoDeleteTimerChanged>>
) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onCommonEvent(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: SimpleFilter<ChatEventMessage<CommonEvent>>? = null,
markerFactory: MarkerFactory<in ChatEventMessage<CommonEvent>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, ChatEventMessage<CommonEvent>>
) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onGroupEvent(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: SimpleFilter<ChatEventMessage<GroupEvent>>? = null,
markerFactory: MarkerFactory<in ChatEventMessage<GroupEvent>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, ChatEventMessage<GroupEvent>>
) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onSupergroupEvent(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: SimpleFilter<ChatEventMessage<SupergroupEvent>>? = null,
markerFactory: MarkerFactory<in ChatEventMessage<SupergroupEvent>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, ChatEventMessage<SupergroupEvent>>
) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onChannelChatCreated(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: SimpleFilter<ChatEventMessage<ChannelChatCreated>>? = null,
markerFactory: MarkerFactory<in ChatEventMessage<ChannelChatCreated>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, ChatEventMessage<ChannelChatCreated>>
) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onDeleteChatPhoto(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: SimpleFilter<ChatEventMessage<DeleteChatPhoto>>? = null,
markerFactory: MarkerFactory<in ChatEventMessage<DeleteChatPhoto>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, ChatEventMessage<DeleteChatPhoto>>
) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onGroupChatCreated(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: SimpleFilter<ChatEventMessage<GroupChatCreated>>? = null,
markerFactory: MarkerFactory<in ChatEventMessage<GroupChatCreated>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, ChatEventMessage<GroupChatCreated>>
) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onLeftChatMember(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: SimpleFilter<ChatEventMessage<LeftChatMember>>? = null,
markerFactory: MarkerFactory<in ChatEventMessage<LeftChatMember>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, ChatEventMessage<LeftChatMember>>
) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onNewChatMembers(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: SimpleFilter<ChatEventMessage<NewChatMembers>>? = null,
markerFactory: MarkerFactory<in ChatEventMessage<NewChatMembers>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, ChatEventMessage<NewChatMembers>>
) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onNewChatPhoto(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: SimpleFilter<ChatEventMessage<NewChatPhoto>>? = null,
markerFactory: MarkerFactory<in ChatEventMessage<NewChatPhoto>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, ChatEventMessage<NewChatPhoto>>
) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onNewChatTitle(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: SimpleFilter<ChatEventMessage<NewChatTitle>>? = null,
markerFactory: MarkerFactory<in ChatEventMessage<NewChatTitle>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, ChatEventMessage<NewChatTitle>>
) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onPinnedMessage(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: SimpleFilter<ChatEventMessage<PinnedMessage>>? = null,
markerFactory: MarkerFactory<in ChatEventMessage<PinnedMessage>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, ChatEventMessage<PinnedMessage>>
) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onProximityAlertTriggered(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: SimpleFilter<ChatEventMessage<ProximityAlertTriggered>>? = null,
markerFactory: MarkerFactory<in ChatEventMessage<ProximityAlertTriggered>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, ChatEventMessage<ProximityAlertTriggered>>
) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onSupergroupChatCreated(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: SimpleFilter<ChatEventMessage<SupergroupChatCreated>>? = null,
markerFactory: MarkerFactory<in ChatEventMessage<SupergroupChatCreated>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, ChatEventMessage<SupergroupChatCreated>>
) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver)
/**
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,

View File

@ -18,33 +18,6 @@ internal suspend inline fun <reified T : InlineQuery> BehaviourContext.onInlineQ
(it.asInlineQueryUpdate() ?.data as? T) ?.let(::listOfNotNull)
}
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onAnyInlineQuery(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: SimpleFilter<InlineQuery>? = null,
markerFactory: MarkerFactory<in InlineQuery, Any> = ByUserInlineQueryMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, InlineQuery>
) = onInlineQuery(additionalFilter, if (includeFilterByChatInBehaviourSubContext) InlineQueryFilterByUser else null, markerFactory, scenarioReceiver)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onBaseInlineQuery(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: SimpleFilter<BaseInlineQuery>? = null,
markerFactory: MarkerFactory<in BaseInlineQuery, Any> = ByUserInlineQueryMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, BaseInlineQuery>
) = onInlineQuery(additionalFilter, if (includeFilterByChatInBehaviourSubContext) InlineQueryFilterByUser else null, markerFactory, scenarioReceiver)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onLocationInlineQuery(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: SimpleFilter<LocationInlineQuery>? = null,
markerFactory: MarkerFactory<in LocationInlineQuery, Any> = ByUserInlineQueryMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, LocationInlineQuery>
) = onInlineQuery(additionalFilter, if (includeFilterByChatInBehaviourSubContext) InlineQueryFilterByUser else null, markerFactory, scenarioReceiver)
/**
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,

View File

@ -25,58 +25,6 @@ internal suspend inline fun <reified T : MediaGroupContent> BehaviourContext.bui
(it.asSentMediaGroupUpdate() ?.data ?.takeIf { it.all { it is T } } as? List<MediaGroupMessage<T>>) ?.let(::listOfNotNull)
}
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onMediaGroup(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: SimpleFilter<List<MediaGroupMessage<MediaGroupContent>>>? = null,
markerFactory: MarkerFactory<in List<MediaGroupMessage<MediaGroupContent>>, Any> = ByChatMediaGroupMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, List<MediaGroupMessage<MediaGroupContent>>>
) = buildMediaGroupTrigger(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessagesFilterByChat else null, markerFactory, scenarioReceiver)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onPlaylist(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: SimpleFilter<List<MediaGroupMessage<AudioMediaGroupContent>>>? = null,
markerFactory: MarkerFactory<in List<MediaGroupMessage<AudioMediaGroupContent>>, Any> = ByChatMediaGroupMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, List<MediaGroupMessage<AudioMediaGroupContent>>>
) = buildMediaGroupTrigger(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessagesFilterByChat else null, markerFactory, scenarioReceiver)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onDocumentsGroup(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: SimpleFilter<List<MediaGroupMessage<DocumentMediaGroupContent>>>? = null,
markerFactory: MarkerFactory<in List<MediaGroupMessage<DocumentMediaGroupContent>>, Any> = ByChatMediaGroupMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, List<MediaGroupMessage<DocumentMediaGroupContent>>>
) = buildMediaGroupTrigger(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessagesFilterByChat else null, markerFactory, scenarioReceiver)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onVisualGallery(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: SimpleFilter<List<MediaGroupMessage<VisualMediaGroupContent>>>? = null,
markerFactory: MarkerFactory<in List<MediaGroupMessage<VisualMediaGroupContent>>, Any> = ByChatMediaGroupMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, List<MediaGroupMessage<VisualMediaGroupContent>>>
) = buildMediaGroupTrigger(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessagesFilterByChat else null, markerFactory, scenarioReceiver)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onVisualMediaGroup(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: SimpleFilter<List<MediaGroupMessage<VisualMediaGroupContent>>>? = null,
markerFactory: MarkerFactory<in List<MediaGroupMessage<VisualMediaGroupContent>>, Any> = ByChatMediaGroupMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, List<MediaGroupMessage<VisualMediaGroupContent>>>
) = onVisualGallery(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessagesFilterByChat else null, markerFactory, scenarioReceiver)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onPhotoGallery(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: SimpleFilter<List<MediaGroupMessage<PhotoContent>>>? = null,
markerFactory: MarkerFactory<in List<MediaGroupMessage<PhotoContent>>, Any> = ByChatMediaGroupMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, List<MediaGroupMessage<PhotoContent>>>
) = buildMediaGroupTrigger(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessagesFilterByChat else null, markerFactory, scenarioReceiver)
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onVideoGallery(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: SimpleFilter<List<MediaGroupMessage<VideoContent>>>? = null,
markerFactory: MarkerFactory<in List<MediaGroupMessage<VideoContent>>, Any> = ByChatMediaGroupMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, List<MediaGroupMessage<VideoContent>>>
) = buildMediaGroupTrigger(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessagesFilterByChat else null, markerFactory, scenarioReceiver)
/**
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,

View File

@ -20,19 +20,6 @@ internal suspend inline fun <reified T : EncryptedPassportElement> BehaviourCont
(it.asMessageUpdate() ?.data ?.asPassportMessage() ?.takeIf { it.passportData.data.any { it is T } }) ?.let(::listOfNotNull)
}
@Deprecated(OldAPITriggersDeprecationText)
suspend fun BehaviourContext.onPassportMessage(
includeFilterByChatInBehaviourSubContext: Boolean,
additionalFilter: SimpleFilter<PassportMessage>? = null,
markerFactory: MarkerFactory<in PassportMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, PassportMessage>
) = onPassportMessageWith<EncryptedPassportElement>(
additionalFilter,
if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null,
markerFactory,
scenarioReceiver
)
/**
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call

View File

@ -5,17 +5,3 @@ import dev.inmo.tgbotapi.types.update.abstracts.BaseSentMessageUpdate
import dev.inmo.tgbotapi.updateshandlers.FlowsUpdatesFilter
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.merge
@Deprecated("Will be removed soon", ReplaceWith("messagesFlow + channelPostsFlow"))
val FlowsUpdatesFilter.allSentMessagesFlow: Flow<BaseSentMessageUpdate>
get() = merge(
messagesFlow,
channelPostsFlow
)
@Deprecated("Will be removed soon", ReplaceWith("messageMediaGroupsFlow + channelPostMediaGroupsFlow"))
val FlowsUpdatesFilter.allSentMediaGroupsFlow: Flow<SentMediaGroupUpdate>
get() = merge(
messageMediaGroupsFlow,
channelPostMediaGroupsFlow
)

View File

@ -2,29 +2,8 @@ package dev.inmo.tgbotapi.types.files
import dev.inmo.tgbotapi.utils.TelegramAPIUrlsKeeper
import java.io.*
import java.io.File
import java.net.URL
fun PathedFile.asStream(
telegramAPIUrlsKeeper: TelegramAPIUrlsKeeper
telegramAPIUrlsKeeper: TelegramAPIUrlsKeeper
): InputStream = URL(this.fullUrl(telegramAPIUrlsKeeper)).openStream()
@Deprecated("This api will be removed soon. Use `downloadFile` instead")
fun PathedFile.asFile(
telegramAPIUrlsKeeper: TelegramAPIUrlsKeeper,
dest: File = File.createTempFile(this.fileUniqueId, this.filename),
defaultBufferSize: Int = DEFAULT_BUFFER_SIZE
): File {
this.asStream(telegramAPIUrlsKeeper).use { input ->
FileOutputStream(dest).use { out ->
input.copyTo(out, defaultBufferSize)
}
}
return dest
}
@Deprecated("This api will be removed soon. Use `downloadFile` instead")
fun PathedFile.asBytes(
telegramAPIUrlsKeeper: TelegramAPIUrlsKeeper
): ByteArray = this.asStream(telegramAPIUrlsKeeper)
.use { input -> input.readBytes() }