From d7d4adc8e4608b99040acefd895bfd0a5bb2e835 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Thu, 11 Mar 2021 21:39:34 +0600 Subject: [PATCH] optimize imports --- .../requests/SetPassportDataErrors.kt | 1 - .../chat/invite_links/CreateChatInviteLink.kt | 2 +- .../chat/invite_links/EditChatInviteLink.kt | 2 +- .../chat/invite_links/RevokeChatInviteLink.kt | 2 - .../tgbotapi/requests/send/polls/SendPoll.kt | 1 - .../dev/inmo/tgbotapi/types/ChatIdentifier.kt | 1 - .../dev/inmo/tgbotapi/types/ChatInviteLink.kt | 2 +- .../MessageAutoDeleteTimerChanged.kt | 1 - .../types/message/PrivateMessageImpl.kt | 3 +- .../types/message/content/TextContent.kt | 3 +- .../types/passport/encrypted/Email.kt | 2 +- .../passport/encrypted/EncryptedAddress.kt | 2 +- .../encrypted/EncryptedPersonalDetails.kt | 2 +- .../types/passport/encrypted/PhoneNumber.kt | 2 +- .../utils/passport/DecryptionContext.kt | 7 --- .../utils/passport/CredentialsDecrypting.kt | 5 +- .../chat/invite_links/EditChatInviteLink.kt | 1 - .../chat/invite_links/RevokeChatInviteLink.kt | 6 +-- .../api/send/media/SendMediaGroup.kt | 1 - .../expectations/WaitEventAction.kt | 3 +- .../expectations/WaitInlineQuery.kt | 2 - .../expectations/WaitPassportData.kt | 3 +- .../CallbackQueryTriggers.kt | 2 +- .../triggers_handling/EventTriggers.kt | 3 +- .../triggers_handling/InlineQueryTriggers.kt | 2 - .../triggers_handling/MediaGroupTriggers.kt | 5 +- .../triggers_handling/PassportTriggers.kt | 3 +- .../tgbotapi/extensions/utils/ClassCasts.kt | 50 ++----------------- .../utils/updates/retrieving/LongPolling.kt | 2 - .../updates/retrieving/MediaGroupsIncluder.kt | 1 - 30 files changed, 31 insertions(+), 91 deletions(-) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/SetPassportDataErrors.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/SetPassportDataErrors.kt index 80a039fd40..34a6deb85f 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/SetPassportDataErrors.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/SetPassportDataErrors.kt @@ -1,6 +1,5 @@ package dev.inmo.tgbotapi.requests -import dev.inmo.tgbotapi.requests.abstracts.Request import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.passport.PassportElementError diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/invite_links/CreateChatInviteLink.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/invite_links/CreateChatInviteLink.kt index a6212c4a44..4a87ef49c7 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/invite_links/CreateChatInviteLink.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/invite_links/CreateChatInviteLink.kt @@ -1,6 +1,6 @@ package dev.inmo.tgbotapi.requests.chat.invite_links -import com.soywiz.klock.* +import com.soywiz.klock.DateTime import dev.inmo.tgbotapi.requests.chat.abstracts.EditChatInviteLinkRequest import dev.inmo.tgbotapi.types.* import kotlinx.serialization.* diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/invite_links/EditChatInviteLink.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/invite_links/EditChatInviteLink.kt index 3ea6fc0eda..fdeb3b55e1 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/invite_links/EditChatInviteLink.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/invite_links/EditChatInviteLink.kt @@ -1,6 +1,6 @@ package dev.inmo.tgbotapi.requests.chat.invite_links -import com.soywiz.klock.* +import com.soywiz.klock.DateTime import dev.inmo.tgbotapi.requests.chat.abstracts.EditChatInviteLinkRequest import dev.inmo.tgbotapi.requests.chat.abstracts.KnownChatInviteLinkRequest import dev.inmo.tgbotapi.types.* diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/invite_links/RevokeChatInviteLink.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/invite_links/RevokeChatInviteLink.kt index 617f181e2a..31a8993666 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/invite_links/RevokeChatInviteLink.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/invite_links/RevokeChatInviteLink.kt @@ -1,7 +1,5 @@ package dev.inmo.tgbotapi.requests.chat.invite_links -import com.soywiz.klock.* -import dev.inmo.tgbotapi.requests.chat.abstracts.EditChatInviteLinkRequest import dev.inmo.tgbotapi.requests.chat.abstracts.KnownChatInviteLinkRequest import dev.inmo.tgbotapi.types.* import kotlinx.serialization.* diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/polls/SendPoll.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/polls/SendPoll.kt index d4bfd445cf..2af52017ef 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/polls/SendPoll.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/polls/SendPoll.kt @@ -1,7 +1,6 @@ package dev.inmo.tgbotapi.requests.send.polls import com.soywiz.klock.DateTime -import com.soywiz.klock.TimeSpan import dev.inmo.tgbotapi.CommonAbstracts.* import dev.inmo.tgbotapi.requests.send.abstracts.ReplyingMarkupSendMessageRequest import dev.inmo.tgbotapi.requests.send.abstracts.SendMessageRequest diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatIdentifier.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatIdentifier.kt index bdd251b7ed..3633593f94 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatIdentifier.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatIdentifier.kt @@ -1,7 +1,6 @@ package dev.inmo.tgbotapi.types import dev.inmo.micro_utils.common.Warning -import dev.inmo.tgbotapi.types.chat.abstracts.Chat import kotlinx.serialization.* import kotlinx.serialization.encoding.Decoder import kotlinx.serialization.encoding.Encoder diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatInviteLink.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatInviteLink.kt index fe6a0d094c..fe4bc031e7 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatInviteLink.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatInviteLink.kt @@ -1,6 +1,6 @@ package dev.inmo.tgbotapi.types -import com.soywiz.klock.* +import com.soywiz.klock.DateTime import kotlinx.serialization.* import kotlinx.serialization.descriptors.SerialDescriptor import kotlinx.serialization.encoding.Decoder diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/ChatEvents/MessageAutoDeleteTimerChanged.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/ChatEvents/MessageAutoDeleteTimerChanged.kt index fdd7e264d1..3144e466cc 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/ChatEvents/MessageAutoDeleteTimerChanged.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/ChatEvents/MessageAutoDeleteTimerChanged.kt @@ -1,6 +1,5 @@ package dev.inmo.tgbotapi.types.message.ChatEvents -import com.soywiz.klock.hours import dev.inmo.tgbotapi.types.Seconds import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.* import dev.inmo.tgbotapi.types.messageAutoDeleteTimeField diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/PrivateMessageImpl.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/PrivateMessageImpl.kt index 94438537e2..94cd9fea81 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/PrivateMessageImpl.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/PrivateMessageImpl.kt @@ -4,7 +4,8 @@ import com.soywiz.klock.DateTime import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup import dev.inmo.tgbotapi.types.chat.abstracts.Chat -import dev.inmo.tgbotapi.types.message.abstracts.* +import dev.inmo.tgbotapi.types.message.abstracts.Message +import dev.inmo.tgbotapi.types.message.abstracts.PrivateContentMessage import dev.inmo.tgbotapi.types.message.content.abstracts.MessageContent import dev.inmo.tgbotapi.types.message.payments.SuccessfulPaymentInfo diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/TextContent.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/TextContent.kt index 2d098ebc64..915c875a69 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/TextContent.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/TextContent.kt @@ -5,7 +5,8 @@ import dev.inmo.tgbotapi.requests.abstracts.Request import dev.inmo.tgbotapi.requests.send.SendTextMessage import dev.inmo.tgbotapi.types.ChatIdentifier import dev.inmo.tgbotapi.types.MessageIdentifier -import dev.inmo.tgbotapi.types.ParseMode.* +import dev.inmo.tgbotapi.types.ParseMode.ParseMode +import dev.inmo.tgbotapi.types.ParseMode.defaultParseMode import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage import dev.inmo.tgbotapi.types.message.content.abstracts.MessageContent diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/Email.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/Email.kt index a8ed36220e..707a87f62f 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/Email.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/Email.kt @@ -3,8 +3,8 @@ package dev.inmo.tgbotapi.types.passport.encrypted import dev.inmo.micro_utils.serialization.base64.Base64BytesToFromStringSerializer import dev.inmo.tgbotapi.types.emailField import dev.inmo.tgbotapi.types.hashField -import dev.inmo.tgbotapi.types.passport.encrypted.abstracts.PassportElementHash import dev.inmo.tgbotapi.types.passport.encrypted.abstracts.EncryptedPassportElementWithEmail +import dev.inmo.tgbotapi.types.passport.encrypted.abstracts.PassportElementHash import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/EncryptedAddress.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/EncryptedAddress.kt index 3e3f1d2010..5b2cec3eb1 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/EncryptedAddress.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/EncryptedAddress.kt @@ -3,8 +3,8 @@ package dev.inmo.tgbotapi.types.passport.encrypted import dev.inmo.micro_utils.serialization.base64.Base64BytesToFromStringSerializer import dev.inmo.tgbotapi.types.dataField import dev.inmo.tgbotapi.types.passport.credentials.EncryptedData -import dev.inmo.tgbotapi.types.passport.encrypted.abstracts.PassportElementHash import dev.inmo.tgbotapi.types.passport.encrypted.abstracts.EncryptedPassportElementWithData +import dev.inmo.tgbotapi.types.passport.encrypted.abstracts.PassportElementHash import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/EncryptedPersonalDetails.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/EncryptedPersonalDetails.kt index fe1142a7e4..1df8d90be5 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/EncryptedPersonalDetails.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/EncryptedPersonalDetails.kt @@ -3,8 +3,8 @@ package dev.inmo.tgbotapi.types.passport.encrypted import dev.inmo.micro_utils.serialization.base64.Base64BytesToFromStringSerializer import dev.inmo.tgbotapi.types.dataField import dev.inmo.tgbotapi.types.passport.credentials.EncryptedData -import dev.inmo.tgbotapi.types.passport.encrypted.abstracts.PassportElementHash import dev.inmo.tgbotapi.types.passport.encrypted.abstracts.EncryptedPassportElementWithData +import dev.inmo.tgbotapi.types.passport.encrypted.abstracts.PassportElementHash import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/PhoneNumber.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/PhoneNumber.kt index 88dc723765..d6cc0df603 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/PhoneNumber.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/PhoneNumber.kt @@ -2,8 +2,8 @@ package dev.inmo.tgbotapi.types.passport.encrypted import dev.inmo.micro_utils.serialization.base64.Base64BytesToFromStringSerializer import dev.inmo.tgbotapi.types.hashField -import dev.inmo.tgbotapi.types.passport.encrypted.abstracts.PassportElementHash import dev.inmo.tgbotapi.types.passport.encrypted.abstracts.EncryptedPassportElementWithPhoneNumber +import dev.inmo.tgbotapi.types.passport.encrypted.abstracts.PassportElementHash import dev.inmo.tgbotapi.types.phoneNumberField import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/passport/DecryptionContext.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/passport/DecryptionContext.kt index f179e3f627..57654fcfb7 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/passport/DecryptionContext.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/passport/DecryptionContext.kt @@ -1,14 +1,7 @@ package dev.inmo.tgbotapi.utils.passport import dev.inmo.micro_utils.crypto.SourceBytes -import dev.inmo.tgbotapi.bot.TelegramBot -import dev.inmo.tgbotapi.requests.DownloadFile -import dev.inmo.tgbotapi.requests.get.GetFile -import dev.inmo.tgbotapi.types.passport.credentials.EncryptedCredentials import dev.inmo.tgbotapi.types.passport.credentials.EncryptedData -import dev.inmo.tgbotapi.types.passport.encrypted.PassportFile -import dev.inmo.tgbotapi.utils.nonstrictJsonFormat -import kotlinx.serialization.json.JsonObject interface Decryptor { fun decrypt(data: EncryptedData): SourceBytes diff --git a/tgbotapi.core/src/jvmMain/kotlin/dev/inmo/tgbotapi/utils/passport/CredentialsDecrypting.kt b/tgbotapi.core/src/jvmMain/kotlin/dev/inmo/tgbotapi/utils/passport/CredentialsDecrypting.kt index 7639ee5845..e150cc7f78 100644 --- a/tgbotapi.core/src/jvmMain/kotlin/dev/inmo/tgbotapi/utils/passport/CredentialsDecrypting.kt +++ b/tgbotapi.core/src/jvmMain/kotlin/dev/inmo/tgbotapi/utils/passport/CredentialsDecrypting.kt @@ -4,11 +4,10 @@ import dev.inmo.micro_utils.crypto.decodeBase64 import dev.inmo.tgbotapi.types.passport.credentials.DecryptedCredentials import dev.inmo.tgbotapi.types.passport.credentials.EncryptedCredentials import dev.inmo.tgbotapi.utils.nonstrictJsonFormat -import java.security.* +import java.security.KeyFactory +import java.security.PrivateKey import java.security.spec.PKCS8EncodedKeySpec import javax.crypto.Cipher -import javax.crypto.spec.IvParameterSpec -import javax.crypto.spec.SecretKeySpec private val regexToRemoveFromKey = Regex("(-----(BEGIN|END) ((?:.*? KEY)|CERTIFICATE)-----|[\\s])") diff --git a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/chat/invite_links/EditChatInviteLink.kt b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/chat/invite_links/EditChatInviteLink.kt index c5fdf01154..027a54360f 100644 --- a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/chat/invite_links/EditChatInviteLink.kt +++ b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/chat/invite_links/EditChatInviteLink.kt @@ -2,7 +2,6 @@ package dev.inmo.tgbotapi.extensions.api.chat.invite_links import com.soywiz.klock.DateTime import dev.inmo.tgbotapi.bot.TelegramBot -import dev.inmo.tgbotapi.requests.chat.invite_links.CreateChatInviteLink import dev.inmo.tgbotapi.requests.chat.invite_links.EditChatInviteLink import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.chat.abstracts.PublicChat diff --git a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/chat/invite_links/RevokeChatInviteLink.kt b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/chat/invite_links/RevokeChatInviteLink.kt index 4e2a4edeee..320e29fa08 100644 --- a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/chat/invite_links/RevokeChatInviteLink.kt +++ b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/chat/invite_links/RevokeChatInviteLink.kt @@ -1,9 +1,9 @@ package dev.inmo.tgbotapi.extensions.api.chat.invite_links -import com.soywiz.klock.DateTime import dev.inmo.tgbotapi.bot.TelegramBot -import dev.inmo.tgbotapi.requests.chat.invite_links.* -import dev.inmo.tgbotapi.types.* +import dev.inmo.tgbotapi.requests.chat.invite_links.RevokeChatInviteLink +import dev.inmo.tgbotapi.types.ChatIdentifier +import dev.inmo.tgbotapi.types.ChatInviteLink import dev.inmo.tgbotapi.types.chat.abstracts.PublicChat suspend fun TelegramBot.revokeChatInviteLink( diff --git a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendMediaGroup.kt b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendMediaGroup.kt index e8cf10588f..01b8bb5077 100644 --- a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendMediaGroup.kt +++ b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendMediaGroup.kt @@ -8,7 +8,6 @@ import dev.inmo.tgbotapi.types.MessageIdentifier import dev.inmo.tgbotapi.types.chat.abstracts.Chat import dev.inmo.tgbotapi.types.message.abstracts.Message import dev.inmo.tgbotapi.types.message.content.abstracts.MediaGroupContent -import dev.inmo.tgbotapi.types.message.content.abstracts.VisualMediaGroupContent import dev.inmo.tgbotapi.utils.RiskFeature /** diff --git a/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitEventAction.kt b/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitEventAction.kt index 308c5dbd39..53fee66475 100644 --- a/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitEventAction.kt +++ b/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitEventAction.kt @@ -3,7 +3,8 @@ package dev.inmo.tgbotapi.extensions.behaviour_builder.expectations import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext -import dev.inmo.tgbotapi.extensions.utils.* +import dev.inmo.tgbotapi.extensions.utils.asBaseSentMessageUpdate +import dev.inmo.tgbotapi.extensions.utils.asChatEventMessage import dev.inmo.tgbotapi.requests.abstracts.Request import dev.inmo.tgbotapi.types.message.ChatEvents.* import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.* diff --git a/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitInlineQuery.kt b/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitInlineQuery.kt index 009af3d38a..1e34de13eb 100644 --- a/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitInlineQuery.kt +++ b/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitInlineQuery.kt @@ -1,10 +1,8 @@ package dev.inmo.tgbotapi.extensions.behaviour_builder.expectations import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext -import dev.inmo.tgbotapi.extensions.utils.asCallbackQueryUpdate import dev.inmo.tgbotapi.extensions.utils.asInlineQueryUpdate import dev.inmo.tgbotapi.requests.abstracts.Request -import dev.inmo.tgbotapi.types.CallbackQuery.* import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InlineQuery import dev.inmo.tgbotapi.types.InlineQueries.query.BaseInlineQuery import dev.inmo.tgbotapi.types.InlineQueries.query.LocationInlineQuery diff --git a/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitPassportData.kt b/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitPassportData.kt index 309a4705d0..c77cd0381b 100644 --- a/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitPassportData.kt +++ b/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitPassportData.kt @@ -1,7 +1,8 @@ package dev.inmo.tgbotapi.extensions.behaviour_builder.expectations import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext -import dev.inmo.tgbotapi.extensions.utils.* +import dev.inmo.tgbotapi.extensions.utils.asMessageUpdate +import dev.inmo.tgbotapi.extensions.utils.asPassportMessage import dev.inmo.tgbotapi.requests.abstracts.Request import dev.inmo.tgbotapi.types.message.PassportMessage import dev.inmo.tgbotapi.types.passport.PassportData diff --git a/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/CallbackQueryTriggers.kt b/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/CallbackQueryTriggers.kt index d66c64eab8..8e0f9724f8 100644 --- a/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/CallbackQueryTriggers.kt +++ b/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/CallbackQueryTriggers.kt @@ -4,7 +4,7 @@ package dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling import dev.inmo.micro_utils.coroutines.subscribeSafelyWithoutExceptions import dev.inmo.tgbotapi.extensions.behaviour_builder.* import dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.expectFlow -import dev.inmo.tgbotapi.extensions.utils.* +import dev.inmo.tgbotapi.extensions.utils.asCallbackQueryUpdate import dev.inmo.tgbotapi.extensions.utils.extensions.sourceChat import dev.inmo.tgbotapi.types.CallbackQuery.* diff --git a/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/EventTriggers.kt b/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/EventTriggers.kt index fdea3f9a0a..6940426c78 100644 --- a/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/EventTriggers.kt +++ b/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/EventTriggers.kt @@ -4,7 +4,8 @@ package dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling import dev.inmo.micro_utils.coroutines.subscribeSafelyWithoutExceptions import dev.inmo.tgbotapi.extensions.behaviour_builder.* import dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.expectFlow -import dev.inmo.tgbotapi.extensions.utils.* +import dev.inmo.tgbotapi.extensions.utils.asBaseSentMessageUpdate +import dev.inmo.tgbotapi.extensions.utils.asChatEventMessage import dev.inmo.tgbotapi.extensions.utils.extensions.sourceChat import dev.inmo.tgbotapi.types.message.ChatEvents.* import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.* diff --git a/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/InlineQueryTriggers.kt b/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/InlineQueryTriggers.kt index e85f2cee37..317943df52 100644 --- a/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/InlineQueryTriggers.kt +++ b/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/InlineQueryTriggers.kt @@ -5,8 +5,6 @@ import dev.inmo.tgbotapi.extensions.behaviour_builder.* import dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.expectFlow import dev.inmo.tgbotapi.extensions.utils.asInlineQueryUpdate import dev.inmo.tgbotapi.extensions.utils.extensions.sourceChat -import dev.inmo.tgbotapi.types.CallbackQuery.DataCallbackQuery -import dev.inmo.tgbotapi.types.CallbackQuery.GameShortNameCallbackQuery import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InlineQuery import dev.inmo.tgbotapi.types.InlineQueries.query.BaseInlineQuery import dev.inmo.tgbotapi.types.InlineQueries.query.LocationInlineQuery diff --git a/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/MediaGroupTriggers.kt b/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/MediaGroupTriggers.kt index 639f2cbeff..31a9b9d11c 100644 --- a/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/MediaGroupTriggers.kt +++ b/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/MediaGroupTriggers.kt @@ -5,12 +5,13 @@ package dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling import dev.inmo.micro_utils.coroutines.subscribeSafelyWithoutExceptions import dev.inmo.tgbotapi.extensions.behaviour_builder.* import dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.expectFlow -import dev.inmo.tgbotapi.extensions.utils.* +import dev.inmo.tgbotapi.extensions.utils.asSentMediaGroupUpdate import dev.inmo.tgbotapi.extensions.utils.extensions.sourceChat import dev.inmo.tgbotapi.extensions.utils.shortcuts.chat import dev.inmo.tgbotapi.types.message.abstracts.MediaGroupMessage import dev.inmo.tgbotapi.types.message.content.abstracts.* -import dev.inmo.tgbotapi.types.message.content.media.* +import dev.inmo.tgbotapi.types.message.content.media.PhotoContent +import dev.inmo.tgbotapi.types.message.content.media.VideoContent import dev.inmo.tgbotapi.utils.PreviewFeature @PreviewFeature diff --git a/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/PassportTriggers.kt b/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/PassportTriggers.kt index 971a55419f..e954526b0e 100644 --- a/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/PassportTriggers.kt +++ b/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/PassportTriggers.kt @@ -3,7 +3,8 @@ package dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling import dev.inmo.micro_utils.coroutines.subscribeSafelyWithoutExceptions import dev.inmo.tgbotapi.extensions.behaviour_builder.* import dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.expectFlow -import dev.inmo.tgbotapi.extensions.utils.* +import dev.inmo.tgbotapi.extensions.utils.asMessageUpdate +import dev.inmo.tgbotapi.extensions.utils.asPassportMessage import dev.inmo.tgbotapi.extensions.utils.extensions.sourceChat import dev.inmo.tgbotapi.types.message.PassportMessage import dev.inmo.tgbotapi.types.passport.encrypted.abstracts.EncryptedPassportElement diff --git a/tgbotapi.extensions.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/ClassCasts.kt b/tgbotapi.extensions.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/ClassCasts.kt index 708f85ae7d..6eef25aed0 100644 --- a/tgbotapi.extensions.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/ClassCasts.kt +++ b/tgbotapi.extensions.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/ClassCasts.kt @@ -32,7 +32,10 @@ import dev.inmo.tgbotapi.types.dice.* import dev.inmo.tgbotapi.types.files.* import dev.inmo.tgbotapi.types.files.abstracts.* import dev.inmo.tgbotapi.types.message.* +import dev.inmo.tgbotapi.types.message.ChatEvents.* +import dev.inmo.tgbotapi.types.message.ChatEvents.LeftChatMember import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.* +import dev.inmo.tgbotapi.types.message.ChatEvents.voice.* import dev.inmo.tgbotapi.types.message.abstracts.* import dev.inmo.tgbotapi.types.message.content.* import dev.inmo.tgbotapi.types.message.content.abstracts.* @@ -48,53 +51,6 @@ import dev.inmo.tgbotapi.types.update.* import dev.inmo.tgbotapi.types.update.MediaGroupUpdates.* import dev.inmo.tgbotapi.types.update.abstracts.* import dev.inmo.tgbotapi.utils.PreviewFeature -import dev.inmo.tgbotapi.types.dice.DiceAnimationType -import dev.inmo.tgbotapi.types.update.abstracts.Update -import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.ChatEvent -import dev.inmo.tgbotapi.types.update.CallbackQueryUpdate -import dev.inmo.tgbotapi.types.update.ChannelPostUpdate -import dev.inmo.tgbotapi.types.update.ChosenInlineResultUpdate -import dev.inmo.tgbotapi.types.update.CommonChatMemberUpdatedUpdate -import dev.inmo.tgbotapi.types.update.EditChannelPostUpdate -import dev.inmo.tgbotapi.types.update.EditMessageUpdate -import dev.inmo.tgbotapi.types.update.InlineQueryUpdate -import dev.inmo.tgbotapi.types.update.MediaGroupUpdates.ChannelPostMediaGroupUpdate -import dev.inmo.tgbotapi.types.update.MediaGroupUpdates.EditChannelPostMediaGroupUpdate -import dev.inmo.tgbotapi.types.update.MediaGroupUpdates.EditMediaGroupUpdate -import dev.inmo.tgbotapi.types.update.MediaGroupUpdates.EditMessageMediaGroupUpdate -import dev.inmo.tgbotapi.types.update.MediaGroupUpdates.MediaGroupUpdate -import dev.inmo.tgbotapi.types.update.MediaGroupUpdates.MessageMediaGroupUpdate -import dev.inmo.tgbotapi.types.update.MediaGroupUpdates.SentMediaGroupUpdate -import dev.inmo.tgbotapi.types.update.MessageUpdate -import dev.inmo.tgbotapi.types.update.MyChatMemberUpdatedUpdate -import dev.inmo.tgbotapi.types.update.PollAnswerUpdate -import dev.inmo.tgbotapi.types.update.PollUpdate -import dev.inmo.tgbotapi.types.update.PreCheckoutQueryUpdate -import dev.inmo.tgbotapi.types.update.ShippingQueryUpdate -import dev.inmo.tgbotapi.types.update.abstracts.BaseEditMessageUpdate -import dev.inmo.tgbotapi.types.update.abstracts.BaseMessageUpdate -import dev.inmo.tgbotapi.types.update.abstracts.BaseSentMessageUpdate -import dev.inmo.tgbotapi.types.update.abstracts.ChatMemberUpdatedUpdate -import dev.inmo.tgbotapi.types.update.abstracts.UnknownUpdate -import dev.inmo.tgbotapi.types.message.ChatEvents.ChannelChatCreated -import dev.inmo.tgbotapi.types.message.ChatEvents.DeleteChatPhoto -import dev.inmo.tgbotapi.types.message.ChatEvents.GroupChatCreated -import dev.inmo.tgbotapi.types.message.ChatEvents.LeftChatMember -import dev.inmo.tgbotapi.types.message.ChatEvents.MessageAutoDeleteTimerChanged -import dev.inmo.tgbotapi.types.message.ChatEvents.NewChatMembers -import dev.inmo.tgbotapi.types.message.ChatEvents.NewChatPhoto -import dev.inmo.tgbotapi.types.message.ChatEvents.NewChatTitle -import dev.inmo.tgbotapi.types.message.ChatEvents.PinnedMessage -import dev.inmo.tgbotapi.types.message.ChatEvents.ProximityAlertTriggered -import dev.inmo.tgbotapi.types.message.ChatEvents.SupergroupChatCreated -import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.ChannelEvent -import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.CommonEvent -import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.GroupEvent -import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.SupergroupEvent -import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.VoiceChatEvent -import dev.inmo.tgbotapi.types.message.ChatEvents.voice.VoiceChatEnded -import dev.inmo.tgbotapi.types.message.ChatEvents.voice.VoiceChatParticipantsInvited -import dev.inmo.tgbotapi.types.message.ChatEvents.voice.VoiceChatStarted @PreviewFeature inline fun Chat.asBot(): Bot? = this as? Bot diff --git a/tgbotapi.extensions.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/updates/retrieving/LongPolling.kt b/tgbotapi.extensions.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/updates/retrieving/LongPolling.kt index 5e6057d576..b8496069e7 100644 --- a/tgbotapi.extensions.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/updates/retrieving/LongPolling.kt +++ b/tgbotapi.extensions.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/updates/retrieving/LongPolling.kt @@ -14,10 +14,8 @@ import dev.inmo.tgbotapi.types.update.abstracts.Update import dev.inmo.tgbotapi.updateshandlers.* import dev.inmo.tgbotapi.utils.* import io.ktor.client.features.HttpRequestTimeoutException -import io.ktor.utils.io.core.use import kotlinx.coroutines.* import kotlinx.coroutines.flow.* -import kotlin.coroutines.coroutineContext fun TelegramBot.startGettingOfUpdatesByLongPolling( timeoutSeconds: Seconds = 30, diff --git a/tgbotapi.extensions.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/updates/retrieving/MediaGroupsIncluder.kt b/tgbotapi.extensions.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/updates/retrieving/MediaGroupsIncluder.kt index bae30b47ce..c369e14c16 100644 --- a/tgbotapi.extensions.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/updates/retrieving/MediaGroupsIncluder.kt +++ b/tgbotapi.extensions.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/updates/retrieving/MediaGroupsIncluder.kt @@ -2,7 +2,6 @@ package dev.inmo.tgbotapi.extensions.utils.updates.retrieving import dev.inmo.tgbotapi.extensions.utils.updates.convertWithMediaGroupUpdates import dev.inmo.tgbotapi.types.message.abstracts.MediaGroupMessage -import dev.inmo.tgbotapi.types.message.content.abstracts.MediaGroupContent import dev.inmo.tgbotapi.types.update.abstracts.BaseMessageUpdate import dev.inmo.tgbotapi.types.update.abstracts.Update import dev.inmo.tgbotapi.updateshandlers.UpdateReceiver