diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c714c0369..3f28bca6b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ __All the `tgbotapi.extensions.*` packages have been removed__ * `Core`: * **`Ktor` package renamed. Migration:** `dev.inmo.tgbotapi.bot.Ktor` -> `dev.inmo.tgbotapi.bot.ktor` + * **`CallbackQuery` package renamed. Migration:** `dev.inmo.tgbotapi.types.CallbackQuery([\s\\.])` -> `dev.inmo.tgbotapi.types.queries.callback$1` * 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` diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/answers/AnswerCallbackQuery.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/answers/AnswerCallbackQuery.kt index ac14d1dff6..7de2ae0b62 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/answers/AnswerCallbackQuery.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/answers/AnswerCallbackQuery.kt @@ -2,7 +2,7 @@ package dev.inmo.tgbotapi.extensions.api.answers import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.requests.answers.AnswerCallbackQuery -import dev.inmo.tgbotapi.types.CallbackQuery.CallbackQuery +import dev.inmo.tgbotapi.types.queries.callback.CallbackQuery import dev.inmo.tgbotapi.types.CallbackQueryIdentifier suspend fun TelegramBot.answerCallbackQuery( diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitCallbackQuery.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitCallbackQuery.kt index 87d810862d..2c51e9ef2f 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitCallbackQuery.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitCallbackQuery.kt @@ -6,7 +6,7 @@ import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.SimpleFilter import dev.inmo.tgbotapi.extensions.utils.asCallbackQueryUpdate import dev.inmo.tgbotapi.requests.abstracts.Request -import dev.inmo.tgbotapi.types.CallbackQuery.* +import dev.inmo.tgbotapi.types.queries.callback.* import kotlinx.coroutines.flow.toList typealias CallbackQueryMapper = suspend T.() -> T? diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/filters/MessageFilterByChat.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/filters/MessageFilterByChat.kt index c0877ce42b..d9bef61486 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/filters/MessageFilterByChat.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/filters/MessageFilterByChat.kt @@ -2,7 +2,7 @@ package dev.inmo.tgbotapi.extensions.behaviour_builder.filters import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver import dev.inmo.tgbotapi.extensions.utils.extensions.sourceChat -import dev.inmo.tgbotapi.types.CallbackQuery.CallbackQuery +import dev.inmo.tgbotapi.types.queries.callback.CallbackQuery import dev.inmo.tgbotapi.types.ChatJoinRequest import dev.inmo.tgbotapi.types.ChatMemberUpdated import dev.inmo.tgbotapi.types.InlineQueries.query.InlineQuery diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/CallbackQueryTriggers.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/CallbackQueryTriggers.kt index a6adbedc43..d5b61538ae 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/CallbackQueryTriggers.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/CallbackQueryTriggers.kt @@ -8,7 +8,7 @@ import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.SimpleFilter import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.ByUserCallbackQueryMarkerFactory import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.MarkerFactory import dev.inmo.tgbotapi.extensions.utils.asCallbackQueryUpdate -import dev.inmo.tgbotapi.types.CallbackQuery.* +import dev.inmo.tgbotapi.types.queries.callback.* import dev.inmo.tgbotapi.types.update.abstracts.Update internal suspend inline fun BC.onCallbackQuery( diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/QueryMarkerFactories.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/QueryMarkerFactories.kt index 5f831e6fbd..52698281d7 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/QueryMarkerFactories.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/QueryMarkerFactories.kt @@ -1,6 +1,6 @@ package dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories -import dev.inmo.tgbotapi.types.CallbackQuery.CallbackQuery +import dev.inmo.tgbotapi.types.queries.callback.CallbackQuery import dev.inmo.tgbotapi.types.ChatJoinRequest import dev.inmo.tgbotapi.types.payments.PreCheckoutQuery import dev.inmo.tgbotapi.types.payments.ShippingQuery diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/CommonAbstracts/FromUser.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/CommonAbstracts/FromUser.kt index 698f36c45a..a07564d9c9 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/CommonAbstracts/FromUser.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/CommonAbstracts/FromUser.kt @@ -3,7 +3,7 @@ package dev.inmo.tgbotapi.CommonAbstracts import dev.inmo.tgbotapi.types.User /** - * Inheritors of this interface have some [User] as a source of data. For example, any [dev.inmo.tgbotapi.types.CallbackQuery.CallbackQuery] + * Inheritors of this interface have some [User] as a source of data. For example, any [dev.inmo.tgbotapi.types.queries.callback.CallbackQuery] * have [User] as the source of that query */ interface FromUser : WithUser { diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/answers/AnswerCallbackQuery.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/answers/AnswerCallbackQuery.kt index 00cb73f39a..49e0609fef 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/answers/AnswerCallbackQuery.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/answers/AnswerCallbackQuery.kt @@ -2,7 +2,7 @@ package dev.inmo.tgbotapi.requests.answers import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest import dev.inmo.tgbotapi.types.* -import dev.inmo.tgbotapi.types.CallbackQuery.CallbackQuery +import dev.inmo.tgbotapi.types.queries.callback.CallbackQuery import kotlinx.serialization.* import kotlinx.serialization.builtins.serializer diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/CallbackQuery/CallbackQuery.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/CallbackQuery/CallbackQuery.kt index dbbd8a2699..c5bcff1c70 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/CallbackQuery/CallbackQuery.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/CallbackQuery/CallbackQuery.kt @@ -1,17 +1,7 @@ package dev.inmo.tgbotapi.types.CallbackQuery -import dev.inmo.tgbotapi.CommonAbstracts.FromUser -import dev.inmo.tgbotapi.types.CallbackQueryIdentifier -import dev.inmo.tgbotapi.types.User +@Deprecated("Replaced", ReplaceWith("CallbackQuery", "dev.inmo.tgbotapi.types.queries.callback.CallbackQuery")) +typealias CallbackQuery = dev.inmo.tgbotapi.types.queries.callback.CallbackQuery -sealed interface CallbackQuery : FromUser { - val id: CallbackQueryIdentifier - val chatInstance: String -} - -data class UnknownCallbackQueryType( - override val id: CallbackQueryIdentifier, - override val from: User, - override val chatInstance: String, - val raw: String -) : CallbackQuery +@Deprecated("Replaced", ReplaceWith("UnknownCallbackQueryType", "dev.inmo.tgbotapi.types.queries.callback.UnknownCallbackQueryType")) +typealias UnknownCallbackQueryType = dev.inmo.tgbotapi.types.queries.callback.UnknownCallbackQueryType diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/CallbackQuery/DataCallbackQuery.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/CallbackQuery/DataCallbackQuery.kt index 9858b3a996..80152765da 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/CallbackQuery/DataCallbackQuery.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/CallbackQuery/DataCallbackQuery.kt @@ -1,10 +1,4 @@ package dev.inmo.tgbotapi.types.CallbackQuery -/** - * [CallbackQuery] with [data] field - * - * @see dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons.CallbackDataInlineKeyboardButton - */ -sealed interface DataCallbackQuery : CallbackQuery { - val data: String -} +@Deprecated("Replaced", ReplaceWith("DataCallbackQuery", "dev.inmo.tgbotapi.types.queries.callback.DataCallbackQuery")) +typealias DataCallbackQuery = dev.inmo.tgbotapi.types.queries.callback.DataCallbackQuery diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/CallbackQuery/GameShortNameCallbackQuery.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/CallbackQuery/GameShortNameCallbackQuery.kt index 512f5f02d4..a200ae40db 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/CallbackQuery/GameShortNameCallbackQuery.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/CallbackQuery/GameShortNameCallbackQuery.kt @@ -1,5 +1,4 @@ package dev.inmo.tgbotapi.types.CallbackQuery -sealed interface GameShortNameCallbackQuery : CallbackQuery { - val gameShortName: String -} +@Deprecated("Replaced", ReplaceWith("GameShortNameCallbackQuery", "dev.inmo.tgbotapi.types.queries.callback.GameShortNameCallbackQuery")) +typealias GameShortNameCallbackQuery = dev.inmo.tgbotapi.types.queries.callback.GameShortNameCallbackQuery diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/CallbackQuery/InlineMessageIdCallbackQuery.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/CallbackQuery/InlineMessageIdCallbackQuery.kt index 4c23c6d8d6..37eb7a8c69 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/CallbackQuery/InlineMessageIdCallbackQuery.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/CallbackQuery/InlineMessageIdCallbackQuery.kt @@ -1,7 +1,4 @@ package dev.inmo.tgbotapi.types.CallbackQuery -import dev.inmo.tgbotapi.types.InlineMessageIdentifier - -sealed interface InlineMessageIdCallbackQuery : CallbackQuery { - val inlineMessageId: InlineMessageIdentifier -} +@Deprecated("Replaced", ReplaceWith("InlineMessageIdCallbackQuery", "dev.inmo.tgbotapi.types.queries.callback.InlineMessageIdCallbackQuery")) +typealias InlineMessageIdCallbackQuery = dev.inmo.tgbotapi.types.queries.callback.InlineMessageIdCallbackQuery diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/CallbackQuery/InlineMessageIdDataCallbackQuery.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/CallbackQuery/InlineMessageIdDataCallbackQuery.kt index bdb013340e..5d49e5bcb3 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/CallbackQuery/InlineMessageIdDataCallbackQuery.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/CallbackQuery/InlineMessageIdDataCallbackQuery.kt @@ -1,11 +1,4 @@ package dev.inmo.tgbotapi.types.CallbackQuery -import dev.inmo.tgbotapi.types.* - -data class InlineMessageIdDataCallbackQuery( - override val id: CallbackQueryIdentifier, - override val from: User, - override val chatInstance: String, - override val inlineMessageId: InlineMessageIdentifier, - override val data: String -) : DataCallbackQuery, InlineMessageIdCallbackQuery +@Deprecated("Replaced", ReplaceWith("InlineMessageIdDataCallbackQuery", "dev.inmo.tgbotapi.types.queries.callback.InlineMessageIdDataCallbackQuery")) +typealias InlineMessageIdDataCallbackQuery = dev.inmo.tgbotapi.types.queries.callback.InlineMessageIdDataCallbackQuery diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/CallbackQuery/InlineMessageIdGameShortNameCallbackQuery.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/CallbackQuery/InlineMessageIdGameShortNameCallbackQuery.kt index 8369e71332..d133eb4a5f 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/CallbackQuery/InlineMessageIdGameShortNameCallbackQuery.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/CallbackQuery/InlineMessageIdGameShortNameCallbackQuery.kt @@ -1,11 +1,4 @@ package dev.inmo.tgbotapi.types.CallbackQuery -import dev.inmo.tgbotapi.types.* - -data class InlineMessageIdGameShortNameCallbackQuery( - override val id: CallbackQueryIdentifier, - override val from: User, - override val chatInstance: String, - override val inlineMessageId: InlineMessageIdentifier, - override val gameShortName: String -) : GameShortNameCallbackQuery, InlineMessageIdCallbackQuery +@Deprecated("Replaced", ReplaceWith("InlineMessageIdGameShortNameCallbackQuery", "dev.inmo.tgbotapi.types.queries.callback.InlineMessageIdGameShortNameCallbackQuery")) +typealias InlineMessageIdGameShortNameCallbackQuery = dev.inmo.tgbotapi.types.queries.callback.InlineMessageIdGameShortNameCallbackQuery diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/CallbackQuery/MessageCallbackQuery.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/CallbackQuery/MessageCallbackQuery.kt index 7db3589341..07f1c2bf88 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/CallbackQuery/MessageCallbackQuery.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/CallbackQuery/MessageCallbackQuery.kt @@ -1,8 +1,4 @@ package dev.inmo.tgbotapi.types.CallbackQuery -import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage -import dev.inmo.tgbotapi.types.message.content.abstracts.MessageContent - -sealed interface MessageCallbackQuery : CallbackQuery { - val message: ContentMessage -} +@Deprecated("Replaced", ReplaceWith("MessageCallbackQuery", "dev.inmo.tgbotapi.types.queries.callback.MessageCallbackQuery")) +typealias MessageCallbackQuery = dev.inmo.tgbotapi.types.queries.callback.MessageCallbackQuery diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/CallbackQuery/MessageDataCallbackQuery.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/CallbackQuery/MessageDataCallbackQuery.kt index fac77ae179..10fa1bf4f7 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/CallbackQuery/MessageDataCallbackQuery.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/CallbackQuery/MessageDataCallbackQuery.kt @@ -1,14 +1,4 @@ package dev.inmo.tgbotapi.types.CallbackQuery -import dev.inmo.tgbotapi.types.CallbackQueryIdentifier -import dev.inmo.tgbotapi.types.User -import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage -import dev.inmo.tgbotapi.types.message.content.abstracts.MessageContent - -data class MessageDataCallbackQuery( - override val id: CallbackQueryIdentifier, - override val from: User, - override val chatInstance: String, - override val message: ContentMessage, - override val data: String -) : DataCallbackQuery, MessageCallbackQuery +@Deprecated("Replaced", ReplaceWith("MessageDataCallbackQuery", "dev.inmo.tgbotapi.types.queries.callback.MessageDataCallbackQuery")) +typealias MessageDataCallbackQuery = dev.inmo.tgbotapi.types.queries.callback.MessageDataCallbackQuery diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/CallbackQuery/MessageGameShortNameCallbackQuery.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/CallbackQuery/MessageGameShortNameCallbackQuery.kt index 88c66aca9a..ac2ce35f72 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/CallbackQuery/MessageGameShortNameCallbackQuery.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/CallbackQuery/MessageGameShortNameCallbackQuery.kt @@ -1,14 +1,4 @@ package dev.inmo.tgbotapi.types.CallbackQuery -import dev.inmo.tgbotapi.types.CallbackQueryIdentifier -import dev.inmo.tgbotapi.types.User -import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage -import dev.inmo.tgbotapi.types.message.content.abstracts.MessageContent - -data class MessageGameShortNameCallbackQuery( - override val id: CallbackQueryIdentifier, - override val from: User, - override val chatInstance: String, - override val message: ContentMessage, - override val gameShortName: String -) : GameShortNameCallbackQuery, MessageCallbackQuery +@Deprecated("Replaced", ReplaceWith("MessageGameShortNameCallbackQuery", "dev.inmo.tgbotapi.types.queries.callback.MessageGameShortNameCallbackQuery")) +typealias MessageGameShortNameCallbackQuery = dev.inmo.tgbotapi.types.queries.callback.MessageGameShortNameCallbackQuery diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/InlineKeyboardButtons/InlineKeyboardButton.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/InlineKeyboardButtons/InlineKeyboardButton.kt index a3f95bce73..5117b6dfde 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/InlineKeyboardButtons/InlineKeyboardButton.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/InlineKeyboardButtons/InlineKeyboardButton.kt @@ -43,14 +43,14 @@ data class PayInlineKeyboardButton( * Simple button with [callbackData] which you are able to catch this type of updates and data using * [dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.onDataCallbackQuery] in * case you are using Behaviour Builder OR [dev.inmo.tgbotapi.updateshandlers.FlowsUpdatesFilter.callbackQueriesFlow] - * with [kotlinx.coroutines.flow.filterIsInstance] and filtering by type [dev.inmo.tgbotapi.types.CallbackQuery.DataCallbackQuery] + * with [kotlinx.coroutines.flow.filterIsInstance] and filtering by type [dev.inmo.tgbotapi.types.queries.callback.DataCallbackQuery] */ @Serializable data class CallbackDataInlineKeyboardButton( @SerialName(textField) override val text: String, /** - * You will receive this data in [dev.inmo.tgbotapi.types.CallbackQuery.DataCallbackQuery.data] field + * You will receive this data in [dev.inmo.tgbotapi.types.queries.callback.DataCallbackQuery.data] field */ @SerialName(callbackDataField) val callbackData: String diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/queries/callback/CallbackQuery.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/queries/callback/CallbackQuery.kt new file mode 100644 index 0000000000..a08bc6af86 --- /dev/null +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/queries/callback/CallbackQuery.kt @@ -0,0 +1,17 @@ +package dev.inmo.tgbotapi.types.queries.callback + +import dev.inmo.tgbotapi.CommonAbstracts.FromUser +import dev.inmo.tgbotapi.types.CallbackQueryIdentifier +import dev.inmo.tgbotapi.types.User + +sealed interface CallbackQuery : FromUser { + val id: CallbackQueryIdentifier + val chatInstance: String +} + +data class UnknownCallbackQueryType( + override val id: CallbackQueryIdentifier, + override val from: User, + override val chatInstance: String, + val raw: String +) : CallbackQuery diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/queries/callback/DataCallbackQuery.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/queries/callback/DataCallbackQuery.kt new file mode 100644 index 0000000000..d40749d007 --- /dev/null +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/queries/callback/DataCallbackQuery.kt @@ -0,0 +1,10 @@ +package dev.inmo.tgbotapi.types.queries.callback + +/** + * [CallbackQuery] with [data] field + * + * @see dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons.CallbackDataInlineKeyboardButton + */ +sealed interface DataCallbackQuery : CallbackQuery { + val data: String +} diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/queries/callback/GameShortNameCallbackQuery.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/queries/callback/GameShortNameCallbackQuery.kt new file mode 100644 index 0000000000..8c63f76a43 --- /dev/null +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/queries/callback/GameShortNameCallbackQuery.kt @@ -0,0 +1,5 @@ +package dev.inmo.tgbotapi.types.queries.callback + +sealed interface GameShortNameCallbackQuery : CallbackQuery { + val gameShortName: String +} diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/queries/callback/InlineMessageIdCallbackQuery.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/queries/callback/InlineMessageIdCallbackQuery.kt new file mode 100644 index 0000000000..dd468bf0f4 --- /dev/null +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/queries/callback/InlineMessageIdCallbackQuery.kt @@ -0,0 +1,7 @@ +package dev.inmo.tgbotapi.types.queries.callback + +import dev.inmo.tgbotapi.types.InlineMessageIdentifier + +sealed interface InlineMessageIdCallbackQuery : CallbackQuery { + val inlineMessageId: InlineMessageIdentifier +} diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/queries/callback/InlineMessageIdDataCallbackQuery.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/queries/callback/InlineMessageIdDataCallbackQuery.kt new file mode 100644 index 0000000000..693e0c1024 --- /dev/null +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/queries/callback/InlineMessageIdDataCallbackQuery.kt @@ -0,0 +1,11 @@ +package dev.inmo.tgbotapi.types.queries.callback + +import dev.inmo.tgbotapi.types.* + +data class InlineMessageIdDataCallbackQuery( + override val id: CallbackQueryIdentifier, + override val from: User, + override val chatInstance: String, + override val inlineMessageId: InlineMessageIdentifier, + override val data: String +) : DataCallbackQuery, InlineMessageIdCallbackQuery diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/queries/callback/InlineMessageIdGameShortNameCallbackQuery.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/queries/callback/InlineMessageIdGameShortNameCallbackQuery.kt new file mode 100644 index 0000000000..4d0104494b --- /dev/null +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/queries/callback/InlineMessageIdGameShortNameCallbackQuery.kt @@ -0,0 +1,11 @@ +package dev.inmo.tgbotapi.types.queries.callback + +import dev.inmo.tgbotapi.types.* + +data class InlineMessageIdGameShortNameCallbackQuery( + override val id: CallbackQueryIdentifier, + override val from: User, + override val chatInstance: String, + override val inlineMessageId: InlineMessageIdentifier, + override val gameShortName: String +) : GameShortNameCallbackQuery, InlineMessageIdCallbackQuery diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/queries/callback/MessageCallbackQuery.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/queries/callback/MessageCallbackQuery.kt new file mode 100644 index 0000000000..1c1e1c04b5 --- /dev/null +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/queries/callback/MessageCallbackQuery.kt @@ -0,0 +1,8 @@ +package dev.inmo.tgbotapi.types.queries.callback + +import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage +import dev.inmo.tgbotapi.types.message.content.abstracts.MessageContent + +sealed interface MessageCallbackQuery : CallbackQuery { + val message: ContentMessage +} diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/queries/callback/MessageDataCallbackQuery.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/queries/callback/MessageDataCallbackQuery.kt new file mode 100644 index 0000000000..d7803de69c --- /dev/null +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/queries/callback/MessageDataCallbackQuery.kt @@ -0,0 +1,14 @@ +package dev.inmo.tgbotapi.types.queries.callback + +import dev.inmo.tgbotapi.types.CallbackQueryIdentifier +import dev.inmo.tgbotapi.types.User +import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage +import dev.inmo.tgbotapi.types.message.content.abstracts.MessageContent + +data class MessageDataCallbackQuery( + override val id: CallbackQueryIdentifier, + override val from: User, + override val chatInstance: String, + override val message: ContentMessage, + override val data: String +) : DataCallbackQuery, MessageCallbackQuery diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/queries/callback/MessageGameShortNameCallbackQuery.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/queries/callback/MessageGameShortNameCallbackQuery.kt new file mode 100644 index 0000000000..0939c57311 --- /dev/null +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/queries/callback/MessageGameShortNameCallbackQuery.kt @@ -0,0 +1,14 @@ +package dev.inmo.tgbotapi.types.queries.callback + +import dev.inmo.tgbotapi.types.CallbackQueryIdentifier +import dev.inmo.tgbotapi.types.User +import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage +import dev.inmo.tgbotapi.types.message.content.abstracts.MessageContent + +data class MessageGameShortNameCallbackQuery( + override val id: CallbackQueryIdentifier, + override val from: User, + override val chatInstance: String, + override val message: ContentMessage, + override val gameShortName: String +) : GameShortNameCallbackQuery, MessageCallbackQuery diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/CallbackQuery/RawCallbackQuery.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/queries/callback/RawCallbackQuery.kt similarity index 97% rename from tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/CallbackQuery/RawCallbackQuery.kt rename to tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/queries/callback/RawCallbackQuery.kt index 379095335d..02bf3b191b 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/CallbackQuery/RawCallbackQuery.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/queries/callback/RawCallbackQuery.kt @@ -1,4 +1,4 @@ -package dev.inmo.tgbotapi.types.CallbackQuery +package dev.inmo.tgbotapi.types.queries.callback import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.message.abstracts.* diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/update/CallbackQueryUpdate.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/update/CallbackQueryUpdate.kt index df96895d3e..aa4a4b2c55 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/update/CallbackQueryUpdate.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/update/CallbackQueryUpdate.kt @@ -1,6 +1,6 @@ package dev.inmo.tgbotapi.types.update -import dev.inmo.tgbotapi.types.CallbackQuery.CallbackQuery +import dev.inmo.tgbotapi.types.queries.callback.CallbackQuery import dev.inmo.tgbotapi.types.UpdateIdentifier import dev.inmo.tgbotapi.types.update.abstracts.Update diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/update/RawUpdate.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/update/RawUpdate.kt index bde9d23dd1..8232e287b0 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/update/RawUpdate.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/update/RawUpdate.kt @@ -1,7 +1,7 @@ package dev.inmo.tgbotapi.types.update import dev.inmo.tgbotapi.types.* -import dev.inmo.tgbotapi.types.CallbackQuery.RawCallbackQuery +import dev.inmo.tgbotapi.types.queries.callback.RawCallbackQuery import dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult.RawChosenInlineResult import dev.inmo.tgbotapi.types.InlineQueries.query.RawInlineQuery import dev.inmo.tgbotapi.types.message.abstracts.* diff --git a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/CallbackQueryConversations.kt b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/CallbackQueryConversations.kt index 159a22a762..2d38fc0150 100644 --- a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/CallbackQueryConversations.kt +++ b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/CallbackQueryConversations.kt @@ -1,6 +1,6 @@ package dev.inmo.tgbotapi.extensions.utils -import dev.inmo.tgbotapi.types.CallbackQuery.* +import dev.inmo.tgbotapi.types.queries.callback.* import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.mapNotNull diff --git a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/ClassCasts.kt b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/ClassCasts.kt index ed84b41075..862b25a2aa 100644 --- a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/ClassCasts.kt +++ b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/ClassCasts.kt @@ -5,7 +5,7 @@ package dev.inmo.tgbotapi.extensions.utils import dev.inmo.tgbotapi.CommonAbstracts.* import dev.inmo.tgbotapi.requests.send.payments.SendInvoice import dev.inmo.tgbotapi.types.* -import dev.inmo.tgbotapi.types.CallbackQuery.* +import dev.inmo.tgbotapi.types.queries.callback.* import dev.inmo.tgbotapi.types.ChatMember.* import dev.inmo.tgbotapi.types.ChatMember.abstracts.* import dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult.* diff --git a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/extensions/raw/CallbackQuery.kt b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/extensions/raw/CallbackQuery.kt index ea1f5161ca..f048a62fa5 100644 --- a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/extensions/raw/CallbackQuery.kt +++ b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/extensions/raw/CallbackQuery.kt @@ -1,7 +1,7 @@ package dev.inmo.tgbotapi.extensions.utils.extensions.raw import dev.inmo.tgbotapi.extensions.utils.* -import dev.inmo.tgbotapi.types.CallbackQuery.CallbackQuery +import dev.inmo.tgbotapi.types.queries.callback.CallbackQuery import dev.inmo.tgbotapi.types.InlineMessageIdentifier import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage import dev.inmo.tgbotapi.types.message.content.abstracts.MessageContent diff --git a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/updates/CallbackQueryUpdatesConversations.kt b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/updates/CallbackQueryUpdatesConversations.kt index aaf1f49a13..809da4c258 100644 --- a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/updates/CallbackQueryUpdatesConversations.kt +++ b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/updates/CallbackQueryUpdatesConversations.kt @@ -1,6 +1,6 @@ package dev.inmo.tgbotapi.extensions.utils.updates -import dev.inmo.tgbotapi.types.CallbackQuery.* +import dev.inmo.tgbotapi.types.queries.callback.* import dev.inmo.tgbotapi.types.update.CallbackQueryUpdate import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.mapNotNull