diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/Edits.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/Edits.kt new file mode 100644 index 0000000000..587ed38408 --- /dev/null +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/Edits.kt @@ -0,0 +1,207 @@ +package dev.inmo.tgbotapi.extensions.api.edit + +import dev.inmo.tgbotapi.abstracts.TextedWithTextSources +import dev.inmo.tgbotapi.bot.TelegramBot +import dev.inmo.tgbotapi.extensions.api.edit.caption.editMessageCaption +import dev.inmo.tgbotapi.extensions.api.edit.location.live.editLiveLocation +import dev.inmo.tgbotapi.extensions.api.edit.media.editMessageMedia +import dev.inmo.tgbotapi.extensions.api.edit.reply_markup.editMessageReplyMarkup +import dev.inmo.tgbotapi.extensions.api.edit.text.editMessageText +import dev.inmo.tgbotapi.types.* +import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup +import dev.inmo.tgbotapi.types.chat.Chat +import dev.inmo.tgbotapi.types.location.LiveLocation +import dev.inmo.tgbotapi.types.media.TelegramMedia +import dev.inmo.tgbotapi.types.message.ParseMode +import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage +import dev.inmo.tgbotapi.types.message.abstracts.Message +import dev.inmo.tgbotapi.types.message.content.* +import dev.inmo.tgbotapi.types.message.textsources.TextSource +import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList + +/** + * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] + * as a builder for that + */ +suspend fun TelegramBot.edit( + message: ContentMessage, + text: String, + parseMode: ParseMode? = null, + replyMarkup: InlineKeyboardMarkup? = null +): ContentMessage where T : TextedWithTextSources, T : MediaContent { + return editMessageCaption(message, text, parseMode, replyMarkup) +} + +/** + * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] + * as a builder for that + */ +suspend fun TelegramBot.edit( + message: ContentMessage, + entities: List, + replyMarkup: InlineKeyboardMarkup? = null +): ContentMessage where T : TextedWithTextSources, T : MediaContent { + return editMessageCaption(message, entities, replyMarkup) +} + +/** + * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] + * as a builder for that + */ +suspend fun TelegramBot.edit( + chatId: ChatIdentifier, + messageId: MessageIdentifier, + latitude: Double, + longitude: Double, + horizontalAccuracy: Meters? = null, + heading: Degrees? = null, + proximityAlertRadius: Meters? = null, + replyMarkup: InlineKeyboardMarkup? = null +) = editLiveLocation(chatId, messageId, latitude, longitude, horizontalAccuracy, heading, proximityAlertRadius, replyMarkup) + +/** + * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] + * as a builder for that + */ +suspend fun TelegramBot.edit( + chat: Chat, + messageId: MessageIdentifier, + latitude: Double, + longitude: Double, + horizontalAccuracy: Meters? = null, + heading: Degrees? = null, + proximityAlertRadius: Meters? = null, + replyMarkup: InlineKeyboardMarkup? = null +) = editLiveLocation(chat, messageId, latitude, longitude, horizontalAccuracy, heading, proximityAlertRadius, replyMarkup) + +/** + * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] + * as a builder for that + */ +suspend fun TelegramBot.edit( + message: ContentMessage, + latitude: Double, + longitude: Double, + horizontalAccuracy: Meters? = null, + heading: Degrees? = null, + proximityAlertRadius: Meters? = null, + replyMarkup: InlineKeyboardMarkup? = null +) = editLiveLocation(message, latitude, longitude, horizontalAccuracy, heading, proximityAlertRadius, replyMarkup) + +/** + * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] + * as a builder for that + */ +suspend fun TelegramBot.edit( + chatId: ChatIdentifier, + messageId: MessageIdentifier, + location: LiveLocation, + replyMarkup: InlineKeyboardMarkup? = null +) = editLiveLocation( + chatId, messageId, location, replyMarkup +) + +/** + * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] + * as a builder for that + */ +suspend fun TelegramBot.edit( + chat: Chat, + messageId: MessageIdentifier, + location: LiveLocation, + replyMarkup: InlineKeyboardMarkup? = null +) = editLiveLocation(chat, messageId, location, replyMarkup) + +/** + * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] + * as a builder for that + */ +suspend fun TelegramBot.edit( + message: ContentMessage, + location: LiveLocation, + replyMarkup: InlineKeyboardMarkup? = null +) = editLiveLocation(message, location, replyMarkup) + +/** + * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] + * as a builder for that + */ +suspend fun TelegramBot.edit( + chatId: ChatIdentifier, + messageId: MessageIdentifier, + media: TelegramMedia, + replyMarkup: InlineKeyboardMarkup? = null +) = editMessageMedia(chatId, messageId, media, replyMarkup) + +/** + * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] + * as a builder for that + */ +suspend fun TelegramBot.edit( + chat: Chat, + messageId: MessageIdentifier, + media: TelegramMedia, + replyMarkup: InlineKeyboardMarkup? = null +) = editMessageMedia(chat, messageId, media, replyMarkup) + +/** + * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] + * as a builder for that + */ +suspend fun TelegramBot.edit( + message: ContentMessage, + media: TelegramMedia, + replyMarkup: InlineKeyboardMarkup? = null +) = editMessageMedia(message, media, replyMarkup) + +/** + * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] + * as a builder for that + */ +suspend fun TelegramBot.edit( + chatId: ChatIdentifier, + messageId: MessageIdentifier, + replyMarkup: InlineKeyboardMarkup? = null +) = editMessageReplyMarkup(chatId, messageId, replyMarkup) + +/** + * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] + * as a builder for that + */ +suspend fun TelegramBot.edit( + chat: Chat, + messageId: MessageIdentifier, + replyMarkup: InlineKeyboardMarkup? = null +) = editMessageReplyMarkup(chat, messageId, replyMarkup) + +/** + * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] + * as a builder for that + */ +suspend fun TelegramBot.edit( + message: Message, + replyMarkup: InlineKeyboardMarkup? = null +) = editMessageReplyMarkup(message, replyMarkup) + +/** + * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] + * as a builder for that + */ +suspend fun TelegramBot.edit( + message: ContentMessage, + text: String, + parseMode: ParseMode? = null, + disableWebPagePreview: Boolean? = null, + replyMarkup: InlineKeyboardMarkup? = null +) = editMessageText(message, text, parseMode, disableWebPagePreview, replyMarkup) + +/** + * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] + * as a builder for that + */ +suspend fun TelegramBot.edit( + message: ContentMessage, + entities: TextSourcesList, + disableWebPagePreview: Boolean? = null, + replyMarkup: InlineKeyboardMarkup? = null +) = editMessageText(message, entities, disableWebPagePreview, replyMarkup) diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/common/EditCaption.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/common/EditCaption.kt deleted file mode 100644 index f13c982e18..0000000000 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/common/EditCaption.kt +++ /dev/null @@ -1,35 +0,0 @@ -package dev.inmo.tgbotapi.extensions.api.edit.common - -import dev.inmo.tgbotapi.abstracts.TextedWithTextSources -import dev.inmo.tgbotapi.bot.TelegramBot -import dev.inmo.tgbotapi.extensions.api.edit.caption.editMessageCaption -import dev.inmo.tgbotapi.types.message.textsources.TextSource -import dev.inmo.tgbotapi.types.message.ParseMode -import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup -import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage -import dev.inmo.tgbotapi.types.message.content.MediaContent - -/** - * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] - * as a builder for that - */ -suspend fun TelegramBot.edit( - message: ContentMessage, - text: String, - parseMode: ParseMode? = null, - replyMarkup: InlineKeyboardMarkup? = null -): ContentMessage where T : TextedWithTextSources, T : MediaContent { - return editMessageCaption(message, text, parseMode, replyMarkup) -} - -/** - * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] - * as a builder for that - */ -suspend fun TelegramBot.edit( - message: ContentMessage, - entities: List, - replyMarkup: InlineKeyboardMarkup? = null -): ContentMessage where T : TextedWithTextSources, T : MediaContent { - return editMessageCaption(message, entities, replyMarkup) -} diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/common/EditLiveLocation.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/common/EditLiveLocation.kt deleted file mode 100644 index 370f4be765..0000000000 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/common/EditLiveLocation.kt +++ /dev/null @@ -1,88 +0,0 @@ -package dev.inmo.tgbotapi.extensions.api.edit.common - -import dev.inmo.tgbotapi.bot.TelegramBot -import dev.inmo.tgbotapi.extensions.api.edit.location.live.editLiveLocation -import dev.inmo.tgbotapi.types.* -import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup -import dev.inmo.tgbotapi.types.chat.Chat -import dev.inmo.tgbotapi.types.location.LiveLocation -import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage -import dev.inmo.tgbotapi.types.message.content.LocationContent - -/** - * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] - * as a builder for that - */ -suspend fun TelegramBot.edit( - chatId: ChatIdentifier, - messageId: MessageIdentifier, - latitude: Double, - longitude: Double, - horizontalAccuracy: Meters? = null, - heading: Degrees? = null, - proximityAlertRadius: Meters? = null, - replyMarkup: InlineKeyboardMarkup? = null -) = editLiveLocation(chatId, messageId, latitude, longitude, horizontalAccuracy, heading, proximityAlertRadius, replyMarkup) - -/** - * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] - * as a builder for that - */ -suspend fun TelegramBot.edit( - chat: Chat, - messageId: MessageIdentifier, - latitude: Double, - longitude: Double, - horizontalAccuracy: Meters? = null, - heading: Degrees? = null, - proximityAlertRadius: Meters? = null, - replyMarkup: InlineKeyboardMarkup? = null -) = editLiveLocation(chat, messageId, latitude, longitude, horizontalAccuracy, heading, proximityAlertRadius, replyMarkup) - -/** - * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] - * as a builder for that - */ -suspend fun TelegramBot.edit( - message: ContentMessage, - latitude: Double, - longitude: Double, - horizontalAccuracy: Meters? = null, - heading: Degrees? = null, - proximityAlertRadius: Meters? = null, - replyMarkup: InlineKeyboardMarkup? = null -) = editLiveLocation(message, latitude, longitude, horizontalAccuracy, heading, proximityAlertRadius, replyMarkup) - -/** - * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] - * as a builder for that - */ -suspend fun TelegramBot.edit( - chatId: ChatIdentifier, - messageId: MessageIdentifier, - location: LiveLocation, - replyMarkup: InlineKeyboardMarkup? = null -) = editLiveLocation( - chatId, messageId, location, replyMarkup -) - -/** - * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] - * as a builder for that - */ -suspend fun TelegramBot.edit( - chat: Chat, - messageId: MessageIdentifier, - location: LiveLocation, - replyMarkup: InlineKeyboardMarkup? = null -) = editLiveLocation(chat, messageId, location, replyMarkup) - -/** - * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] - * as a builder for that - */ -suspend fun TelegramBot.edit( - message: ContentMessage, - location: LiveLocation, - replyMarkup: InlineKeyboardMarkup? = null -) = editLiveLocation(message, location, replyMarkup) diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/common/EditMedia.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/common/EditMedia.kt deleted file mode 100644 index efeaf23bbf..0000000000 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/common/EditMedia.kt +++ /dev/null @@ -1,43 +0,0 @@ -package dev.inmo.tgbotapi.extensions.api.edit.common - -import dev.inmo.tgbotapi.bot.TelegramBot -import dev.inmo.tgbotapi.extensions.api.edit.media.editMessageMedia -import dev.inmo.tgbotapi.types.ChatIdentifier -import dev.inmo.tgbotapi.types.media.TelegramMedia -import dev.inmo.tgbotapi.types.MessageIdentifier -import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup -import dev.inmo.tgbotapi.types.chat.Chat -import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage -import dev.inmo.tgbotapi.types.message.content.MediaContent - -/** - * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] - * as a builder for that - */ -suspend fun TelegramBot.edit( - chatId: ChatIdentifier, - messageId: MessageIdentifier, - media: TelegramMedia, - replyMarkup: InlineKeyboardMarkup? = null -) = editMessageMedia(chatId, messageId, media, replyMarkup) - -/** - * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] - * as a builder for that - */ -suspend fun TelegramBot.edit( - chat: Chat, - messageId: MessageIdentifier, - media: TelegramMedia, - replyMarkup: InlineKeyboardMarkup? = null -) = editMessageMedia(chat, messageId, media, replyMarkup) - -/** - * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] - * as a builder for that - */ -suspend fun TelegramBot.edit( - message: ContentMessage, - media: TelegramMedia, - replyMarkup: InlineKeyboardMarkup? = null -) = editMessageMedia(message, media, replyMarkup) diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/common/EditReplyMarkup.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/common/EditReplyMarkup.kt deleted file mode 100644 index c22e14031d..0000000000 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/common/EditReplyMarkup.kt +++ /dev/null @@ -1,39 +0,0 @@ -package dev.inmo.tgbotapi.extensions.api.edit.common - -import dev.inmo.tgbotapi.bot.TelegramBot -import dev.inmo.tgbotapi.extensions.api.edit.reply_markup.editMessageReplyMarkup -import dev.inmo.tgbotapi.types.ChatIdentifier -import dev.inmo.tgbotapi.types.MessageIdentifier -import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup -import dev.inmo.tgbotapi.types.chat.Chat -import dev.inmo.tgbotapi.types.message.abstracts.Message - -/** - * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] - * as a builder for that - */ -suspend fun TelegramBot.edit( - chatId: ChatIdentifier, - messageId: MessageIdentifier, - replyMarkup: InlineKeyboardMarkup? = null -) = editMessageReplyMarkup(chatId, messageId, replyMarkup) - -/** - * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] - * as a builder for that - */ -suspend fun TelegramBot.edit( - chat: Chat, - messageId: MessageIdentifier, - replyMarkup: InlineKeyboardMarkup? = null -) = editMessageReplyMarkup(chat, messageId, replyMarkup) - -/** - * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] - * as a builder for that - */ -suspend fun TelegramBot.edit( - message: Message, - replyMarkup: InlineKeyboardMarkup? = null -) = editMessageReplyMarkup(message, replyMarkup) - diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/common/EditText.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/common/EditText.kt deleted file mode 100644 index 6c38b4ebb6..0000000000 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/common/EditText.kt +++ /dev/null @@ -1,32 +0,0 @@ -package dev.inmo.tgbotapi.extensions.api.edit.common - -import dev.inmo.tgbotapi.bot.TelegramBot -import dev.inmo.tgbotapi.extensions.api.edit.text.editMessageText -import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList -import dev.inmo.tgbotapi.types.message.ParseMode -import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup -import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage -import dev.inmo.tgbotapi.types.message.content.TextContent - -/** - * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] - * as a builder for that - */ -suspend fun TelegramBot.edit( - message: ContentMessage, - text: String, - parseMode: ParseMode? = null, - disableWebPagePreview: Boolean? = null, - replyMarkup: InlineKeyboardMarkup? = null -) = editMessageText(message, text, parseMode, disableWebPagePreview, replyMarkup) - -/** - * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] - * as a builder for that - */ -suspend fun TelegramBot.edit( - message: ContentMessage, - entities: TextSourcesList, - disableWebPagePreview: Boolean? = null, - replyMarkup: InlineKeyboardMarkup? = null -) = editMessageText(message, entities, disableWebPagePreview, replyMarkup)