mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 08:13:47 +00:00
CallbackQuery package -> queries.callback
This commit is contained in:
parent
2275a61d73
commit
cdd5649c04
@ -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`
|
||||
|
@ -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(
|
||||
|
@ -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<T> = suspend T.() -> T?
|
||||
|
@ -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
|
||||
|
@ -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 : BehaviourContext, reified T : CallbackQuery> BC.onCallbackQuery(
|
||||
|
@ -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
|
||||
|
@ -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 {
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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<MessageContent>
|
||||
}
|
||||
@Deprecated("Replaced", ReplaceWith("MessageCallbackQuery", "dev.inmo.tgbotapi.types.queries.callback.MessageCallbackQuery"))
|
||||
typealias MessageCallbackQuery = dev.inmo.tgbotapi.types.queries.callback.MessageCallbackQuery
|
||||
|
@ -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<MessageContent>,
|
||||
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
|
||||
|
@ -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<MessageContent>,
|
||||
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
|
||||
|
@ -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
|
||||
|
@ -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
|
@ -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
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
package dev.inmo.tgbotapi.types.queries.callback
|
||||
|
||||
sealed interface GameShortNameCallbackQuery : CallbackQuery {
|
||||
val gameShortName: String
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package dev.inmo.tgbotapi.types.queries.callback
|
||||
|
||||
import dev.inmo.tgbotapi.types.InlineMessageIdentifier
|
||||
|
||||
sealed interface InlineMessageIdCallbackQuery : CallbackQuery {
|
||||
val inlineMessageId: InlineMessageIdentifier
|
||||
}
|
@ -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
|
@ -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
|
@ -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<MessageContent>
|
||||
}
|
@ -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<MessageContent>,
|
||||
override val data: String
|
||||
) : DataCallbackQuery, MessageCallbackQuery
|
@ -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<MessageContent>,
|
||||
override val gameShortName: String
|
||||
) : GameShortNameCallbackQuery, MessageCallbackQuery
|
@ -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.*
|
@ -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
|
||||
|
||||
|
@ -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.*
|
||||
|
@ -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
|
||||
|
||||
|
@ -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.*
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user