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