1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-22 16:23:48 +00:00

upfill raw extensions

This commit is contained in:
InsanusMokrassar 2022-01-07 12:56:42 +06:00
parent 094d58f59f
commit 2096671147
8 changed files with 90 additions and 0 deletions

View File

@ -0,0 +1,9 @@
package dev.inmo.tgbotapi.extensions.utils.extensions.raw
import dev.inmo.tgbotapi.types.ChatInviteLink
import dev.inmo.tgbotapi.types.ChatJoinRequest
import dev.inmo.tgbotapi.utils.RiskFeature
@RiskFeature(RawFieldsUsageWarning)
val ChatJoinRequest.invite_link: ChatInviteLink
get() = inviteLink

View File

@ -0,0 +1,16 @@
package dev.inmo.tgbotapi.extensions.utils.extensions.raw
import dev.inmo.tgbotapi.types.ChatInviteLink
import dev.inmo.tgbotapi.types.ChatMember.abstracts.ChatMember
import dev.inmo.tgbotapi.types.ChatMemberUpdated
import dev.inmo.tgbotapi.utils.RiskFeature
@RiskFeature(RawFieldsUsageWarning)
val ChatMemberUpdated.old_chat_member: ChatMember
get() = oldChatMemberState
@RiskFeature(RawFieldsUsageWarning)
val ChatMemberUpdated.new_chat_member: ChatMember
get() = newChatMemberState
@RiskFeature(RawFieldsUsageWarning)
val ChatMemberUpdated.invite_link: ChatInviteLink?
get() = inviteLink

View File

@ -1,10 +1,20 @@
package dev.inmo.tgbotapi.extensions.utils.extensions.raw package dev.inmo.tgbotapi.extensions.utils.extensions.raw
import dev.inmo.tgbotapi.extensions.utils.asLocationChosenInlineResult import dev.inmo.tgbotapi.extensions.utils.asLocationChosenInlineResult
import dev.inmo.tgbotapi.types.InlineMessageIdentifier
import dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult.ChosenInlineResult import dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult.ChosenInlineResult
import dev.inmo.tgbotapi.types.InlineQueryIdentifier
import dev.inmo.tgbotapi.types.location.Location import dev.inmo.tgbotapi.types.location.Location
import dev.inmo.tgbotapi.utils.RiskFeature import dev.inmo.tgbotapi.utils.RiskFeature
@RiskFeature(RawFieldsUsageWarning) @RiskFeature(RawFieldsUsageWarning)
val ChosenInlineResult.location: Location? val ChosenInlineResult.location: Location?
get() = asLocationChosenInlineResult() ?.location get() = asLocationChosenInlineResult() ?.location
@RiskFeature(RawFieldsUsageWarning)
val ChosenInlineResult.result_id: InlineQueryIdentifier
get() = resultId
@RiskFeature(RawFieldsUsageWarning)
val ChosenInlineResult.inline_message_id: InlineMessageIdentifier?
get() = inlineMessageId

View File

@ -8,3 +8,7 @@ import dev.inmo.tgbotapi.utils.RiskFeature
@RiskFeature(RawFieldsUsageWarning) @RiskFeature(RawFieldsUsageWarning)
val InlineQuery.location: Location? val InlineQuery.location: Location?
get() = asLocationInlineQuery() ?.location get() = asLocationInlineQuery() ?.location
@RiskFeature(RawFieldsUsageWarning)
val InlineQuery.chat_type: String?
get() = chatType ?.stringified

View File

@ -35,3 +35,9 @@ val Poll.open_period: Seconds?
@RiskFeature(RawFieldsUsageWarning) @RiskFeature(RawFieldsUsageWarning)
val Poll.close_date: TelegramDate? val Poll.close_date: TelegramDate?
get() = scheduledCloseInfo ?.asExactScheduledCloseInfo() ?.closeDateTime ?.toTelegramDate() get() = scheduledCloseInfo ?.asExactScheduledCloseInfo() ?.closeDateTime ?.toTelegramDate()
@RiskFeature(RawFieldsUsageWarning)
val Poll.is_closed: Boolean
get() = isClosed
@RiskFeature(RawFieldsUsageWarning)
val Poll.is_anonymous: Boolean
get() = isAnonymous

View File

@ -0,0 +1,12 @@
package dev.inmo.tgbotapi.extensions.utils.extensions.raw
import dev.inmo.tgbotapi.types.PollIdentifier
import dev.inmo.tgbotapi.types.polls.PollAnswer
import dev.inmo.tgbotapi.utils.RiskFeature
@RiskFeature(RawFieldsUsageWarning)
val PollAnswer.poll_id: PollIdentifier
get() = pollId
@RiskFeature(RawFieldsUsageWarning)
val PollAnswer.option_ids: List<Int>
get() = chosen

View File

@ -0,0 +1,20 @@
package dev.inmo.tgbotapi.extensions.utils.extensions.raw
import dev.inmo.tgbotapi.types.InvoicePayload
import dev.inmo.tgbotapi.types.ShippingOptionIdentifier
import dev.inmo.tgbotapi.types.payments.OrderInfo
import dev.inmo.tgbotapi.types.payments.PreCheckoutQuery
import dev.inmo.tgbotapi.utils.RiskFeature
@RiskFeature(RawFieldsUsageWarning)
val PreCheckoutQuery.total_amount: Long
get() = amount
@RiskFeature(RawFieldsUsageWarning)
val PreCheckoutQuery.invoice_payload: InvoicePayload
get() = invoicePayload
@RiskFeature(RawFieldsUsageWarning)
val PreCheckoutQuery.shipping_option_id: ShippingOptionIdentifier?
get() = shippingOptionId
@RiskFeature(RawFieldsUsageWarning)
val PreCheckoutQuery.order_info: OrderInfo?
get() = orderInfo

View File

@ -0,0 +1,13 @@
package dev.inmo.tgbotapi.extensions.utils.extensions.raw
import dev.inmo.tgbotapi.types.InvoicePayload
import dev.inmo.tgbotapi.types.payments.ShippingAddress
import dev.inmo.tgbotapi.types.payments.ShippingQuery
import dev.inmo.tgbotapi.utils.RiskFeature
@RiskFeature(RawFieldsUsageWarning)
val ShippingQuery.invoice_payload: InvoicePayload
get() = invoicePayload
@RiskFeature(RawFieldsUsageWarning)
val ShippingQuery.shipping_address: ShippingAddress
get() = shippingAddress