1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-12-22 16:47:13 +00:00

replace ReplyMarkups and api extensions for live locations

This commit is contained in:
InsanusMokrassar 2022-05-01 21:33:36 +06:00
parent dd893b14d3
commit d113d4f0f5
18 changed files with 341 additions and 89 deletions

View File

@ -30,7 +30,12 @@ __All the `tgbotapi.extensions.*` packages have been removed__
* **Replaces of `MediaGroupUpdate`s. Migrations:** `dev.inmo.tgbotapi.types.update.MediaGroupUpdates` -> `dev.inmo.tgbotapi.types.update.media_group`
* **`InvoiceContent` has been replaced: `dev.inmo.tgbotapi.types.message.payments.InvoiceContent` -> `dev.inmo.tgbotapi.types.message.content.InvoiceContent`**
* **`PossiblySentViaBotCommonMessage` has been replaced: `dev.inmo.tgbotapi.types.message.content.abstracts.PossiblySentViaBotCommonMessage` -> `dev.inmo.tgbotapi.types.message.abstracts.PossiblySentViaBotCommonMessage`**
* **Edit live location requests have been replaced: `dev.inmo.tgbotapi.requests.edit.LiveLocation` -> `dev.inmo.tgbotapi.requests.edit.location.live`**
* **Edit live location requests have been replaced:**
* `dev.inmo.tgbotapi.requests.edit.LiveLocation` -> `dev.inmo.tgbotapi.requests.edit.location.live`
* `dev.inmo.tgbotapi.extensions.api.edit.LiveLocation` -> `dev.inmo.tgbotapi.extensions.api.edit.location.live`
* **Edit reply markup requests have been replaced:**
* `dev.inmo.tgbotapi.requests.edit.ReplyMarkup` -> `dev.inmo.tgbotapi.requests.edit.reply_markup`
* `dev.inmo.tgbotapi.extensions.api.edit.ReplyMarkup` -> `dev.inmo.tgbotapi.extensions.api.edit.reply_markup`
* Constructor of `UnknownInlineKeyboardButton` is not internal and can be created with any `json` ([#563](https://github.com/InsanusMokrassar/TelegramBotAPI/issues/563))
* All the interfaces from `dev.inmo.tgbotapi.types.files.abstracts` have been replaced to `dev.inmo.tgbotapi.types.files` and converted to sealed ([#550](https://github.com/InsanusMokrassar/TelegramBotAPI/issues/550))
* `PassportFile` has been replaced to `dev.inmo.tgbotapi.types.files`

View File

@ -3,8 +3,8 @@ package dev.inmo.tgbotapi.extensions.api
import com.soywiz.klock.DateTime
import com.soywiz.klock.TimeSpan
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.extensions.api.edit.LiveLocation.editLiveLocation
import dev.inmo.tgbotapi.extensions.api.edit.LiveLocation.stopLiveLocation
import dev.inmo.tgbotapi.extensions.api.edit.location.live.editLiveLocation
import dev.inmo.tgbotapi.extensions.api.edit.location.live.stopLiveLocation
import dev.inmo.tgbotapi.requests.send.SendLiveLocation
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup

View File

@ -1,18 +1,19 @@
package dev.inmo.tgbotapi.extensions.api.edit.LiveLocation
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.edit.location.live.EditChatMessageLiveLocation
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
import dev.inmo.tgbotapi.extensions.api.edit.location.live.editLiveLocation
/**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
* as a builder for that
*/
@Deprecated("Replaced", ReplaceWith("editLiveLocation", "dev.inmo.tgbotapi.extensions.api.edit.location.live.editLiveLocation"))
suspend fun TelegramBot.editLiveLocation(
chatId: ChatIdentifier,
messageId: MessageIdentifier,
@ -22,16 +23,13 @@ suspend fun TelegramBot.editLiveLocation(
heading: Degrees? = null,
proximityAlertRadius: Meters? = null,
replyMarkup: InlineKeyboardMarkup? = null
) = execute(
EditChatMessageLiveLocation(
chatId, messageId, latitude, longitude, horizontalAccuracy, heading, proximityAlertRadius, replyMarkup
)
)
) = 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
*/
@Deprecated("Replaced", ReplaceWith("editLiveLocation", "dev.inmo.tgbotapi.extensions.api.edit.location.live.editLiveLocation"))
suspend fun TelegramBot.editLiveLocation(
chat: Chat,
messageId: MessageIdentifier,
@ -41,12 +39,13 @@ suspend fun TelegramBot.editLiveLocation(
heading: Degrees? = null,
proximityAlertRadius: Meters? = null,
replyMarkup: InlineKeyboardMarkup? = null
) = editLiveLocation(chat.id, messageId, latitude, longitude, horizontalAccuracy, heading, proximityAlertRadius, replyMarkup)
) = 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
*/
@Deprecated("Replaced", ReplaceWith("editLiveLocation", "dev.inmo.tgbotapi.extensions.api.edit.location.live.editLiveLocation"))
suspend fun TelegramBot.editLiveLocation(
message: ContentMessage<LocationContent>,
latitude: Double,
@ -55,40 +54,39 @@ suspend fun TelegramBot.editLiveLocation(
heading: Degrees? = null,
proximityAlertRadius: Meters? = null,
replyMarkup: InlineKeyboardMarkup? = null
) = editLiveLocation(message.chat, message.messageId, latitude, longitude, horizontalAccuracy, heading, proximityAlertRadius, replyMarkup)
) = 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
*/
@Deprecated("Replaced", ReplaceWith("editLiveLocation", "dev.inmo.tgbotapi.extensions.api.edit.location.live.editLiveLocation"))
suspend fun TelegramBot.editLiveLocation(
chatId: ChatIdentifier,
messageId: MessageIdentifier,
location: LiveLocation,
replyMarkup: InlineKeyboardMarkup? = null
) = execute(
EditChatMessageLiveLocation(
chatId, messageId, location.latitude, location.longitude, location.horizontalAccuracy, location.heading, location.proximityAlertRadius, replyMarkup
)
)
) = editLiveLocation(chatId, messageId, location, replyMarkup)
/**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
* as a builder for that
*/
@Deprecated("Replaced", ReplaceWith("editLiveLocation", "dev.inmo.tgbotapi.extensions.api.edit.location.live.editLiveLocation"))
suspend fun TelegramBot.editLiveLocation(
chat: Chat,
messageId: MessageIdentifier,
location: LiveLocation,
replyMarkup: InlineKeyboardMarkup? = null
) = editLiveLocation(chat.id, messageId, location.latitude, location.longitude, location.horizontalAccuracy, location.heading, location.proximityAlertRadius, replyMarkup)
) = editLiveLocation(chat, messageId, location, replyMarkup)
/**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
* as a builder for that
*/
@Deprecated("Replaced", ReplaceWith("editLiveLocation", "dev.inmo.tgbotapi.extensions.api.edit.location.live.editLiveLocation"))
suspend fun TelegramBot.editLiveLocation(
message: ContentMessage<LocationContent>,
location: LiveLocation,
replyMarkup: InlineKeyboardMarkup? = null
) = editLiveLocation(message.chat, message.messageId, location.latitude, location.longitude, location.horizontalAccuracy, location.heading, location.proximityAlertRadius, replyMarkup)
) = editLiveLocation(message, location, replyMarkup)

View File

@ -1,11 +1,13 @@
package dev.inmo.tgbotapi.extensions.api.edit.LiveLocation
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.extensions.api.edit.location.live.editLiveLocation
import dev.inmo.tgbotapi.requests.edit.location.live.EditInlineMessageLiveLocation
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.location.LiveLocation
@Deprecated("Replaced", ReplaceWith("editLiveLocation", "dev.inmo.tgbotapi.extensions.api.edit.location.live.editLiveLocation"))
suspend fun TelegramBot.editLiveLocation(
inlineMessageId: InlineMessageIdentifier,
latitude: Double,
@ -14,13 +16,10 @@ suspend fun TelegramBot.editLiveLocation(
heading: Degrees? = null,
proximityAlertRadius: Meters? = null,
replyMarkup: InlineKeyboardMarkup? = null
) = execute(
EditInlineMessageLiveLocation(
inlineMessageId, latitude, longitude, horizontalAccuracy, heading, proximityAlertRadius, replyMarkup
)
)
) = editLiveLocation(inlineMessageId, latitude, longitude, horizontalAccuracy, heading, proximityAlertRadius, replyMarkup)
@Deprecated("Replaced", ReplaceWith("editLiveLocation", "dev.inmo.tgbotapi.extensions.api.edit.location.live.editLiveLocation"))
suspend fun TelegramBot.editLiveLocation(
inlineMessageId: InlineMessageIdentifier,
location: LiveLocation,
replyMarkup: InlineKeyboardMarkup? = null
) = editLiveLocation(inlineMessageId, location.latitude, location.longitude, location.horizontalAccuracy, location.heading, location.proximityAlertRadius, replyMarkup)
) = editLiveLocation(inlineMessageId, location, replyMarkup)

View File

@ -1,6 +1,7 @@
package dev.inmo.tgbotapi.extensions.api.edit.LiveLocation
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.extensions.api.edit.location.live.stopLiveLocation
import dev.inmo.tgbotapi.requests.edit.location.live.StopChatMessageLiveLocation
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.MessageIdentifier
@ -13,31 +14,30 @@ 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
*/
@Deprecated("Replaced", ReplaceWith("stopLiveLocation", "dev.inmo.tgbotapi.extensions.api.edit.location.live.stopLiveLocation"))
suspend fun TelegramBot.stopLiveLocation(
chatId: ChatIdentifier,
messageId: MessageIdentifier,
replyMarkup: InlineKeyboardMarkup? = null
) = execute(
StopChatMessageLiveLocation(
chatId, messageId, replyMarkup
)
)
) = stopLiveLocation(chatId, messageId, replyMarkup)
/**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
* as a builder for that
*/
@Deprecated("Replaced", ReplaceWith("stopLiveLocation", "dev.inmo.tgbotapi.extensions.api.edit.location.live.stopLiveLocation"))
suspend fun TelegramBot.stopLiveLocation(
chat: Chat,
messageId: MessageIdentifier,
replyMarkup: InlineKeyboardMarkup? = null
) = stopLiveLocation(chat.id, messageId, replyMarkup)
) = stopLiveLocation(chat, messageId, replyMarkup)
/**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
* as a builder for that
*/
@Deprecated("Replaced", ReplaceWith("stopLiveLocation", "dev.inmo.tgbotapi.extensions.api.edit.location.live.stopLiveLocation"))
suspend fun TelegramBot.stopLiveLocation(
message: ContentMessage<LocationContent>,
replyMarkup: InlineKeyboardMarkup? = null
) = stopLiveLocation(message.chat, message.messageId, replyMarkup)
) = stopLiveLocation(message, replyMarkup)

View File

@ -1,6 +1,7 @@
package dev.inmo.tgbotapi.extensions.api.edit.LiveLocation
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.extensions.api.edit.location.live.stopLiveLocation
import dev.inmo.tgbotapi.requests.edit.location.live.StopInlineMessageLiveLocation
import dev.inmo.tgbotapi.types.InlineMessageIdentifier
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
@ -9,11 +10,8 @@ import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
* as a builder for that
*/
@Deprecated("Replaced", ReplaceWith("stopLiveLocation", "dev.inmo.tgbotapi.extensions.api.edit.location.live.stopLiveLocation"))
suspend fun TelegramBot.stopLiveLocation(
inlineMessageId: InlineMessageIdentifier,
replyMarkup: InlineKeyboardMarkup? = null
) = execute(
StopInlineMessageLiveLocation(
inlineMessageId, replyMarkup
)
)
) = stopLiveLocation(inlineMessageId, replyMarkup)

View File

@ -1,7 +1,7 @@
package dev.inmo.tgbotapi.extensions.api.edit.ReplyMarkup
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.edit.ReplyMarkup.EditChatMessageReplyMarkup
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
@ -12,30 +12,31 @@ 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
*/
@Deprecated("Replaced", ReplaceWith("editMessageReplyMarkup", "dev.inmo.tgbotapi.extensions.api.edit.reply_markup.editMessageReplyMarkup"))
suspend fun TelegramBot.editMessageReplyMarkup(
chatId: ChatIdentifier,
messageId: MessageIdentifier,
replyMarkup: InlineKeyboardMarkup? = null
) = execute(
EditChatMessageReplyMarkup(chatId, messageId, replyMarkup)
)
) = editMessageReplyMarkup(chatId, messageId, replyMarkup)
/**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
* as a builder for that
*/
@Deprecated("Replaced", ReplaceWith("editMessageReplyMarkup", "dev.inmo.tgbotapi.extensions.api.edit.reply_markup.editMessageReplyMarkup"))
suspend fun TelegramBot.editMessageReplyMarkup(
chat: Chat,
messageId: MessageIdentifier,
replyMarkup: InlineKeyboardMarkup? = null
) = editMessageReplyMarkup(chat.id, messageId, replyMarkup)
) = editMessageReplyMarkup(chat, messageId, replyMarkup)
/**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
* as a builder for that
*/
@Deprecated("Replaced", ReplaceWith("editMessageReplyMarkup", "dev.inmo.tgbotapi.extensions.api.edit.reply_markup.editMessageReplyMarkup"))
suspend fun TelegramBot.editMessageReplyMarkup(
message: Message,
replyMarkup: InlineKeyboardMarkup? = null
) = editMessageReplyMarkup(message.chat.id, message.messageId, replyMarkup)
) = editMessageReplyMarkup(message, replyMarkup)

View File

@ -1,7 +1,8 @@
package dev.inmo.tgbotapi.extensions.api.edit.ReplyMarkup
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.edit.ReplyMarkup.EditInlineMessageReplyMarkup
import dev.inmo.tgbotapi.extensions.api.edit.reply_markup.editMessageReplyMarkup
import dev.inmo.tgbotapi.requests.edit.reply_markup.EditInlineMessageReplyMarkup
import dev.inmo.tgbotapi.types.InlineMessageIdentifier
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
@ -9,7 +10,8 @@ import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
* as a builder for that
*/
@Deprecated("Replaced", ReplaceWith("editMessageReplyMarkup", "dev.inmo.tgbotapi.extensions.api.edit.reply_markup.editMessageReplyMarkup"))
suspend fun TelegramBot.editMessageReplyMarkup(
inlineMessageId: InlineMessageIdentifier,
replyMarkup: InlineKeyboardMarkup? = null
) = execute(EditInlineMessageReplyMarkup(inlineMessageId, replyMarkup))
) = editMessageReplyMarkup(inlineMessageId, replyMarkup)

View File

@ -0,0 +1,94 @@
package dev.inmo.tgbotapi.extensions.api.edit.location.live
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.edit.location.live.EditChatMessageLiveLocation
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.editLiveLocation(
chatId: ChatIdentifier,
messageId: MessageIdentifier,
latitude: Double,
longitude: Double,
horizontalAccuracy: Meters? = null,
heading: Degrees? = null,
proximityAlertRadius: Meters? = null,
replyMarkup: InlineKeyboardMarkup? = null
) = execute(
EditChatMessageLiveLocation(
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.editLiveLocation(
chat: Chat,
messageId: MessageIdentifier,
latitude: Double,
longitude: Double,
horizontalAccuracy: Meters? = null,
heading: Degrees? = null,
proximityAlertRadius: Meters? = null,
replyMarkup: InlineKeyboardMarkup? = null
) = editLiveLocation(chat.id, 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.editLiveLocation(
message: ContentMessage<LocationContent>,
latitude: Double,
longitude: Double,
horizontalAccuracy: Meters? = null,
heading: Degrees? = null,
proximityAlertRadius: Meters? = null,
replyMarkup: InlineKeyboardMarkup? = null
) = editLiveLocation(message.chat, message.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.editLiveLocation(
chatId: ChatIdentifier,
messageId: MessageIdentifier,
location: LiveLocation,
replyMarkup: InlineKeyboardMarkup? = null
) = execute(
EditChatMessageLiveLocation(
chatId, messageId, location.latitude, location.longitude, location.horizontalAccuracy, location.heading, location.proximityAlertRadius, replyMarkup
)
)
/**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
* as a builder for that
*/
suspend fun TelegramBot.editLiveLocation(
chat: Chat,
messageId: MessageIdentifier,
location: LiveLocation,
replyMarkup: InlineKeyboardMarkup? = null
) = editLiveLocation(chat.id, messageId, location.latitude, location.longitude, location.horizontalAccuracy, location.heading, location.proximityAlertRadius, replyMarkup)
/**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
* as a builder for that
*/
suspend fun TelegramBot.editLiveLocation(
message: ContentMessage<LocationContent>,
location: LiveLocation,
replyMarkup: InlineKeyboardMarkup? = null
) = editLiveLocation(message.chat, message.messageId, location.latitude, location.longitude, location.horizontalAccuracy, location.heading, location.proximityAlertRadius, replyMarkup)

View File

@ -0,0 +1,26 @@
package dev.inmo.tgbotapi.extensions.api.edit.location.live
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.edit.location.live.EditInlineMessageLiveLocation
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.location.LiveLocation
suspend fun TelegramBot.editLiveLocation(
inlineMessageId: InlineMessageIdentifier,
latitude: Double,
longitude: Double,
horizontalAccuracy: Meters? = null,
heading: Degrees? = null,
proximityAlertRadius: Meters? = null,
replyMarkup: InlineKeyboardMarkup? = null
) = execute(
EditInlineMessageLiveLocation(
inlineMessageId, latitude, longitude, horizontalAccuracy, heading, proximityAlertRadius, replyMarkup
)
)
suspend fun TelegramBot.editLiveLocation(
inlineMessageId: InlineMessageIdentifier,
location: LiveLocation,
replyMarkup: InlineKeyboardMarkup? = null
) = editLiveLocation(inlineMessageId, location.latitude, location.longitude, location.horizontalAccuracy, location.heading, location.proximityAlertRadius, replyMarkup)

View File

@ -0,0 +1,43 @@
package dev.inmo.tgbotapi.extensions.api.edit.location.live
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.edit.location.live.StopChatMessageLiveLocation
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.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.stopLiveLocation(
chatId: ChatIdentifier,
messageId: MessageIdentifier,
replyMarkup: InlineKeyboardMarkup? = null
) = execute(
StopChatMessageLiveLocation(
chatId, messageId, replyMarkup
)
)
/**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
* as a builder for that
*/
suspend fun TelegramBot.stopLiveLocation(
chat: Chat,
messageId: MessageIdentifier,
replyMarkup: InlineKeyboardMarkup? = null
) = stopLiveLocation(chat.id, messageId, replyMarkup)
/**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
* as a builder for that
*/
suspend fun TelegramBot.stopLiveLocation(
message: ContentMessage<LocationContent>,
replyMarkup: InlineKeyboardMarkup? = null
) = stopLiveLocation(message.chat, message.messageId, replyMarkup)

View File

@ -0,0 +1,19 @@
package dev.inmo.tgbotapi.extensions.api.edit.location.live
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.edit.location.live.StopInlineMessageLiveLocation
import dev.inmo.tgbotapi.types.InlineMessageIdentifier
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
/**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
* as a builder for that
*/
suspend fun TelegramBot.stopLiveLocation(
inlineMessageId: InlineMessageIdentifier,
replyMarkup: InlineKeyboardMarkup? = null
) = execute(
StopInlineMessageLiveLocation(
inlineMessageId, replyMarkup
)
)

View File

@ -0,0 +1,41 @@
package dev.inmo.tgbotapi.extensions.api.edit.reply_markup
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.edit.reply_markup.EditChatMessageReplyMarkup
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.editMessageReplyMarkup(
chatId: ChatIdentifier,
messageId: MessageIdentifier,
replyMarkup: InlineKeyboardMarkup? = null
) = execute(
EditChatMessageReplyMarkup(chatId, messageId, replyMarkup)
)
/**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
* as a builder for that
*/
suspend fun TelegramBot.editMessageReplyMarkup(
chat: Chat,
messageId: MessageIdentifier,
replyMarkup: InlineKeyboardMarkup? = null
) = editMessageReplyMarkup(chat.id, messageId, replyMarkup)
/**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
* as a builder for that
*/
suspend fun TelegramBot.editMessageReplyMarkup(
message: Message,
replyMarkup: InlineKeyboardMarkup? = null
) = editMessageReplyMarkup(message.chat.id, message.messageId, replyMarkup)

View File

@ -0,0 +1,15 @@
package dev.inmo.tgbotapi.extensions.api.edit.reply_markup
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.edit.reply_markup.EditInlineMessageReplyMarkup
import dev.inmo.tgbotapi.types.InlineMessageIdentifier
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
/**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
* as a builder for that
*/
suspend fun TelegramBot.editMessageReplyMarkup(
inlineMessageId: InlineMessageIdentifier,
replyMarkup: InlineKeyboardMarkup? = null
) = execute(EditInlineMessageReplyMarkup(inlineMessageId, replyMarkup))

View File

@ -1,31 +1,7 @@
package dev.inmo.tgbotapi.requests.edit.ReplyMarkup
import dev.inmo.tgbotapi.requests.edit.abstracts.EditChatMessage
import dev.inmo.tgbotapi.requests.edit.abstracts.EditReplyMessage
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
import dev.inmo.tgbotapi.types.message.content.MessageContent
import kotlinx.serialization.*
@Deprecated("Replaced", ReplaceWith("editMessageReplyMarkupMethod", "dev.inmo.tgbotapi.requests.edit.reply_markup.editMessageReplyMarkupMethod"))
const val editMessageReplyMarkupMethod = dev.inmo.tgbotapi.requests.edit.reply_markup.editMessageReplyMarkupMethod
const val editMessageReplyMarkupMethod = "editMessageReplyMarkup"
private val commonResultDeserializer = TelegramBotAPIMessageDeserializationStrategyClass<ContentMessage<MessageContent>>()
@Serializable
data class EditChatMessageReplyMarkup(
@SerialName(chatIdField)
override val chatId: ChatIdentifier,
@SerialName(messageIdField)
override val messageId: MessageIdentifier,
@SerialName(replyMarkupField)
override val replyMarkup: InlineKeyboardMarkup? = null
) : EditChatMessage<MessageContent>, EditReplyMessage {
override fun method(): String = editMessageReplyMarkupMethod
override val resultDeserializer: DeserializationStrategy<ContentMessage<MessageContent>>
get() = commonResultDeserializer
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
}
@Deprecated("Replaced", ReplaceWith("EditChatMessageReplyMarkup", "dev.inmo.tgbotapi.requests.edit.reply_markup.EditChatMessageReplyMarkup"))
typealias EditChatMessageReplyMarkup = dev.inmo.tgbotapi.requests.edit.reply_markup.EditChatMessageReplyMarkup

View File

@ -1,19 +1,4 @@
package dev.inmo.tgbotapi.requests.edit.ReplyMarkup
import dev.inmo.tgbotapi.requests.edit.abstracts.EditInlineMessage
import dev.inmo.tgbotapi.requests.edit.abstracts.EditReplyMessage
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import kotlinx.serialization.*
@Serializable
data class EditInlineMessageReplyMarkup(
@SerialName(inlineMessageIdField)
override val inlineMessageId: InlineMessageIdentifier,
@SerialName(replyMarkupField)
override val replyMarkup: InlineKeyboardMarkup? = null
) : EditInlineMessage, EditReplyMessage {
override fun method(): String = editMessageReplyMarkupMethod
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
}
@Deprecated("Replaced", ReplaceWith("EditInlineMessageReplyMarkup", "dev.inmo.tgbotapi.requests.edit.reply_markup.EditInlineMessageReplyMarkup"))
typealias EditInlineMessageReplyMarkup = dev.inmo.tgbotapi.requests.edit.reply_markup.EditInlineMessageReplyMarkup

View File

@ -0,0 +1,31 @@
package dev.inmo.tgbotapi.requests.edit.reply_markup
import dev.inmo.tgbotapi.requests.edit.abstracts.EditChatMessage
import dev.inmo.tgbotapi.requests.edit.abstracts.EditReplyMessage
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
import dev.inmo.tgbotapi.types.message.content.MessageContent
import kotlinx.serialization.*
const val editMessageReplyMarkupMethod = "editMessageReplyMarkup"
private val commonResultDeserializer = TelegramBotAPIMessageDeserializationStrategyClass<ContentMessage<MessageContent>>()
@Serializable
data class EditChatMessageReplyMarkup(
@SerialName(chatIdField)
override val chatId: ChatIdentifier,
@SerialName(messageIdField)
override val messageId: MessageIdentifier,
@SerialName(replyMarkupField)
override val replyMarkup: InlineKeyboardMarkup? = null
) : EditChatMessage<MessageContent>, EditReplyMessage {
override fun method(): String = editMessageReplyMarkupMethod
override val resultDeserializer: DeserializationStrategy<ContentMessage<MessageContent>>
get() = commonResultDeserializer
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
}

View File

@ -0,0 +1,19 @@
package dev.inmo.tgbotapi.requests.edit.reply_markup
import dev.inmo.tgbotapi.requests.edit.abstracts.EditInlineMessage
import dev.inmo.tgbotapi.requests.edit.abstracts.EditReplyMessage
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import kotlinx.serialization.*
@Serializable
data class EditInlineMessageReplyMarkup(
@SerialName(inlineMessageIdField)
override val inlineMessageId: InlineMessageIdentifier,
@SerialName(replyMarkupField)
override val replyMarkup: InlineKeyboardMarkup? = null
) : EditInlineMessage, EditReplyMessage {
override fun method(): String = editMessageReplyMarkupMethod
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
}