mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-29 13:38:43 +00:00
add FromUser interface to objects where field user
is present
This commit is contained in:
parent
30c138029e
commit
022e6f623a
@ -1,11 +1,11 @@
|
|||||||
package dev.inmo.tgbotapi.types.CallbackQuery
|
package dev.inmo.tgbotapi.types.CallbackQuery
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.CommonAbstracts.FromUser
|
||||||
import dev.inmo.tgbotapi.types.CallbackQueryIdentifier
|
import dev.inmo.tgbotapi.types.CallbackQueryIdentifier
|
||||||
import dev.inmo.tgbotapi.types.User
|
import dev.inmo.tgbotapi.types.User
|
||||||
|
|
||||||
sealed interface CallbackQuery {
|
sealed interface CallbackQuery : FromUser {
|
||||||
val id: CallbackQueryIdentifier
|
val id: CallbackQueryIdentifier
|
||||||
val user: User
|
|
||||||
val chatInstance: String
|
val chatInstance: String
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package dev.inmo.tgbotapi.types
|
package dev.inmo.tgbotapi.types
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.CommonAbstracts.FromUser
|
||||||
import dev.inmo.tgbotapi.types.ChatMember.abstracts.ChatMember
|
import dev.inmo.tgbotapi.types.ChatMember.abstracts.ChatMember
|
||||||
import dev.inmo.tgbotapi.types.chat.abstracts.Chat
|
import dev.inmo.tgbotapi.types.chat.abstracts.Chat
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
@ -10,7 +11,7 @@ data class ChatMemberUpdated(
|
|||||||
@SerialName(chatField)
|
@SerialName(chatField)
|
||||||
val chat: Chat,
|
val chat: Chat,
|
||||||
@SerialName(fromField)
|
@SerialName(fromField)
|
||||||
val user: User,
|
override val user: User,
|
||||||
@SerialName(dateField)
|
@SerialName(dateField)
|
||||||
val date: TelegramDate,
|
val date: TelegramDate,
|
||||||
@SerialName(oldChatMemberField)
|
@SerialName(oldChatMemberField)
|
||||||
@ -19,4 +20,4 @@ data class ChatMemberUpdated(
|
|||||||
val newChatMemberState: ChatMember,
|
val newChatMemberState: ChatMember,
|
||||||
@SerialName(inviteLinkField)
|
@SerialName(inviteLinkField)
|
||||||
val inviteLink: ChatInviteLink? = null
|
val inviteLink: ChatInviteLink? = null
|
||||||
)
|
) : FromUser
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult
|
package dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.CommonAbstracts.FromUser
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.ChosenInlineResult
|
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.ChosenInlineResult
|
||||||
import dev.inmo.tgbotapi.types.location.StaticLocation
|
import dev.inmo.tgbotapi.types.location.StaticLocation
|
||||||
@ -11,14 +12,14 @@ internal data class RawChosenInlineResult(
|
|||||||
@SerialName(resultIdField)
|
@SerialName(resultIdField)
|
||||||
val resultId: InlineQueryIdentifier, //chosen temporary, can be changed
|
val resultId: InlineQueryIdentifier, //chosen temporary, can be changed
|
||||||
@SerialName(fromField)
|
@SerialName(fromField)
|
||||||
val user: User,
|
override val user: User,
|
||||||
@SerialName(queryField)
|
@SerialName(queryField)
|
||||||
val query: String,
|
val query: String,
|
||||||
@SerialName(locationField)
|
@SerialName(locationField)
|
||||||
val location: StaticLocation? = null,
|
val location: StaticLocation? = null,
|
||||||
@SerialName(inlineMessageIdField)
|
@SerialName(inlineMessageIdField)
|
||||||
val inlineMessageId: InlineMessageIdentifier? = null
|
val inlineMessageId: InlineMessageIdentifier? = null
|
||||||
) {
|
) : FromUser {
|
||||||
val asChosenInlineResult: ChosenInlineResult by lazy {
|
val asChosenInlineResult: ChosenInlineResult by lazy {
|
||||||
location ?.let {
|
location ?.let {
|
||||||
LocationChosenInlineResult(resultId, user, location, inlineMessageId, query)
|
LocationChosenInlineResult(resultId, user, location, inlineMessageId, query)
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package dev.inmo.tgbotapi.types.InlineQueries.abstracts
|
package dev.inmo.tgbotapi.types.InlineQueries.abstracts
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.CommonAbstracts.FromUser
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
|
||||||
interface ChosenInlineResult {
|
interface ChosenInlineResult : FromUser {
|
||||||
val resultId: InlineQueryIdentifier //chosen temporary, can be changed
|
val resultId: InlineQueryIdentifier //chosen temporary, can be changed
|
||||||
val user: User
|
|
||||||
val inlineMessageId: InlineMessageIdentifier?
|
val inlineMessageId: InlineMessageIdentifier?
|
||||||
val query: String
|
val query: String
|
||||||
}
|
}
|
@ -1,5 +1,6 @@
|
|||||||
package dev.inmo.tgbotapi.types.games
|
package dev.inmo.tgbotapi.types.games
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.CommonAbstracts.FromUser
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
@ -9,7 +10,7 @@ data class GameHighScore (
|
|||||||
@SerialName(positionField)
|
@SerialName(positionField)
|
||||||
val position: Long,
|
val position: Long,
|
||||||
@SerialName(userField)
|
@SerialName(userField)
|
||||||
val user: User,
|
override val user: User,
|
||||||
@SerialName(scoreField)
|
@SerialName(scoreField)
|
||||||
val score: Long
|
val score: Long
|
||||||
)
|
) : FromUser
|
@ -1,8 +1,9 @@
|
|||||||
package dev.inmo.tgbotapi.types.message.ChatEvents
|
package dev.inmo.tgbotapi.types.message.ChatEvents
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.CommonAbstracts.FromUser
|
||||||
import dev.inmo.tgbotapi.types.User
|
import dev.inmo.tgbotapi.types.User
|
||||||
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.CommonEvent
|
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.CommonEvent
|
||||||
|
|
||||||
data class LeftChatMember(
|
data class LeftChatMember(
|
||||||
val user: User
|
override val user: User
|
||||||
): CommonEvent
|
): CommonEvent, FromUser
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package dev.inmo.tgbotapi.types.payments
|
package dev.inmo.tgbotapi.types.payments
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.CommonAbstracts.FromUser
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.payments.abstracts.*
|
import dev.inmo.tgbotapi.types.payments.abstracts.*
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
@ -11,7 +12,7 @@ data class PreCheckoutQuery(
|
|||||||
@SerialName(idField)
|
@SerialName(idField)
|
||||||
val id: PreCheckoutQueryId,
|
val id: PreCheckoutQueryId,
|
||||||
@SerialName(fromField)
|
@SerialName(fromField)
|
||||||
val user: User,
|
override val user: User,
|
||||||
@SerialName(currencyField)
|
@SerialName(currencyField)
|
||||||
override val currency: Currency,
|
override val currency: Currency,
|
||||||
@SerialName(totalAmountField)
|
@SerialName(totalAmountField)
|
||||||
@ -22,4 +23,4 @@ data class PreCheckoutQuery(
|
|||||||
val shippingOptionId: ShippingOptionIdentifier? = null,
|
val shippingOptionId: ShippingOptionIdentifier? = null,
|
||||||
@SerialName(orderInfoField)
|
@SerialName(orderInfoField)
|
||||||
val orderInfo: OrderInfo? = null
|
val orderInfo: OrderInfo? = null
|
||||||
) : Currencied, Amounted
|
) : Currencied, Amounted, FromUser
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package dev.inmo.tgbotapi.types.payments
|
package dev.inmo.tgbotapi.types.payments
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.CommonAbstracts.FromUser
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
@ -9,9 +10,9 @@ data class ShippingQuery(
|
|||||||
@SerialName(idField)
|
@SerialName(idField)
|
||||||
val id: ShippingQueryIdentifier,
|
val id: ShippingQueryIdentifier,
|
||||||
@SerialName(fromField)
|
@SerialName(fromField)
|
||||||
val user: User,
|
override val user: User,
|
||||||
@SerialName(invoicePayloadField)
|
@SerialName(invoicePayloadField)
|
||||||
val invoicePayload: InvoicePayload,
|
val invoicePayload: InvoicePayload,
|
||||||
@SerialName(shippingAddressField)
|
@SerialName(shippingAddressField)
|
||||||
val shippingAddress: ShippingAddress
|
val shippingAddress: ShippingAddress
|
||||||
)
|
) : FromUser
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package dev.inmo.tgbotapi.types.polls
|
package dev.inmo.tgbotapi.types.polls
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.CommonAbstracts.FromUser
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
@ -9,7 +10,7 @@ data class PollAnswer(
|
|||||||
@SerialName(pollIdField)
|
@SerialName(pollIdField)
|
||||||
val pollId: PollIdentifier,
|
val pollId: PollIdentifier,
|
||||||
@SerialName(userField)
|
@SerialName(userField)
|
||||||
val user: User,
|
override val user: User,
|
||||||
@SerialName(optionIdsField)
|
@SerialName(optionIdsField)
|
||||||
val chosen: List<Int>
|
val chosen: List<Int>
|
||||||
)
|
) : FromUser
|
||||||
|
Loading…
Reference in New Issue
Block a user