mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2025-11-18 04:50:20 +00:00
Compare commits
170 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3b3cf81aaa | |||
| 1642075a75 | |||
| 760c9f2916 | |||
| 219238cf19 | |||
| 762087fc09 | |||
| 142fae1ede | |||
| 95abc72bf3 | |||
| 1d37a7446c | |||
| 7d35114b5d | |||
| 75f4226772 | |||
| 96d980cb8a | |||
| ed077ae1bc | |||
| 9540797ffc | |||
| 217b01994e | |||
| 6b89c94ef1 | |||
| e25ce57f6a | |||
| 530394fd15 | |||
| 3e891d50fd | |||
| adf5fd6288 | |||
| e7a2dc51aa | |||
| 399793243b | |||
| 3801025ff1 | |||
| 0ad2d9afc4 | |||
| a303700b56 | |||
| 42bf896f7a | |||
| 0bce522101 | |||
| 3c75d6a2c7 | |||
| 93eebe37ce | |||
| f893803939 | |||
| 0b92edc05e | |||
| 190d83b22b | |||
| 7ec4fc460a | |||
| 75cebf5aa3 | |||
| a241c91adf | |||
| 4f920abb61 | |||
| 6ba9a31fb9 | |||
| 65801f5104 | |||
| 9e82211473 | |||
|
|
560179a574 | ||
|
|
cffcf2277e | ||
|
|
cb9a20a9d1 | ||
|
|
45ea103c9a | ||
|
|
c00adb0784 | ||
|
|
38826a5e7e | ||
| b2915857d7 | |||
| 067e36adc6 | |||
|
|
12a35da4b6 | ||
|
|
022e6f623a | ||
|
|
30c138029e | ||
| 732e2a3906 | |||
| c5e089a45d | |||
|
|
919b1590e3 | ||
| 0c1017901f | |||
| fd6e4b0522 | |||
| 21c5d42dc2 | |||
| 77dff639f0 | |||
| 47fe048b10 | |||
| ee8cc2aa46 | |||
| b9de002517 | |||
| 449f2727c4 | |||
| 8712914126 | |||
| 69b64e9908 | |||
| 656bb68739 | |||
| 7f69052dea | |||
| b60fab4871 | |||
| bf28a8b0a6 | |||
| 85270dd12d | |||
| e39dd2d086 | |||
| e10d47b7e4 | |||
| 1e181bc042 | |||
| 61cf9936fb | |||
| 65fd3ced36 | |||
| 66d37b72eb | |||
| 55b1d3734d | |||
| 45b32fd6f7 | |||
| fcd8f20a90 | |||
| 18e6b9e471 | |||
| f5b248f534 | |||
| 3ebcbe2860 | |||
| 3829e04b0c | |||
| 39fa36426f | |||
| a265e5ecbf | |||
| 86e78c4ba0 | |||
| a6451ca394 | |||
| 521a3a8c35 | |||
| 173839c677 | |||
| bb7d47a33b | |||
| 5c0e58caec | |||
| 72c3623d30 | |||
| fe1831fc19 | |||
| 7825ec3010 | |||
| 12184cd2be | |||
| e90e25ab01 | |||
| 004ff0b490 | |||
| 07faba7d38 | |||
| e5584cd8b4 | |||
| 6acc9ef2b0 | |||
| 169fc0401a | |||
| dcfcea65cb | |||
| eedb36ede7 | |||
| eaee334ff6 | |||
| 5c694e8625 | |||
| 0306c40fb2 | |||
| fd915553e3 | |||
| ec1c0ba8bb | |||
| 12a64ec1d1 | |||
| 59d7a7c781 | |||
| cabfd7c76b | |||
| f12f52899c | |||
|
|
ed067db20f | ||
| b055268979 | |||
| 2584839d66 | |||
| 63946e860d | |||
| 90df436c63 | |||
| d3c8b49b10 | |||
| c1372b55bc | |||
| b6c7ece995 | |||
| 44e7c80f43 | |||
| 1e41e95333 | |||
| 03d4d715c0 | |||
| ab060d02ea | |||
| f447be02dc | |||
| eb923a6338 | |||
| 0914710cc7 | |||
| 1f7450844f | |||
| 167c214e35 | |||
| 42a8d649cd | |||
| eb3f180cc6 | |||
| 70f96ac8fa | |||
| d69b2e09d5 | |||
| 946b0222df | |||
| 7da315dbaf | |||
| 87071ca52c | |||
| b2770e3ecc | |||
| df63ccfe07 | |||
| 694bec22a2 | |||
| 6a3588bb8d | |||
| a26568aa29 | |||
| cd30660256 | |||
| 1846d20b0d | |||
| f13207064e | |||
| 61be689aca | |||
| 03f8d65bb6 | |||
| 2dc8beba8a | |||
| 5451adf4ac | |||
| 9982534001 | |||
| c0451d4c8f | |||
| a9d65944e6 | |||
| 39598dcb69 | |||
| 3069a6084c | |||
| e7bbce3fa7 | |||
| 0b361163f2 | |||
| 6aba2ff641 | |||
| 6b761ab37d | |||
| b9c8a89af9 | |||
| a42c5c63c4 | |||
| fc1a029acb | |||
| f90ae2f918 | |||
| 019b260888 | |||
| 0831f2fa75 | |||
| 32ae9d2b16 | |||
| b975a1b036 | |||
| f4b1e4a150 | |||
| 97031512d4 | |||
| 353df43109 | |||
| 4e55460834 | |||
| e2e235bd6c | |||
| 8ced95bc2f | |||
| 685e4af8f5 | |||
| 80093cb5a9 |
12
.github/workflows/build.yml
vendored
Normal file
12
.github/workflows/build.yml
vendored
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
name: Build
|
||||||
|
on: [push]
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions/setup-java@v1
|
||||||
|
with:
|
||||||
|
java-version: 1.8
|
||||||
|
- name: Build
|
||||||
|
run: ./gradlew build
|
||||||
4
.github/workflows/kdocs.yml
vendored
4
.github/workflows/kdocs.yml
vendored
@@ -12,10 +12,10 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
java-version: 1.8
|
java-version: 1.8
|
||||||
- name: Build
|
- name: Build
|
||||||
run: ./gradlew dokkaGfm
|
run: ./gradlew dokkaHtml
|
||||||
- name: Publish KDocs
|
- name: Publish KDocs
|
||||||
uses: peaceiris/actions-gh-pages@v3
|
uses: peaceiris/actions-gh-pages@v3
|
||||||
with:
|
with:
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
publish_dir: ./docs/build/dokka/gfm
|
publish_dir: ./docs/build/dokka/html
|
||||||
publish_branch: kdocs
|
publish_branch: kdocs
|
||||||
|
|||||||
4
.github/workflows/packages_publishing.yml
vendored
4
.github/workflows/packages_publishing.yml
vendored
@@ -14,10 +14,8 @@ jobs:
|
|||||||
cat gradle.properties | sed -e "s/^library_version=\([0-9\.]*\)/library_version=\1-branch_$branch-build${{ github.run_number }}/" > gradle.properties.tmp
|
cat gradle.properties | sed -e "s/^library_version=\([0-9\.]*\)/library_version=\1-branch_$branch-build${{ github.run_number }}/" > gradle.properties.tmp
|
||||||
rm gradle.properties
|
rm gradle.properties
|
||||||
mv gradle.properties.tmp gradle.properties
|
mv gradle.properties.tmp gradle.properties
|
||||||
- name: Build
|
|
||||||
run: ./gradlew build
|
|
||||||
- name: Publish
|
- name: Publish
|
||||||
run: ./gradlew publishAllPublicationsToGithubPackagesRepository --no-parallel -x signJsPublication -x signJvmPublication -x signKotlinMultiplatformPublication -x signMetadataPublication
|
run: ./gradlew publishAllPublicationsToGithubPackagesRepository --no-parallel -x signJsPublication -x signJvmPublication -x signKotlinMultiplatformPublication
|
||||||
env:
|
env:
|
||||||
GITHUBPACKAGES_USER: ${{ github.actor }}
|
GITHUBPACKAGES_USER: ${{ github.actor }}
|
||||||
GITHUBPACKAGES_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
|
GITHUBPACKAGES_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|||||||
1
.github/write-good.yml
vendored
1
.github/write-good.yml
vendored
@@ -1 +0,0 @@
|
|||||||
spellchecker: true
|
|
||||||
186
CHANGELOG.md
186
CHANGELOG.md
@@ -1,5 +1,191 @@
|
|||||||
# TelegramBotAPI changelog
|
# TelegramBotAPI changelog
|
||||||
|
|
||||||
|
## 0.35.4 Hotfix
|
||||||
|
|
||||||
|
* `Common`:
|
||||||
|
* `Version`:
|
||||||
|
* `MicroUtils`: `0.5.18` -> `0.5.19`
|
||||||
|
|
||||||
|
## 0.35.3
|
||||||
|
|
||||||
|
* `Common`:
|
||||||
|
* `Version`:
|
||||||
|
* `Klock`: `2.2.0` -> `2.3.1`
|
||||||
|
* `Ktor`: `1.6.1` -> `1.6.2`
|
||||||
|
* `MicroUtils`: `0.5.16` -> `0.5.18`
|
||||||
|
* `Core`:
|
||||||
|
* **`SimpleRequestCallFactory` and `MultipartRequestCallFactory` became a classes instead of objects to avoid
|
||||||
|
collisions in different bots**
|
||||||
|
* Support of strongly-typed ietf language codes has been added
|
||||||
|
* `API`:
|
||||||
|
* New extension `TelegramBot#downloadFile` for any `MediaContent`
|
||||||
|
* `Behaviour Builder`:
|
||||||
|
* New provider `defaultCoroutineScopeProvider`
|
||||||
|
* Now it is not necessary to provide `CoroutineScope` to `TelegramBot#buildBehaviour`
|
||||||
|
extension
|
||||||
|
* New `TelegramBot#buildBehaviour` extension with `FlowUpdatesFilter` and `CoroutineScope` with
|
||||||
|
default `CoroutineScope`
|
||||||
|
* New typealias `SimpleFilter` for unifying triggers filter signatures
|
||||||
|
* All waiters got real filters (`SimpleFilter`) and rename old filters as mappers
|
||||||
|
* New extensions for `Any`: `as`/`when`/`require` for `WithOptionalLanguageCode` and `WithLanguageCode`
|
||||||
|
|
||||||
|
## 0.35.2
|
||||||
|
|
||||||
|
* `Common`:
|
||||||
|
* `Version`:
|
||||||
|
* `Kotlin`: `1.5.20` -> `1.5.21`
|
||||||
|
* `Coroutines`: `1.5.0` -> `1.5.1`
|
||||||
|
* `Serialization`: `1.2.1` -> `1.2.2`
|
||||||
|
* `Klock`: `2.1.2` -> `2.2.0`
|
||||||
|
* `Ktor`: `1.6.0` -> `1.6.1`
|
||||||
|
* `MicroUtils`: `0.5.15` -> `0.5.16`
|
||||||
|
|
||||||
|
## 0.35.1
|
||||||
|
|
||||||
|
* `Common`:
|
||||||
|
* `Version`:
|
||||||
|
* `Kotlin`: `1.5.10` -> `1.5.20`
|
||||||
|
* `MicroUtils`: `0.5.6` -> `0.5.15`
|
||||||
|
* `Core`:
|
||||||
|
* New interface `MyCommandsRequest` (also see `Bot API 5.3` below)
|
||||||
|
* New extensions `TextSourcesList#make*String` for all parse modes
|
||||||
|
* All `MessageContent` subclasses now serializable
|
||||||
|
* `ChosenInlineResult` was replaced and modified to be sealed
|
||||||
|
* `ChosenInlineResult` now extends `FromUser`
|
||||||
|
* Added `Update#sourceUser` method
|
||||||
|
* More types assumed as sent by user types now implements `FromUser` interface
|
||||||
|
* Added `Any#whenFromUser`, `Any#asFromUser` and`Any#requireFromUser` extensions
|
||||||
|
* `MedaGroupUpdate` and its direct extenders `SentMediaGroupUpdate` and `EditMediaGroupUpdate` became
|
||||||
|
`sealed interface`s
|
||||||
|
* New built-in `RequestException` implementator `GetUpdatesConflict` has been added
|
||||||
|
* `Behaviour Builder`:
|
||||||
|
* ❗️ All triggers (`on*` extensions) have been modified to work in parallel by some marker by default (new parameter
|
||||||
|
`markerFactory`, in most cases will work async for different chats)
|
||||||
|
* New extensions `telegramBotWithBehaviour`
|
||||||
|
* All behaviour builder extensions got new parameter `defaultExceptionsHandler`
|
||||||
|
* Class `BehaviourContext` was rewritten as an interface with default realization `DefaultBehaviourContext` and
|
||||||
|
factory `BehaviourContext(TelegramBot, CoroutineScope, FlowsUpdatesFilter)`
|
||||||
|
* Extension `buildBehaviour` (and all related extensions/functions) for opportunity to pass
|
||||||
|
`defaultExceptionsHandler`
|
||||||
|
* Trigger `onContentMessage` and waiter `waitContentMessage` now may include media groups
|
||||||
|
* `API`:
|
||||||
|
* All `reply` and subsequent extensions have been replaced in send package
|
||||||
|
* `Utils`:
|
||||||
|
* With class casts like `as*` and `require*` now you may use `when*` with parameter callback
|
||||||
|
* Methods of `EntitiesBuilder` now will return builder itself, so you may create sequences like
|
||||||
|
`buildEntities { bold("Hello,") + italic(" world") }` directly in `buildEntities` body
|
||||||
|
* New extension `TelegramBot#longPollingFlow` has been added with returning value `Flow` with updates
|
||||||
|
* `Bot API 5.3`:
|
||||||
|
* Add type `BotCommandScope`, its serializer `BotCommandScopeSerializer` and all its children
|
||||||
|
* New request `DeleteMyCommands` and updates in `GetMyCommands` and `SetMyCommands`
|
||||||
|
* Renames according to `And more` of [June 25, 2021](https://core.telegram.org/bots/api-changelog#june-25-2021) update
|
||||||
|
|
||||||
|
## 0.35.0
|
||||||
|
|
||||||
|
**ALL PREVIOUS DEPRECATIONS HAVE BEEN REMOVED**
|
||||||
|
**JS PART NOW USE IR COMPILER ONLY**
|
||||||
|
|
||||||
|
* `Common`:
|
||||||
|
* `Version`:
|
||||||
|
* `Kotlin`: `1.4.72` -> `1.5.10`
|
||||||
|
* `MicroUtils`: `0.4.36` -> `0.5.6`
|
||||||
|
* `Coroutines`: `1.4.3` -> `1.5.0`
|
||||||
|
* `Serialization`: `1.1.0` -> `1.2.1`
|
||||||
|
* `Klock`: `2.0.7` -> `2.1.2`
|
||||||
|
* `UUID`: `0.2.3` -> `0.3.0`
|
||||||
|
* `Ktor`: `1.5.4` -> `1.6.0`
|
||||||
|
* `Core`:
|
||||||
|
* `ForceReply` has been renamed to `ReplyForce`
|
||||||
|
* `Captioned` and `Explained` interfaces have been removed
|
||||||
|
* `RecordAudioAction` and `UploadAudioAction` (and all related to these actions functionality) have been removed
|
||||||
|
* `TextSource` interface and all related things have been replaced
|
||||||
|
* `CallbackQuery` interface and all its extenders/implementers become `sealed`
|
||||||
|
* `InputMedia` interface and all its extenders/implementers become `sealed`
|
||||||
|
* `ParseMode` interface and all its extenders/implementers become `sealed`
|
||||||
|
* `ChatMember` becomes `sealed`
|
||||||
|
* `KeyboardMarkup` becomes `sealed`
|
||||||
|
* `LeftChatMember` and `MemberChatMember` become interfaces. All their code were replaced to the `*Impl` classes
|
||||||
|
* Most of `sealed` classes have been modified to be interfaces
|
||||||
|
* Most serializers becomes public, but they are still `RistFeature`
|
||||||
|
* For `EntitiesBuilder` multilevel text sources builders with callback have been added
|
||||||
|
|
||||||
|
## 0.34.1
|
||||||
|
|
||||||
|
* `Common`:
|
||||||
|
* `Version`:
|
||||||
|
* `ktor`: `1.5.3` -> `1.5.4`
|
||||||
|
* `MicroUtils`: `0.4.35` -> `0.4.36`
|
||||||
|
* `Core`
|
||||||
|
* Fix in creating of text sources list
|
||||||
|
|
||||||
|
## 0.34.0
|
||||||
|
|
||||||
|
_**It is recommended to use [0.34.1](https://github.com/InsanusMokrassar/TelegramBotAPI/releases/tag/0.34.1) version due to the bug in 0.34.0 related to rewriting of `TextSource`s creating mechanism.**_
|
||||||
|
|
||||||
|
**UPDATE UP TO Telegram Bot API 5.2**
|
||||||
|
|
||||||
|
_**ALL OLD DEPRECATIONS WERE REMOVED**_
|
||||||
|
|
||||||
|
* `Core`:
|
||||||
|
* Type `ChatType` has been added
|
||||||
|
* New `ExtendedChat` for unknown messages `UnknownExtendedChat` has been added
|
||||||
|
* `SendInvoice#startParameter` becomes optional and replaced in `SendInvoice` constructor
|
||||||
|
* New interface `CommonSendInvoiceData` has been added
|
||||||
|
* Fields `CommonSendInvoiceData#maxTipAmount` and `CommonSendInvoiceData#suggestedTipAmounts` have been added
|
||||||
|
* New type `InputInvoiceMessageContent` has been added
|
||||||
|
* New interface `TextedWithTextSources` on top of `Texted` interface
|
||||||
|
* Interface `TextedInput` now extends `TextedWithTextSources` with overriding of `textSources` field as not
|
||||||
|
nullable
|
||||||
|
* `textSources` become main field in `TextedInput`
|
||||||
|
* **MIGRATION** Remove all `import dev.inmo.tgbotapi.CommonAbstracts.textSources` in your project
|
||||||
|
* `textEntities` become are calculable property in `TextedInput`
|
||||||
|
* Interface `Captioned` and `CaptionedInput` now is deprecated
|
||||||
|
* Most of captions usages were replaced with texts
|
||||||
|
* Interface `Explained` and `ExplainedInput` now is deprecated
|
||||||
|
* Most of captions usages were replaced with texts
|
||||||
|
* Interface `VoiceChatEvent` now is `CommonEvent`
|
||||||
|
* Mechanism of `RawMessageEntity` converting were fully rewritten
|
||||||
|
|
||||||
|
## 0.33.4
|
||||||
|
|
||||||
|
* `Common`:
|
||||||
|
* `Version`:
|
||||||
|
* `uuid`: `0.2.3` -> `0.2.4`
|
||||||
|
* `MicroUtils`: `0.4.33` -> `0.4.35`
|
||||||
|
* `Core`:
|
||||||
|
* All `TextSource` implementators have become `Serializable`
|
||||||
|
* New serializer `TextSourceSerializer`
|
||||||
|
* Interface`FromUserMessage` now extends `Message`
|
||||||
|
* New interface `FromUser`
|
||||||
|
* Interface `FromUserMessage` now extends `FromUser`
|
||||||
|
* `Extensions Utils`
|
||||||
|
* Fixes in `parseCommandsWithParams`
|
||||||
|
|
||||||
|
## 0.33.3
|
||||||
|
|
||||||
|
* `Common`:
|
||||||
|
* `Version`:
|
||||||
|
* `MicroUtils`: `0.4.32` -> `0.4.33`
|
||||||
|
* `Ktor`: `1.5.2` -> `1.5.3`
|
||||||
|
* `API`:
|
||||||
|
* Bot actions DSL (fix for [#358](https://github.com/InsanusMokrassar/TelegramBotAPI/issues/358))
|
||||||
|
* `Behaviour Builder`:
|
||||||
|
* Rewrite logic of `doInSubContextWithUpdatesFilter` and `doInSubContextWithFlowsUpdatesFilterSetup` extensions
|
||||||
|
* All triggers now work with `stopOnCompletion` set up to `false`
|
||||||
|
|
||||||
|
## 0.33.2
|
||||||
|
|
||||||
|
* `Common`:
|
||||||
|
* `Version`:
|
||||||
|
* `MicroUtils`: `0.4.30` -> `0.4.32`
|
||||||
|
* `Behaviour Builder`:
|
||||||
|
* New typealias `MediaGroupFilter` has been added for `MediaGroup` expectators
|
||||||
|
* Several typealiases became `suspend`:
|
||||||
|
* `CallbackQueryMapper`
|
||||||
|
* `ChatMemberUpdatedMapper`
|
||||||
|
* `InlineQueryMapper`
|
||||||
|
* Commands got an additional parameter - `additionalFilter`. It will be called when all command filters were passed
|
||||||
|
|
||||||
## 0.33.1
|
## 0.33.1
|
||||||
|
|
||||||
* `Common`:
|
* `Common`:
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ Hello! This is a set of libraries for working with Telegram Bot API.
|
|||||||
|
|
||||||
| Common info | [](https://github.com/KotlinBy/awesome-kotlin) [](https://github.com/InsanusMokrassar/TelegramBotAPI/actions) [Small survey](https://forms.gle/2Hex2ynbHWHhi1KY7)|
|
| Common info | [](https://github.com/KotlinBy/awesome-kotlin) [](https://github.com/InsanusMokrassar/TelegramBotAPI/actions) [Small survey](https://forms.gle/2Hex2ynbHWHhi1KY7)|
|
||||||
| -------------------------------------:|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
| -------------------------------------:|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||||
| Useful links | [](https://t.me/InMoTelegramBotAPI) [](https://github.com/InsanusMokrassar/TelegramBotAPI-bot_template/generate) [](https://tgbotapi.inmo.dev/docs/index.html) [Examples](https://github.com/InsanusMokrassar/TelegramBotAPI-examples/), [Mini tutorial](https://bookstack.inmo.dev/books/telegrambotapi/chapter/introduction-tutorial) |
|
| Useful links | [](https://t.me/InMoTelegramBotAPI) [](https://github.com/InsanusMokrassar/TelegramBotAPI-bot_template/generate) [](https://tgbotapi.inmo.dev/index.html) [Examples](https://github.com/InsanusMokrassar/TelegramBotAPI-examples/), [Mini tutorial](https://bookstack.inmo.dev/books/telegrambotapi/chapter/introduction-tutorial) |
|
||||||
| TelegramBotAPI Core status | [](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi.core) |
|
| TelegramBotAPI Core status | [](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi.core) |
|
||||||
| TelegramBotAPI API Extensions status | [](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi.extensions.api) |
|
| TelegramBotAPI API Extensions status | [](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi.extensions.api) |
|
||||||
| TelegramBotAPI Util Extensions status | [](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi.extensions.utils) |
|
| TelegramBotAPI Util Extensions status | [](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi.extensions.utils) |
|
||||||
|
|||||||
11
build.gradle
11
build.gradle
@@ -18,6 +18,17 @@ plugins {
|
|||||||
id "org.jetbrains.kotlin.plugin.serialization" version "$kotlin_version" apply false
|
id "org.jetbrains.kotlin.plugin.serialization" version "$kotlin_version" apply false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// temporal crutch until legacy tests will be stabled or legacy target will be removed
|
||||||
|
allprojects {
|
||||||
|
if (it != rootProject.findProject("docs")) {
|
||||||
|
tasks.whenTaskAdded { task ->
|
||||||
|
if(task.name == "jsLegacyBrowserTest" || task.name == "jsLegacyNodeTest") {
|
||||||
|
task.enabled = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private String getCurrentVersionChangelog() {
|
private String getCurrentVersionChangelog() {
|
||||||
OutputStream changelogDataOS = new ByteArrayOutputStream()
|
OutputStream changelogDataOS = new ByteArrayOutputStream()
|
||||||
exec {
|
exec {
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ repositories {
|
|||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
jvm()
|
jvm()
|
||||||
js(BOTH) {
|
js(IR) {
|
||||||
browser()
|
browser()
|
||||||
nodejs()
|
nodejs()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
dokka_version=1.4.30
|
dokka_version=1.4.32
|
||||||
|
|
||||||
org.gradle.jvmargs=-Xmx1024m
|
org.gradle.jvmargs=-Xmx1024m
|
||||||
|
|||||||
@@ -5,18 +5,18 @@ kotlin.js.generate.externals=true
|
|||||||
kotlin.incremental=true
|
kotlin.incremental=true
|
||||||
kotlin.incremental.js=true
|
kotlin.incremental.js=true
|
||||||
|
|
||||||
kotlin_version=1.4.32
|
kotlin_version=1.5.21
|
||||||
kotlin_coroutines_version=1.4.3
|
kotlin_coroutines_version=1.5.1
|
||||||
kotlin_serialisation_runtime_version=1.1.0
|
kotlin_serialisation_runtime_version=1.2.2
|
||||||
klock_version=2.0.7
|
klock_version=2.3.1
|
||||||
uuid_version=0.2.3
|
uuid_version=0.3.0
|
||||||
ktor_version=1.5.2
|
ktor_version=1.6.2
|
||||||
|
|
||||||
micro_utils_version=0.4.30
|
micro_utils_version=0.5.19
|
||||||
|
|
||||||
javax_activation_version=1.1.1
|
javax_activation_version=1.1.1
|
||||||
|
|
||||||
library_group=dev.inmo
|
library_group=dev.inmo
|
||||||
library_version=0.33.1
|
library_version=0.35.4
|
||||||
|
|
||||||
github_release_plugin_version=2.2.12
|
github_release_plugin_version=2.2.12
|
||||||
|
|||||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
|
|||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
# TelegramBotAPI Core
|
# TelegramBotAPI Core
|
||||||
|
|
||||||
[ ](https://bintray.com/insanusmokrassar/TelegramBotAPI/tgbotapi.core/_latestVersion)
|
|
||||||
[](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi.core)
|
[](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi.core)
|
||||||
|
|
||||||
## What is it?
|
## What is it?
|
||||||
@@ -10,7 +9,7 @@ moments are describing by official [Telegram Bot API](https://core.telegram.org/
|
|||||||
|
|
||||||
## Compatibility
|
## Compatibility
|
||||||
|
|
||||||
This version compatible with [9th of March 2021 update of TelegramBotAPI (version 5.1)](https://core.telegram.org/bots/api-changelog#march-9-2021).
|
This version compatible with [25th of June 2021 update of TelegramBotAPI (version 5.3)](https://core.telegram.org/bots/api-changelog#june-25-2021).
|
||||||
|
|
||||||
## How to implement library?
|
## How to implement library?
|
||||||
|
|
||||||
|
|||||||
@@ -29,10 +29,8 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
jvm {
|
jvm()
|
||||||
compilations.main.kotlinOptions.useIR = true
|
js(IR) {
|
||||||
}
|
|
||||||
js(BOTH) {
|
|
||||||
browser()
|
browser()
|
||||||
nodejs()
|
nodejs()
|
||||||
}
|
}
|
||||||
@@ -52,6 +50,8 @@ kotlin {
|
|||||||
api "dev.inmo:micro_utils.coroutines:$micro_utils_version"
|
api "dev.inmo:micro_utils.coroutines:$micro_utils_version"
|
||||||
api "dev.inmo:micro_utils.serialization.base64:$micro_utils_version"
|
api "dev.inmo:micro_utils.serialization.base64:$micro_utils_version"
|
||||||
api "dev.inmo:micro_utils.serialization.encapsulator:$micro_utils_version"
|
api "dev.inmo:micro_utils.serialization.encapsulator:$micro_utils_version"
|
||||||
|
api "dev.inmo:micro_utils.serialization.typed_serializer:$micro_utils_version"
|
||||||
|
api "dev.inmo:micro_utils.language_codes:$micro_utils_version"
|
||||||
|
|
||||||
api "io.ktor:ktor-client-core:$ktor_version"
|
api "io.ktor:ktor-client-core:$ktor_version"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
package dev.inmo.tgbotapi.CommonAbstracts
|
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
|
||||||
|
|
||||||
interface Captioned {
|
|
||||||
val caption: String?
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated("This interface is not used in library and will be removed soon")
|
|
||||||
interface CaptionedOutput : Captioned {
|
|
||||||
val parseMode: ParseMode?
|
|
||||||
}
|
|
||||||
|
|
||||||
interface CaptionedInput : Captioned {
|
|
||||||
/**
|
|
||||||
* Full list of entities. This list WILL contain [TextPart]s with [dev.inmo.tgbotapi.types.MessageEntity.textsources.RegularTextSource]
|
|
||||||
*/
|
|
||||||
val captionEntities: List<TextPart>
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see CaptionedInput.captionEntities
|
|
||||||
* @see justTextSources
|
|
||||||
*/
|
|
||||||
val CaptionedInput.textSources
|
|
||||||
get() = captionEntities.justTextSources()
|
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package dev.inmo.tgbotapi.CommonAbstracts
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.types.payments.abstracts.Currencied
|
||||||
|
import dev.inmo.tgbotapi.types.payments.abstracts.Priced
|
||||||
|
|
||||||
|
interface CommonSendInvoiceData : Titled, Currencied, Priced {
|
||||||
|
val description: String
|
||||||
|
val payload: String
|
||||||
|
val providerToken: String
|
||||||
|
val maxTipAmount: Int?
|
||||||
|
val suggestedTipAmounts: List<Int>?
|
||||||
|
val providerData: String?
|
||||||
|
val requireName: Boolean
|
||||||
|
val requirePhoneNumber: Boolean
|
||||||
|
val requireEmail: Boolean
|
||||||
|
val requireShippingAddress: Boolean
|
||||||
|
val shouldSendPhoneNumberToProvider: Boolean
|
||||||
|
val shouldSendEmailToProvider: Boolean
|
||||||
|
val priceDependOnShipAddress: Boolean
|
||||||
|
|
||||||
|
val photoUrl: String?
|
||||||
|
val photoSize: Long?
|
||||||
|
val photoWidth: Int?
|
||||||
|
val photoHeight: Int?
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
fun setPhoto(
|
||||||
|
photoUrl: String,
|
||||||
|
photoSize: Long? = null,
|
||||||
|
photoWidth: Int? = null,
|
||||||
|
photoHeight: Int? = null
|
||||||
|
)
|
||||||
|
|
||||||
|
fun unsetPhoto()
|
||||||
|
}
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
package dev.inmo.tgbotapi.CommonAbstracts
|
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
|
||||||
|
|
||||||
interface Explained {
|
|
||||||
val explanation: String?
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ParsableExplainedOutput : Explained {
|
|
||||||
val parseMode: ParseMode?
|
|
||||||
}
|
|
||||||
|
|
||||||
interface EntitiesExplainedOutput : Explained {
|
|
||||||
val entities: List<TextSource>?
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ExplainedOutput : ParsableExplainedOutput, EntitiesExplainedOutput
|
|
||||||
|
|
||||||
interface ExplainedInput : Explained {
|
|
||||||
/**
|
|
||||||
* Full list of entities. This list WILL contain [TextPart]s with [dev.inmo.tgbotapi.types.MessageEntity.textsources.RegularTextSource]
|
|
||||||
*/
|
|
||||||
val explanationEntities: List<TextPart>
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ExplainedInput.explanationEntities
|
|
||||||
* @see justTextSources
|
|
||||||
*/
|
|
||||||
val ExplainedInput.textSources
|
|
||||||
get() = explanationEntities.justTextSources()
|
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package dev.inmo.tgbotapi.CommonAbstracts
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.types.User
|
||||||
|
|
||||||
|
interface FromUser {
|
||||||
|
val user: User
|
||||||
|
}
|
||||||
@@ -1,86 +1,79 @@
|
|||||||
package dev.inmo.tgbotapi.CommonAbstracts
|
package dev.inmo.tgbotapi.CommonAbstracts
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.regular
|
import dev.inmo.tgbotapi.types.MessageEntity.textsources.*
|
||||||
import dev.inmo.tgbotapi.types.MessageEntity.toTextParts
|
import dev.inmo.tgbotapi.types.MessageEntity.textsources.MultilevelTextSource
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.textsources.separateForCaption
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.textsources.separateForMessage
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.textsources.separateForText
|
||||||
import dev.inmo.tgbotapi.types.captionLength
|
import dev.inmo.tgbotapi.types.captionLength
|
||||||
import dev.inmo.tgbotapi.types.textLength
|
import dev.inmo.tgbotapi.types.textLength
|
||||||
|
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||||
|
|
||||||
const val DirectInvocationOfTextSourceConstructor = "It is strongly not recommended to use constructors directly instead of factory methods"
|
const val DirectInvocationOfTextSourceConstructor =
|
||||||
|
"It is strongly not recommended to use constructors directly instead of factory methods"
|
||||||
|
|
||||||
typealias TextSourcesList = List<TextSource>
|
@Deprecated(
|
||||||
|
"Replaced",
|
||||||
|
ReplaceWith("TextSourcesList", "dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList")
|
||||||
|
)
|
||||||
|
typealias TextSourcesList = TextSourcesList
|
||||||
|
|
||||||
interface TextSource {
|
@Deprecated("Replaced", ReplaceWith("TextSource", "dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource"))
|
||||||
val markdown: String
|
typealias TextSource = TextSource
|
||||||
val markdownV2: String
|
|
||||||
val html: String
|
|
||||||
val source: String
|
|
||||||
|
|
||||||
val asText: String
|
|
||||||
get() = source
|
|
||||||
}
|
|
||||||
|
|
||||||
@Suppress("NOTHING_TO_INLINE")
|
@Suppress("NOTHING_TO_INLINE")
|
||||||
inline operator fun TextSource.plus(other: TextSource) = listOf(this, other)
|
@Deprecated("Replaced", ReplaceWith("plus", "dev.inmo.tgbotapi.types.MessageEntity.textsources.plus"))
|
||||||
|
inline operator fun TextSource.plus(other: TextSource) =
|
||||||
|
listOf(this, other)
|
||||||
|
|
||||||
@Suppress("NOTHING_TO_INLINE")
|
@Suppress("NOTHING_TO_INLINE")
|
||||||
inline operator fun TextSource.plus(other: List<TextSource>) = listOf(this) + other
|
@Deprecated("Replaced", ReplaceWith("plus", "dev.inmo.tgbotapi.types.MessageEntity.textsources.plus"))
|
||||||
|
inline operator fun TextSource.plus(other: List<TextSource>) =
|
||||||
|
listOf(this) + other
|
||||||
|
|
||||||
@Suppress("NOTHING_TO_INLINE")
|
@Suppress("NOTHING_TO_INLINE")
|
||||||
inline operator fun TextSource.plus(text: String) = listOf(this, regular(text))
|
@Deprecated("Replaced", ReplaceWith("plus", "dev.inmo.tgbotapi.types.MessageEntity.textsources.plus"))
|
||||||
|
inline operator fun TextSource.plus(text: String) =
|
||||||
|
listOf(this, regular(text))
|
||||||
|
|
||||||
@Suppress("NOTHING_TO_INLINE")
|
@Suppress("NOTHING_TO_INLINE")
|
||||||
|
@Deprecated("Replaced", ReplaceWith("plus", "dev.inmo.tgbotapi.types.MessageEntity.textsources.plus"))
|
||||||
inline operator fun List<TextSource>.plus(text: String) = this + regular(text)
|
inline operator fun List<TextSource>.plus(text: String) = this + regular(text)
|
||||||
|
|
||||||
interface MultilevelTextSource : TextSource {
|
@Deprecated(
|
||||||
val subsources: List<TextSource>
|
"Replaced",
|
||||||
}
|
ReplaceWith("MultilevelTextSource", "dev.inmo.tgbotapi.types.MessageEntity.textsources.MultilevelTextSource")
|
||||||
|
|
||||||
data class TextPart(
|
|
||||||
val range: IntRange,
|
|
||||||
val source: TextSource
|
|
||||||
)
|
)
|
||||||
|
typealias MultilevelTextSource = MultilevelTextSource
|
||||||
|
|
||||||
fun List<TextPart>.justTextSources() = map { it.source }
|
@Deprecated("Replaced", ReplaceWith("makeString()", "dev.inmo.tgbotapi.utils.extensions.makeString"))
|
||||||
fun List<TextSource>.makeString() = joinToString("") { it.source }
|
fun List<TextSource>.makeString() = makeString()
|
||||||
internal fun MultilevelTextSource.textParts(offset: Int): List<TextPart> = subsources.toTextParts(offset)
|
|
||||||
fun List<TextSource>.separateForMessage(limit: IntRange, numberOfParts: Int? = null): List<List<TextSource>> {
|
|
||||||
if (isEmpty()) {
|
|
||||||
return emptyList()
|
|
||||||
}
|
|
||||||
|
|
||||||
val resultList = mutableListOf<MutableList<TextSource>>(mutableListOf())
|
@Deprecated(
|
||||||
var currentPartLength = 0
|
"Replaced",
|
||||||
val maxSize = limit.last + 1
|
ReplaceWith("separateForMessage", "dev.inmo.tgbotapi.types.MessageEntity.textsources.separateForMessage")
|
||||||
|
)
|
||||||
for (current in this) {
|
fun List<TextSource>.separateForMessage(limit: IntRange, numberOfParts: Int? = null) =
|
||||||
if (current.source.length > maxSize) {
|
separateForMessage(limit, numberOfParts)
|
||||||
error("Currently unsupported parts with size more than target one-message parts (${current.source.length} > ${maxSize})")
|
|
||||||
}
|
|
||||||
|
|
||||||
if (currentPartLength + current.source.length > maxSize) {
|
|
||||||
if (numberOfParts == null || numberOfParts < resultList.size) {
|
|
||||||
resultList.add(mutableListOf())
|
|
||||||
currentPartLength = 0
|
|
||||||
} else {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
resultList.last().add(current)
|
|
||||||
currentPartLength += current.source.length
|
|
||||||
}
|
|
||||||
|
|
||||||
return resultList
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method will prepare [TextSource]s list for messages. Remember, that first part will be separated with
|
* This method will prepare [TextSource]s list for messages. Remember, that first part will be separated with
|
||||||
* [captionLength] and all others with
|
* [captionLength] and all others with
|
||||||
*/
|
*/
|
||||||
fun List<TextSource>.separateForCaption(): List<List<TextSource>> {
|
@Deprecated(
|
||||||
val captionPart = separateForMessage(captionLength, 1).first()
|
"Replaced",
|
||||||
return listOf(captionPart) + minus(captionPart).separateForMessage(textLength)
|
ReplaceWith("separateForCaption", "dev.inmo.tgbotapi.types.MessageEntity.textsources.separateForCaption")
|
||||||
}
|
)
|
||||||
|
fun List<TextSource>.separateForCaption() = separateForCaption()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method will prepare [TextSource]s list for messages with [textLength]
|
* This method will prepare [TextSource]s list for messages with [textLength]
|
||||||
*/
|
*/
|
||||||
@Suppress("NOTHING_TO_INLINE")
|
@Suppress("NOTHING_TO_INLINE")
|
||||||
inline fun List<TextSource>.separateForText(): List<List<TextSource>> = separateForMessage(textLength)
|
@Deprecated(
|
||||||
|
"Replaced",
|
||||||
|
ReplaceWith("separateForText", "dev.inmo.tgbotapi.types.MessageEntity.textsources.separateForText")
|
||||||
|
)
|
||||||
|
inline fun List<TextSource>.separateForText() = separateForText()
|
||||||
|
|||||||
@@ -1,35 +1,29 @@
|
|||||||
package dev.inmo.tgbotapi.CommonAbstracts
|
package dev.inmo.tgbotapi.CommonAbstracts
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
|
|
||||||
interface Texted {
|
interface Texted {
|
||||||
val text: String?
|
val text: String?
|
||||||
}
|
}
|
||||||
|
interface TextedWithTextSources : Texted {
|
||||||
|
/**
|
||||||
|
* Full list of [TextSource]s
|
||||||
|
*/
|
||||||
|
val textSources: List<TextSource>?
|
||||||
|
}
|
||||||
|
|
||||||
interface ParsableOutput : Texted {
|
interface ParsableOutput : Texted {
|
||||||
val parseMode: ParseMode?
|
val parseMode: ParseMode?
|
||||||
}
|
}
|
||||||
|
|
||||||
interface EntitiesOutput : Texted {
|
interface EntitiesOutput : TextedWithTextSources {
|
||||||
val entities: List<TextSource>?
|
val entities: List<TextSource>?
|
||||||
|
get() = textSources
|
||||||
}
|
}
|
||||||
|
|
||||||
interface TextedOutput : ParsableOutput, EntitiesOutput
|
interface TextedOutput : ParsableOutput, EntitiesOutput
|
||||||
|
|
||||||
interface TextedInput : Texted {
|
interface TextedInput : TextedWithTextSources {
|
||||||
/**
|
override val textSources: List<TextSource>
|
||||||
* Here must be full list of entities. This list must contains [TextPart]s with
|
|
||||||
* [dev.inmo.tgbotapi.types.MessageEntity.textsources.RegularTextSource] in case if source text contains parts of
|
|
||||||
* regular text
|
|
||||||
*/
|
|
||||||
val textEntities: List<TextPart>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Full list of [TextSource] built from source[TextedInput.textEntities]
|
|
||||||
*
|
|
||||||
* @see TextedInput.textEntities
|
|
||||||
* @see justTextSources
|
|
||||||
*/
|
|
||||||
val TextedInput.textSources
|
|
||||||
get() = textEntities.justTextSources()
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ class KtorRequestsExecutor(
|
|||||||
) : BaseRequestsExecutor(telegramAPIUrlsKeeper) {
|
) : BaseRequestsExecutor(telegramAPIUrlsKeeper) {
|
||||||
private val callsFactories: List<KtorCallFactory> = callsFactories.run {
|
private val callsFactories: List<KtorCallFactory> = callsFactories.run {
|
||||||
if (!excludeDefaultFactories) {
|
if (!excludeDefaultFactories) {
|
||||||
this + listOf(SimpleRequestCallFactory, MultipartRequestCallFactory, DownloadFileRequestCallFactory)
|
this + listOf(SimpleRequestCallFactory(), MultipartRequestCallFactory(), DownloadFileRequestCallFactory)
|
||||||
} else {
|
} else {
|
||||||
this
|
this
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package dev.inmo.tgbotapi.bot.Ktor.base
|
package dev.inmo.tgbotapi.bot.Ktor.base
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.bot.Ktor.KtorCallFactory
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.*
|
import dev.inmo.tgbotapi.requests.abstracts.*
|
||||||
import dev.inmo.tgbotapi.utils.TelegramAPIUrlsKeeper
|
import dev.inmo.tgbotapi.utils.TelegramAPIUrlsKeeper
|
||||||
import dev.inmo.tgbotapi.utils.mapWithCommonValues
|
import dev.inmo.tgbotapi.utils.mapWithCommonValues
|
||||||
@@ -9,7 +10,7 @@ import io.ktor.client.request.forms.formData
|
|||||||
import io.ktor.http.Headers
|
import io.ktor.http.Headers
|
||||||
import io.ktor.http.HttpHeaders
|
import io.ktor.http.HttpHeaders
|
||||||
|
|
||||||
object MultipartRequestCallFactory : AbstractRequestCallFactory() {
|
class MultipartRequestCallFactory : AbstractRequestCallFactory() {
|
||||||
override fun <T : Any> prepareCallBody(
|
override fun <T : Any> prepareCallBody(
|
||||||
client: HttpClient,
|
client: HttpClient,
|
||||||
urlsKeeper: TelegramAPIUrlsKeeper,
|
urlsKeeper: TelegramAPIUrlsKeeper,
|
||||||
@@ -35,4 +36,7 @@ object MultipartRequestCallFactory : AbstractRequestCallFactory() {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@Deprecated("Use class MultipartRequestCallFactory() constructor call instead of just MultipartRequestCallFactory")
|
||||||
|
companion object : KtorCallFactory by MultipartRequestCallFactory()
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
package dev.inmo.tgbotapi.bot.Ktor.base
|
package dev.inmo.tgbotapi.bot.Ktor.base
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.bot.Ktor.KtorCallFactory
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.*
|
import dev.inmo.tgbotapi.requests.abstracts.*
|
||||||
import dev.inmo.tgbotapi.utils.TelegramAPIUrlsKeeper
|
import dev.inmo.tgbotapi.utils.TelegramAPIUrlsKeeper
|
||||||
import io.ktor.client.HttpClient
|
import io.ktor.client.HttpClient
|
||||||
import io.ktor.http.ContentType
|
import io.ktor.http.ContentType
|
||||||
import io.ktor.http.content.TextContent
|
import io.ktor.http.content.TextContent
|
||||||
|
|
||||||
object SimpleRequestCallFactory : AbstractRequestCallFactory() {
|
class SimpleRequestCallFactory : AbstractRequestCallFactory() {
|
||||||
override fun <T : Any> prepareCallBody(
|
override fun <T : Any> prepareCallBody(
|
||||||
client: HttpClient,
|
client: HttpClient,
|
||||||
urlsKeeper: TelegramAPIUrlsKeeper,
|
urlsKeeper: TelegramAPIUrlsKeeper,
|
||||||
@@ -19,4 +20,7 @@ object SimpleRequestCallFactory : AbstractRequestCallFactory() {
|
|||||||
ContentType.Application.Json
|
ContentType.Application.Json
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@Deprecated("Use class SimpleRequestCallFactory() constructor call instead of just SimpleRequestCallFactory")
|
||||||
|
companion object : KtorCallFactory by SimpleRequestCallFactory()
|
||||||
|
}
|
||||||
|
|||||||
@@ -25,6 +25,12 @@ fun newRequestException(
|
|||||||
message,
|
message,
|
||||||
cause
|
cause
|
||||||
)
|
)
|
||||||
|
description.contains("Conflict: terminated by other getUpdates request") -> GetUpdatesConflict(
|
||||||
|
response,
|
||||||
|
plainAnswer,
|
||||||
|
message,
|
||||||
|
cause
|
||||||
|
)
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
} ?: CommonRequestException(response, plainAnswer, message, cause)
|
} ?: CommonRequestException(response, plainAnswer, message, cause)
|
||||||
@@ -61,3 +67,6 @@ class WrongFileIdentifierException(response: Response, plainAnswer: String, mess
|
|||||||
|
|
||||||
class TooMuchRequestsException(val retryAfter: RetryAfterError, response: Response, plainAnswer: String, message: String?, cause: Throwable?) :
|
class TooMuchRequestsException(val retryAfter: RetryAfterError, response: Response, plainAnswer: String, message: String?, cause: Throwable?) :
|
||||||
RequestException(response, plainAnswer, message, cause)
|
RequestException(response, plainAnswer, message, cause)
|
||||||
|
|
||||||
|
class GetUpdatesConflict(response: Response, plainAnswer: String, message: String?, cause: Throwable?) :
|
||||||
|
RequestException(response, plainAnswer, message, cause)
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
|||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
import dev.inmo.tgbotapi.types.polls.Poll
|
import dev.inmo.tgbotapi.types.polls.Poll
|
||||||
|
import dev.inmo.tgbotapi.types.polls.PollSerializer
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
@@ -19,7 +20,7 @@ data class StopPoll(
|
|||||||
) : MessageAction, SimpleRequest<Poll>, ReplyMarkup {
|
) : MessageAction, SimpleRequest<Poll>, ReplyMarkup {
|
||||||
override fun method(): String = "stopPoll"
|
override fun method(): String = "stopPoll"
|
||||||
override val resultDeserializer: DeserializationStrategy<Poll>
|
override val resultDeserializer: DeserializationStrategy<Poll>
|
||||||
get() = Poll.serializer()
|
get() = PollSerializer
|
||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
package dev.inmo.tgbotapi.requests.abstracts
|
package dev.inmo.tgbotapi.requests.abstracts
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||||
import dev.inmo.tgbotapi.utils.StorageFile
|
import dev.inmo.tgbotapi.utils.StorageFile
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.KSerializer
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
import kotlinx.serialization.descriptors.*
|
import kotlinx.serialization.descriptors.*
|
||||||
import kotlinx.serialization.encoding.Decoder
|
import kotlinx.serialization.encoding.Decoder
|
||||||
import kotlinx.serialization.encoding.Encoder
|
import kotlinx.serialization.encoding.Encoder
|
||||||
@@ -30,8 +32,8 @@ data class FileId(
|
|||||||
|
|
||||||
fun String.toInputFile() = FileId(this)
|
fun String.toInputFile() = FileId(this)
|
||||||
|
|
||||||
@Serializer(InputFile::class)
|
@RiskFeature
|
||||||
internal object InputFileSerializer : KSerializer<InputFile> {
|
object InputFileSerializer : KSerializer<InputFile> {
|
||||||
override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor(FileId::class.toString(), PrimitiveKind.STRING)
|
override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor(FileId::class.toString(), PrimitiveKind.STRING)
|
||||||
override fun serialize(encoder: Encoder, value: InputFile) = encoder.encodeString(value.fileId)
|
override fun serialize(encoder: Encoder, value: InputFile) = encoder.encodeString(value.fileId)
|
||||||
override fun deserialize(decoder: Decoder): FileId = FileId(decoder.decodeString())
|
override fun deserialize(decoder: Decoder): FileId = FileId(decoder.decodeString())
|
||||||
|
|||||||
@@ -4,7 +4,8 @@ import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
|||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.InlineQueryResult
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.InlineQueryResult
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.serializers.InlineQueryResultSerializer
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.serializers.InlineQueryResultSerializer
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InlineQuery
|
import dev.inmo.tgbotapi.types.InlineQueries.query.InlineQuery
|
||||||
|
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
import kotlinx.serialization.builtins.ListSerializer
|
import kotlinx.serialization.builtins.ListSerializer
|
||||||
import kotlinx.serialization.builtins.serializer
|
import kotlinx.serialization.builtins.serializer
|
||||||
@@ -26,7 +27,7 @@ data class AnswerInlineQuery(
|
|||||||
val switchPmText: String? = null,
|
val switchPmText: String? = null,
|
||||||
@SerialName(switchPmParameterField)
|
@SerialName(switchPmParameterField)
|
||||||
val switchPmParameter: String? = null
|
val switchPmParameter: String? = null
|
||||||
): SimpleRequest<Boolean> {
|
) : SimpleRequest<Boolean> {
|
||||||
override fun method(): String = "answerInlineQuery"
|
override fun method(): String = "answerInlineQuery"
|
||||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||||
get() = Boolean.serializer()
|
get() = Boolean.serializer()
|
||||||
@@ -51,6 +52,7 @@ fun InlineQuery.createAnswer(
|
|||||||
switchPmParameter
|
switchPmParameter
|
||||||
)
|
)
|
||||||
|
|
||||||
internal object InlineQueryAnswersResultsSerializer: KSerializer<List<InlineQueryResult>> by ListSerializer(
|
@RiskFeature
|
||||||
|
object InlineQueryAnswersResultsSerializer : KSerializer<List<InlineQueryResult>> by ListSerializer(
|
||||||
InlineQueryResultSerializer
|
InlineQueryResultSerializer
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import dev.inmo.tgbotapi.requests.answers.payments.abstracts.AnswerShippingQuery
|
|||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.payments.ShippingOption
|
import dev.inmo.tgbotapi.types.payments.ShippingOption
|
||||||
import dev.inmo.tgbotapi.types.payments.ShippingQuery
|
import dev.inmo.tgbotapi.types.payments.ShippingQuery
|
||||||
|
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
import kotlinx.serialization.builtins.ListSerializer
|
import kotlinx.serialization.builtins.ListSerializer
|
||||||
|
|
||||||
@@ -21,7 +22,8 @@ data class AnswerShippingQueryOk(
|
|||||||
get() = serializer()
|
get() = serializer()
|
||||||
}
|
}
|
||||||
|
|
||||||
internal object ShippingOptionsSerializer : KSerializer<List<ShippingOption>> by ListSerializer(
|
@RiskFeature
|
||||||
|
object ShippingOptionsSerializer : KSerializer<List<ShippingOption>> by ListSerializer(
|
||||||
ShippingOption.serializer()
|
ShippingOption.serializer()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package dev.inmo.tgbotapi.requests.bot
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||||
|
import dev.inmo.tgbotapi.types.abstracts.WithOptionalLanguageCode
|
||||||
|
import dev.inmo.tgbotapi.types.commands.BotCommandScope
|
||||||
|
|
||||||
|
sealed interface MyCommandsRequest<T : Any> : SimpleRequest<T>, WithOptionalLanguageCode {
|
||||||
|
val scope: BotCommandScope
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package dev.inmo.tgbotapi.requests.bot
|
||||||
|
|
||||||
|
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
||||||
|
import dev.inmo.micro_utils.language_codes.IetfLanguageCodeSerializer
|
||||||
|
import dev.inmo.tgbotapi.types.commands.*
|
||||||
|
import dev.inmo.tgbotapi.types.languageCodeField
|
||||||
|
import dev.inmo.tgbotapi.types.scopeField
|
||||||
|
import kotlinx.serialization.*
|
||||||
|
import kotlinx.serialization.builtins.serializer
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class DeleteMyCommands(
|
||||||
|
@SerialName(scopeField)
|
||||||
|
@Serializable(BotCommandScopeSerializer::class)
|
||||||
|
override val scope: BotCommandScope = BotCommandScopeDefault,
|
||||||
|
@SerialName(languageCodeField)
|
||||||
|
@Serializable(IetfLanguageCodeSerializer::class)
|
||||||
|
override val ietfLanguageCode: IetfLanguageCode? = null
|
||||||
|
) : MyCommandsRequest<Boolean> {
|
||||||
|
override fun method(): String = "deleteMyCommands"
|
||||||
|
override val requestSerializer: SerializationStrategy<DeleteMyCommands> = serializer()
|
||||||
|
override val resultDeserializer: DeserializationStrategy<Boolean> = Boolean.serializer()
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
scope: BotCommandScope = BotCommandScopeDefault,
|
||||||
|
languageCode: String?
|
||||||
|
) : this(
|
||||||
|
scope,
|
||||||
|
languageCode ?.let(::IetfLanguageCode)
|
||||||
|
)
|
||||||
|
|
||||||
|
companion object : MyCommandsRequest<Boolean> by DeleteMyCommands()
|
||||||
|
}
|
||||||
@@ -1,17 +1,36 @@
|
|||||||
package dev.inmo.tgbotapi.requests.bot
|
package dev.inmo.tgbotapi.requests.bot
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
||||||
import dev.inmo.tgbotapi.types.BotCommand
|
import dev.inmo.micro_utils.language_codes.IetfLanguageCodeSerializer
|
||||||
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import dev.inmo.tgbotapi.types.commands.*
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
import kotlinx.serialization.builtins.ListSerializer
|
import kotlinx.serialization.builtins.ListSerializer
|
||||||
|
|
||||||
private val getMyCommandsSerializer = ListSerializer(BotCommand.serializer())
|
private val getMyCommandsSerializer = ListSerializer(BotCommand.serializer())
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
object GetMyCommands : SimpleRequest<List<BotCommand>> {
|
data class GetMyCommands(
|
||||||
|
@SerialName(scopeField)
|
||||||
|
@Serializable(BotCommandScopeSerializer::class)
|
||||||
|
override val scope: BotCommandScope = BotCommandScopeDefault,
|
||||||
|
@SerialName(languageCodeField)
|
||||||
|
@Serializable(IetfLanguageCodeSerializer::class)
|
||||||
|
override val ietfLanguageCode: IetfLanguageCode? = null
|
||||||
|
) : MyCommandsRequest<List<BotCommand>> {
|
||||||
override fun method(): String = "getMyCommands"
|
override fun method(): String = "getMyCommands"
|
||||||
override val resultDeserializer: DeserializationStrategy<List<BotCommand>>
|
override val resultDeserializer: DeserializationStrategy<List<BotCommand>>
|
||||||
get() = getMyCommandsSerializer
|
get() = getMyCommandsSerializer
|
||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
scope: BotCommandScope = BotCommandScopeDefault,
|
||||||
|
languageCode: String?
|
||||||
|
) : this(
|
||||||
|
scope,
|
||||||
|
languageCode ?.let(::IetfLanguageCode)
|
||||||
|
)
|
||||||
|
|
||||||
|
companion object : MyCommandsRequest<List<BotCommand>> by GetMyCommands()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,21 +1,39 @@
|
|||||||
package dev.inmo.tgbotapi.requests.bot
|
package dev.inmo.tgbotapi.requests.bot
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
||||||
|
import dev.inmo.micro_utils.language_codes.IetfLanguageCodeSerializer
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import dev.inmo.tgbotapi.types.commands.*
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
import kotlinx.serialization.builtins.serializer
|
import kotlinx.serialization.builtins.serializer
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
class SetMyCommands(
|
class SetMyCommands(
|
||||||
@SerialName(botCommandsField)
|
@SerialName(botCommandsField)
|
||||||
val commands: List<BotCommand>
|
val commands: List<BotCommand>,
|
||||||
) : SimpleRequest<Boolean> {
|
@SerialName(scopeField)
|
||||||
|
@Serializable(BotCommandScopeSerializer::class)
|
||||||
|
override val scope: BotCommandScope = BotCommandScopeDefault,
|
||||||
|
@SerialName(languageCodeField)
|
||||||
|
@Serializable(IetfLanguageCodeSerializer::class)
|
||||||
|
override val ietfLanguageCode: IetfLanguageCode? = null
|
||||||
|
) : MyCommandsRequest<Boolean> {
|
||||||
override fun method(): String = "setMyCommands"
|
override fun method(): String = "setMyCommands"
|
||||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||||
get() = Boolean.serializer()
|
get() = Boolean.serializer()
|
||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
commands: List<BotCommand>,
|
||||||
|
scope: BotCommandScope = BotCommandScopeDefault,
|
||||||
|
languageCode: String?
|
||||||
|
) : this(
|
||||||
|
commands,
|
||||||
|
scope,
|
||||||
|
languageCode ?.let(::IetfLanguageCode)
|
||||||
|
)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
if (commands.size !in botCommandsLimit) {
|
if (commands.size !in botCommandsLimit) {
|
||||||
error("Bot commands list size able to be in range $botCommandsLimit, but incoming size is ${commands.size}")
|
error("Bot commands list size able to be in range $botCommandsLimit, but incoming size is ${commands.size}")
|
||||||
|
|||||||
@@ -8,13 +8,16 @@ import kotlinx.serialization.*
|
|||||||
import kotlinx.serialization.builtins.serializer
|
import kotlinx.serialization.builtins.serializer
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class GetChatMembersCount(
|
data class GetChatMemberCount(
|
||||||
@SerialName(chatIdField)
|
@SerialName(chatIdField)
|
||||||
override val chatId: ChatIdentifier
|
override val chatId: ChatIdentifier
|
||||||
): ChatRequest, SimpleRequest<Int> {
|
): ChatRequest, SimpleRequest<Int> {
|
||||||
override fun method(): String = "getChatMembersCount"
|
override fun method(): String = "getChatMemberCount"
|
||||||
override val resultDeserializer: DeserializationStrategy<Int>
|
override val resultDeserializer: DeserializationStrategy<Int>
|
||||||
get() = Int.serializer()
|
get() = Int.serializer()
|
||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated("Renamed", ReplaceWith("GetChatMemberCount", "dev.inmo.tgbotapi.requests.chat.get.GetChatMemberCount"))
|
||||||
|
typealias GetChatMembersCount = GetChatMemberCount
|
||||||
@@ -7,7 +7,7 @@ import kotlinx.serialization.*
|
|||||||
import kotlinx.serialization.builtins.serializer
|
import kotlinx.serialization.builtins.serializer
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class KickChatMember(
|
data class BanChatMember(
|
||||||
@SerialName(chatIdField)
|
@SerialName(chatIdField)
|
||||||
override val chatId: ChatIdentifier,
|
override val chatId: ChatIdentifier,
|
||||||
@SerialName(userIdField)
|
@SerialName(userIdField)
|
||||||
@@ -17,9 +17,12 @@ data class KickChatMember(
|
|||||||
@SerialName(revokeMessagesField)
|
@SerialName(revokeMessagesField)
|
||||||
val revokeMessages: Boolean? = null
|
val revokeMessages: Boolean? = null
|
||||||
) : ChatMemberRequest<Boolean>, UntilDate {
|
) : ChatMemberRequest<Boolean>, UntilDate {
|
||||||
override fun method(): String = "kickChatMember"
|
override fun method(): String = "banChatMember"
|
||||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||||
get() = Boolean.serializer()
|
get() = Boolean.serializer()
|
||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated("Renamed", ReplaceWith("BanChatMember", "dev.inmo.tgbotapi.requests.chat.members.BanChatMember"))
|
||||||
|
typealias KickChatMember = BanChatMember
|
||||||
@@ -1,15 +1,16 @@
|
|||||||
package dev.inmo.tgbotapi.requests.edit.caption
|
package dev.inmo.tgbotapi.requests.edit.caption
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.*
|
|
||||||
import dev.inmo.tgbotapi.requests.edit.abstracts.*
|
import dev.inmo.tgbotapi.requests.edit.abstracts.*
|
||||||
import dev.inmo.tgbotapi.requests.edit.media.MediaContentMessageResultDeserializer
|
import dev.inmo.tgbotapi.requests.edit.media.MediaContentMessageResultDeserializer
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||||
import dev.inmo.tgbotapi.types.message.content.abstracts.MediaContent
|
import dev.inmo.tgbotapi.types.message.content.abstracts.MediaContent
|
||||||
|
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
const val editMessageCaptionMethod = "editMessageCaption"
|
const val editMessageCaptionMethod = "editMessageCaption"
|
||||||
@@ -32,7 +33,7 @@ fun EditChatMessageCaption(
|
|||||||
fun EditChatMessageCaption(
|
fun EditChatMessageCaption(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
messageId: MessageIdentifier,
|
messageId: MessageIdentifier,
|
||||||
entities: List<TextSource>,
|
entities: TextSourcesList,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = EditChatMessageCaption(
|
) = EditChatMessageCaption(
|
||||||
chatId,
|
chatId,
|
||||||
@@ -58,8 +59,8 @@ data class EditChatMessageCaption internal constructor(
|
|||||||
@SerialName(replyMarkupField)
|
@SerialName(replyMarkupField)
|
||||||
override val replyMarkup: InlineKeyboardMarkup? = null
|
override val replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) : EditChatMessage<MediaContent>, EditTextChatMessage, EditReplyMessage {
|
) : EditChatMessage<MediaContent>, EditTextChatMessage, EditReplyMessage {
|
||||||
override val entities: List<TextSource>? by lazy {
|
override val textSources: TextSourcesList? by lazy {
|
||||||
rawEntities ?.asTextParts(text) ?.justTextSources()
|
rawEntities ?.asTextSources(text)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun method(): String = editMessageCaptionMethod
|
override fun method(): String = editMessageCaptionMethod
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
package dev.inmo.tgbotapi.requests.edit.caption
|
package dev.inmo.tgbotapi.requests.edit.caption
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.*
|
|
||||||
import dev.inmo.tgbotapi.requests.edit.abstracts.*
|
import dev.inmo.tgbotapi.requests.edit.abstracts.*
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
|
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
fun EditInlineMessageCaption(
|
fun EditInlineMessageCaption(
|
||||||
@@ -24,7 +25,7 @@ fun EditInlineMessageCaption(
|
|||||||
|
|
||||||
fun EditInlineMessageCaption(
|
fun EditInlineMessageCaption(
|
||||||
inlineMessageId: InlineMessageIdentifier,
|
inlineMessageId: InlineMessageIdentifier,
|
||||||
entities: List<TextSource>,
|
entities: TextSourcesList,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = EditInlineMessageCaption(
|
) = EditInlineMessageCaption(
|
||||||
inlineMessageId,
|
inlineMessageId,
|
||||||
@@ -47,8 +48,8 @@ data class EditInlineMessageCaption internal constructor(
|
|||||||
@SerialName(replyMarkupField)
|
@SerialName(replyMarkupField)
|
||||||
override val replyMarkup: InlineKeyboardMarkup? = null
|
override val replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) : EditInlineMessage, EditTextChatMessage, EditReplyMessage {
|
) : EditInlineMessage, EditTextChatMessage, EditReplyMessage {
|
||||||
override val entities: List<TextSource>? by lazy {
|
override val textSources: TextSourcesList? by lazy {
|
||||||
rawEntities ?.asTextParts(text) ?.justTextSources()
|
rawEntities ?.asTextSources(text)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun method(): String = editMessageCaptionMethod
|
override fun method(): String = editMessageCaptionMethod
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
package dev.inmo.tgbotapi.requests.edit.text
|
package dev.inmo.tgbotapi.requests.edit.text
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.*
|
|
||||||
import dev.inmo.tgbotapi.requests.edit.abstracts.*
|
import dev.inmo.tgbotapi.requests.edit.abstracts.*
|
||||||
import dev.inmo.tgbotapi.requests.send.TextContentMessageResultDeserializer
|
import dev.inmo.tgbotapi.requests.send.TextContentMessageResultDeserializer
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||||
import dev.inmo.tgbotapi.types.message.content.TextContent
|
import dev.inmo.tgbotapi.types.message.content.TextContent
|
||||||
|
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
const val editMessageTextMethod = "editMessageText"
|
const val editMessageTextMethod = "editMessageText"
|
||||||
@@ -34,7 +35,7 @@ fun EditChatMessageText(
|
|||||||
fun EditChatMessageText(
|
fun EditChatMessageText(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
messageId: MessageIdentifier,
|
messageId: MessageIdentifier,
|
||||||
entities: List<TextSource>,
|
entities: TextSourcesList,
|
||||||
disableWebPagePreview: Boolean? = null,
|
disableWebPagePreview: Boolean? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = EditChatMessageText(
|
) = EditChatMessageText(
|
||||||
@@ -64,8 +65,8 @@ data class EditChatMessageText internal constructor(
|
|||||||
@SerialName(replyMarkupField)
|
@SerialName(replyMarkupField)
|
||||||
override val replyMarkup: InlineKeyboardMarkup? = null
|
override val replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) : EditChatMessage<TextContent>, EditTextChatMessage, EditReplyMessage, EditDisableWebPagePreviewMessage {
|
) : EditChatMessage<TextContent>, EditTextChatMessage, EditReplyMessage, EditDisableWebPagePreviewMessage {
|
||||||
override val entities: List<TextSource>? by lazy {
|
override val textSources: TextSourcesList? by lazy {
|
||||||
rawEntities ?.asTextParts(text) ?.justTextSources()
|
rawEntities ?.asTextSources(text)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun method(): String = editMessageTextMethod
|
override fun method(): String = editMessageTextMethod
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
package dev.inmo.tgbotapi.requests.edit.text
|
package dev.inmo.tgbotapi.requests.edit.text
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.*
|
|
||||||
import dev.inmo.tgbotapi.requests.edit.abstracts.*
|
import dev.inmo.tgbotapi.requests.edit.abstracts.*
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
|
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
fun EditInlineMessageText(
|
fun EditInlineMessageText(
|
||||||
@@ -26,7 +27,7 @@ fun EditInlineMessageText(
|
|||||||
|
|
||||||
fun EditInlineMessageText(
|
fun EditInlineMessageText(
|
||||||
inlineMessageId: InlineMessageIdentifier,
|
inlineMessageId: InlineMessageIdentifier,
|
||||||
entities: List<TextSource>,
|
entities: TextSourcesList,
|
||||||
disableWebPagePreview: Boolean? = null,
|
disableWebPagePreview: Boolean? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = EditInlineMessageText(
|
) = EditInlineMessageText(
|
||||||
@@ -53,8 +54,8 @@ data class EditInlineMessageText internal constructor(
|
|||||||
@SerialName(replyMarkupField)
|
@SerialName(replyMarkupField)
|
||||||
override val replyMarkup: InlineKeyboardMarkup? = null
|
override val replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) : EditInlineMessage, EditTextChatMessage, EditReplyMessage, EditDisableWebPagePreviewMessage {
|
) : EditInlineMessage, EditTextChatMessage, EditReplyMessage, EditDisableWebPagePreviewMessage {
|
||||||
override val entities: List<TextSource>? by lazy {
|
override val textSources: TextSourcesList? by lazy {
|
||||||
rawEntities ?.asTextParts(text) ?.justTextSources()
|
rawEntities ?.asTextSources(text)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun method(): String = editMessageTextMethod
|
override fun method(): String = editMessageTextMethod
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package dev.inmo.tgbotapi.requests.games.abstracts
|
|||||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||||
import dev.inmo.tgbotapi.types.UserId
|
import dev.inmo.tgbotapi.types.UserId
|
||||||
import dev.inmo.tgbotapi.types.games.GameHighScore
|
import dev.inmo.tgbotapi.types.games.GameHighScore
|
||||||
|
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||||
import kotlinx.serialization.DeserializationStrategy
|
import kotlinx.serialization.DeserializationStrategy
|
||||||
import kotlinx.serialization.KSerializer
|
import kotlinx.serialization.KSerializer
|
||||||
import kotlinx.serialization.builtins.ListSerializer
|
import kotlinx.serialization.builtins.ListSerializer
|
||||||
@@ -15,4 +16,5 @@ interface GetGameHighScores : SimpleRequest<List<GameHighScore>> {
|
|||||||
get() = GameHighScoresSerializer
|
get() = GameHighScoresSerializer
|
||||||
}
|
}
|
||||||
|
|
||||||
internal object GameHighScoresSerializer : KSerializer<List<GameHighScore>> by ListSerializer(GameHighScore.serializer())
|
@RiskFeature
|
||||||
|
object GameHighScoresSerializer : KSerializer<List<GameHighScore>> by ListSerializer(GameHighScore.serializer())
|
||||||
|
|||||||
@@ -1,14 +1,16 @@
|
|||||||
package dev.inmo.tgbotapi.requests.send
|
package dev.inmo.tgbotapi.requests.send
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.*
|
import dev.inmo.tgbotapi.CommonAbstracts.TextedOutput
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.types.MessageAction
|
import dev.inmo.tgbotapi.CommonAbstracts.types.MessageAction
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||||
import dev.inmo.tgbotapi.requests.send.abstracts.ReplyingMarkupSendMessageRequest
|
import dev.inmo.tgbotapi.requests.send.abstracts.ReplyingMarkupSendMessageRequest
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||||
|
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
fun CopyMessage(
|
fun CopyMessage(
|
||||||
@@ -32,7 +34,18 @@ fun CopyMessage(
|
|||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = CopyMessage(fromChatId, toChatId, messageId, entities.makeString(), null, entities.toRawMessageEntities(), disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = CopyMessage(
|
||||||
|
fromChatId,
|
||||||
|
toChatId,
|
||||||
|
messageId,
|
||||||
|
entities.makeString(),
|
||||||
|
null,
|
||||||
|
entities.toRawMessageEntities(),
|
||||||
|
disableNotification,
|
||||||
|
replyToMessageId,
|
||||||
|
allowSendingWithoutReply,
|
||||||
|
replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class CopyMessage internal constructor(
|
data class CopyMessage internal constructor(
|
||||||
@@ -62,8 +75,8 @@ data class CopyMessage internal constructor(
|
|||||||
TextedOutput {
|
TextedOutput {
|
||||||
override val chatId: ChatIdentifier
|
override val chatId: ChatIdentifier
|
||||||
get() = fromChatId
|
get() = fromChatId
|
||||||
override val entities: List<TextSource>? by lazy {
|
override val textSources: List<TextSource>? by lazy {
|
||||||
rawEntities ?.asTextParts(text ?: return@lazy null) ?.justTextSources()
|
rawEntities ?.asTextSources(text ?: return@lazy null)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun method(): String = "copyMessage"
|
override fun method(): String = "copyMessage"
|
||||||
|
|||||||
@@ -1,16 +1,17 @@
|
|||||||
package dev.inmo.tgbotapi.requests.send
|
package dev.inmo.tgbotapi.requests.send
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.*
|
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.types.DisableWebPagePreview
|
import dev.inmo.tgbotapi.CommonAbstracts.types.DisableWebPagePreview
|
||||||
import dev.inmo.tgbotapi.requests.send.abstracts.*
|
import dev.inmo.tgbotapi.requests.send.abstracts.*
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
||||||
import dev.inmo.tgbotapi.types.message.content.TextContent
|
import dev.inmo.tgbotapi.types.message.content.TextContent
|
||||||
|
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||||
import dev.inmo.tgbotapi.utils.throwRangeError
|
import dev.inmo.tgbotapi.utils.throwRangeError
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
@@ -40,7 +41,7 @@ fun SendTextMessage(
|
|||||||
|
|
||||||
fun SendTextMessage(
|
fun SendTextMessage(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
entities: List<TextSource>,
|
entities: TextSourcesList,
|
||||||
disableWebPagePreview: Boolean? = null,
|
disableWebPagePreview: Boolean? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
@@ -83,8 +84,8 @@ data class SendTextMessage internal constructor(
|
|||||||
TextableSendMessageRequest<ContentMessage<TextContent>>,
|
TextableSendMessageRequest<ContentMessage<TextContent>>,
|
||||||
DisableWebPagePreview
|
DisableWebPagePreview
|
||||||
{
|
{
|
||||||
override val entities: List<TextSource>? by lazy {
|
override val textSources: TextSourcesList? by lazy {
|
||||||
rawEntities ?.asTextParts(text) ?.justTextSources()
|
rawEntities ?.asTextSources(text)
|
||||||
}
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
|||||||
@@ -1,17 +1,18 @@
|
|||||||
package dev.inmo.tgbotapi.requests.send.media
|
package dev.inmo.tgbotapi.requests.send.media
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.*
|
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.*
|
import dev.inmo.tgbotapi.requests.abstracts.*
|
||||||
import dev.inmo.tgbotapi.requests.send.abstracts.*
|
import dev.inmo.tgbotapi.requests.send.abstracts.*
|
||||||
import dev.inmo.tgbotapi.requests.send.media.base.*
|
import dev.inmo.tgbotapi.requests.send.media.base.*
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
||||||
import dev.inmo.tgbotapi.types.message.content.media.AnimationContent
|
import dev.inmo.tgbotapi.types.message.content.media.AnimationContent
|
||||||
|
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||||
import dev.inmo.tgbotapi.utils.mapOfNotNull
|
import dev.inmo.tgbotapi.utils.mapOfNotNull
|
||||||
import dev.inmo.tgbotapi.utils.throwRangeError
|
import dev.inmo.tgbotapi.utils.throwRangeError
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
@@ -20,7 +21,7 @@ fun SendAnimation(
|
|||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
animation: InputFile,
|
animation: InputFile,
|
||||||
thumb: InputFile? = null,
|
thumb: InputFile? = null,
|
||||||
caption: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
duration: Long? = null,
|
duration: Long? = null,
|
||||||
width: Int? = null,
|
width: Int? = null,
|
||||||
@@ -39,7 +40,7 @@ fun SendAnimation(
|
|||||||
chatId,
|
chatId,
|
||||||
animationAsFileId,
|
animationAsFileId,
|
||||||
thumbAsFileId,
|
thumbAsFileId,
|
||||||
caption,
|
text,
|
||||||
parseMode,
|
parseMode,
|
||||||
null,
|
null,
|
||||||
duration,
|
duration,
|
||||||
@@ -65,7 +66,7 @@ fun SendAnimation(
|
|||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
animation: InputFile,
|
animation: InputFile,
|
||||||
thumb: InputFile? = null,
|
thumb: InputFile? = null,
|
||||||
entities: List<TextSource>,
|
entities: TextSourcesList,
|
||||||
duration: Long? = null,
|
duration: Long? = null,
|
||||||
width: Int? = null,
|
width: Int? = null,
|
||||||
height: Int? = null,
|
height: Int? = null,
|
||||||
@@ -144,8 +145,8 @@ data class SendAnimationData internal constructor(
|
|||||||
DuratedSendMessageRequest<ContentMessage<AnimationContent>>,
|
DuratedSendMessageRequest<ContentMessage<AnimationContent>>,
|
||||||
SizedSendMessageRequest<ContentMessage<AnimationContent>>
|
SizedSendMessageRequest<ContentMessage<AnimationContent>>
|
||||||
{
|
{
|
||||||
override val entities: List<TextSource>? by lazy {
|
override val textSources: TextSourcesList? by lazy {
|
||||||
rawEntities ?.asTextParts(text ?: return@lazy null) ?.justTextSources()
|
rawEntities ?.asTextSources(text ?: return@lazy null)
|
||||||
}
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
|||||||
@@ -1,17 +1,19 @@
|
|||||||
package dev.inmo.tgbotapi.requests.send.media
|
package dev.inmo.tgbotapi.requests.send.media
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.*
|
import dev.inmo.tgbotapi.CommonAbstracts.Performerable
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.*
|
import dev.inmo.tgbotapi.requests.abstracts.*
|
||||||
import dev.inmo.tgbotapi.requests.send.abstracts.*
|
import dev.inmo.tgbotapi.requests.send.abstracts.*
|
||||||
import dev.inmo.tgbotapi.requests.send.media.base.*
|
import dev.inmo.tgbotapi.requests.send.media.base.*
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
||||||
import dev.inmo.tgbotapi.types.message.content.media.AudioContent
|
import dev.inmo.tgbotapi.types.message.content.media.AudioContent
|
||||||
|
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||||
import dev.inmo.tgbotapi.utils.mapOfNotNull
|
import dev.inmo.tgbotapi.utils.mapOfNotNull
|
||||||
import dev.inmo.tgbotapi.utils.throwRangeError
|
import dev.inmo.tgbotapi.utils.throwRangeError
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
@@ -20,7 +22,7 @@ fun SendAudio(
|
|||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
audio: InputFile,
|
audio: InputFile,
|
||||||
thumb: InputFile? = null,
|
thumb: InputFile? = null,
|
||||||
caption: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
duration: Long? = null,
|
duration: Long? = null,
|
||||||
performer: String? = null,
|
performer: String? = null,
|
||||||
@@ -39,7 +41,7 @@ fun SendAudio(
|
|||||||
chatId,
|
chatId,
|
||||||
audioAsFileId,
|
audioAsFileId,
|
||||||
thumbAsFileId,
|
thumbAsFileId,
|
||||||
caption,
|
text,
|
||||||
parseMode,
|
parseMode,
|
||||||
null,
|
null,
|
||||||
duration,
|
duration,
|
||||||
@@ -145,8 +147,8 @@ data class SendAudioData internal constructor(
|
|||||||
DuratedSendMessageRequest<ContentMessage<AudioContent>>,
|
DuratedSendMessageRequest<ContentMessage<AudioContent>>,
|
||||||
Performerable
|
Performerable
|
||||||
{
|
{
|
||||||
override val entities: List<TextSource>? by lazy {
|
override val textSources: List<TextSource>? by lazy {
|
||||||
rawEntities ?.asTextParts(text ?: return@lazy null) ?.justTextSources()
|
rawEntities ?.asTextSources(text ?: return@lazy null)
|
||||||
}
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
|||||||
@@ -1,17 +1,18 @@
|
|||||||
package dev.inmo.tgbotapi.requests.send.media
|
package dev.inmo.tgbotapi.requests.send.media
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.*
|
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.*
|
import dev.inmo.tgbotapi.requests.abstracts.*
|
||||||
import dev.inmo.tgbotapi.requests.send.abstracts.*
|
import dev.inmo.tgbotapi.requests.send.abstracts.*
|
||||||
import dev.inmo.tgbotapi.requests.send.media.base.*
|
import dev.inmo.tgbotapi.requests.send.media.base.*
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
||||||
import dev.inmo.tgbotapi.types.message.content.media.DocumentContent
|
import dev.inmo.tgbotapi.types.message.content.media.DocumentContent
|
||||||
|
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||||
import dev.inmo.tgbotapi.utils.mapOfNotNull
|
import dev.inmo.tgbotapi.utils.mapOfNotNull
|
||||||
import dev.inmo.tgbotapi.utils.throwRangeError
|
import dev.inmo.tgbotapi.utils.throwRangeError
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
@@ -29,7 +30,7 @@ fun SendDocument(
|
|||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
document: InputFile,
|
document: InputFile,
|
||||||
thumb: InputFile? = null,
|
thumb: InputFile? = null,
|
||||||
caption: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
@@ -46,7 +47,7 @@ fun SendDocument(
|
|||||||
chatId,
|
chatId,
|
||||||
documentAsFileId,
|
documentAsFileId,
|
||||||
thumbAsFileId,
|
thumbAsFileId,
|
||||||
caption,
|
text,
|
||||||
parseMode,
|
parseMode,
|
||||||
null,
|
null,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
@@ -79,7 +80,7 @@ fun SendDocument(
|
|||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
document: InputFile,
|
document: InputFile,
|
||||||
thumb: InputFile? = null,
|
thumb: InputFile? = null,
|
||||||
entities: List<TextSource>,
|
entities: TextSourcesList,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
@@ -157,8 +158,8 @@ data class SendDocumentData internal constructor(
|
|||||||
TextableSendMessageRequest<ContentMessage<DocumentContent>>,
|
TextableSendMessageRequest<ContentMessage<DocumentContent>>,
|
||||||
ThumbedSendMessageRequest<ContentMessage<DocumentContent>>
|
ThumbedSendMessageRequest<ContentMessage<DocumentContent>>
|
||||||
{
|
{
|
||||||
override val entities: List<TextSource>? by lazy {
|
override val textSources: TextSourcesList? by lazy {
|
||||||
rawEntities ?.asTextParts(text ?: return@lazy null) ?.justTextSources()
|
rawEntities ?.asTextSources(text ?: return@lazy null)
|
||||||
}
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
|||||||
@@ -1,24 +1,25 @@
|
|||||||
package dev.inmo.tgbotapi.requests.send.media
|
package dev.inmo.tgbotapi.requests.send.media
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.*
|
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.*
|
import dev.inmo.tgbotapi.requests.abstracts.*
|
||||||
import dev.inmo.tgbotapi.requests.send.abstracts.*
|
import dev.inmo.tgbotapi.requests.send.abstracts.*
|
||||||
import dev.inmo.tgbotapi.requests.send.media.base.*
|
import dev.inmo.tgbotapi.requests.send.media.base.*
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
||||||
import dev.inmo.tgbotapi.types.message.content.media.PhotoContent
|
import dev.inmo.tgbotapi.types.message.content.media.PhotoContent
|
||||||
|
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||||
import dev.inmo.tgbotapi.utils.throwRangeError
|
import dev.inmo.tgbotapi.utils.throwRangeError
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
fun SendPhoto(
|
fun SendPhoto(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
photo: InputFile,
|
photo: InputFile,
|
||||||
caption: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
@@ -28,7 +29,7 @@ fun SendPhoto(
|
|||||||
val data = SendPhotoData(
|
val data = SendPhotoData(
|
||||||
chatId,
|
chatId,
|
||||||
(photo as? FileId) ?.fileId,
|
(photo as? FileId) ?.fileId,
|
||||||
caption,
|
text,
|
||||||
parseMode,
|
parseMode,
|
||||||
null,
|
null,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
@@ -47,7 +48,7 @@ fun SendPhoto(
|
|||||||
fun SendPhoto(
|
fun SendPhoto(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
photo: InputFile,
|
photo: InputFile,
|
||||||
entities: List<TextSource>,
|
entities: TextSourcesList,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
@@ -55,7 +56,7 @@ fun SendPhoto(
|
|||||||
): Request<ContentMessage<PhotoContent>> {
|
): Request<ContentMessage<PhotoContent>> {
|
||||||
val data = SendPhotoData(
|
val data = SendPhotoData(
|
||||||
chatId,
|
chatId,
|
||||||
(photo as? FileId) ?.fileId,
|
(photo as? FileId)?.fileId,
|
||||||
entities.makeString(),
|
entities.makeString(),
|
||||||
null,
|
null,
|
||||||
entities.toRawMessageEntities(),
|
entities.toRawMessageEntities(),
|
||||||
@@ -100,8 +101,8 @@ data class SendPhotoData internal constructor(
|
|||||||
ReplyingMarkupSendMessageRequest<ContentMessage<PhotoContent>>,
|
ReplyingMarkupSendMessageRequest<ContentMessage<PhotoContent>>,
|
||||||
TextableSendMessageRequest<ContentMessage<PhotoContent>>
|
TextableSendMessageRequest<ContentMessage<PhotoContent>>
|
||||||
{
|
{
|
||||||
override val entities: List<TextSource>? by lazy {
|
override val textSources: TextSourcesList? by lazy {
|
||||||
rawEntities ?.asTextParts(text ?: return@lazy null) ?.justTextSources()
|
rawEntities ?.asTextSources(text ?: return@lazy null)
|
||||||
}
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
|||||||
@@ -1,17 +1,18 @@
|
|||||||
package dev.inmo.tgbotapi.requests.send.media
|
package dev.inmo.tgbotapi.requests.send.media
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.*
|
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.*
|
import dev.inmo.tgbotapi.requests.abstracts.*
|
||||||
import dev.inmo.tgbotapi.requests.send.abstracts.*
|
import dev.inmo.tgbotapi.requests.send.abstracts.*
|
||||||
import dev.inmo.tgbotapi.requests.send.media.base.*
|
import dev.inmo.tgbotapi.requests.send.media.base.*
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
||||||
import dev.inmo.tgbotapi.types.message.content.media.VideoContent
|
import dev.inmo.tgbotapi.types.message.content.media.VideoContent
|
||||||
|
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||||
import dev.inmo.tgbotapi.utils.mapOfNotNull
|
import dev.inmo.tgbotapi.utils.mapOfNotNull
|
||||||
import dev.inmo.tgbotapi.utils.throwRangeError
|
import dev.inmo.tgbotapi.utils.throwRangeError
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
@@ -20,7 +21,7 @@ fun SendVideo(
|
|||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
video: InputFile,
|
video: InputFile,
|
||||||
thumb: InputFile? = null,
|
thumb: InputFile? = null,
|
||||||
caption: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
duration: Long? = null,
|
duration: Long? = null,
|
||||||
width: Int? = null,
|
width: Int? = null,
|
||||||
@@ -40,7 +41,7 @@ fun SendVideo(
|
|||||||
chatId,
|
chatId,
|
||||||
videoAsFileId,
|
videoAsFileId,
|
||||||
thumbAsFileId,
|
thumbAsFileId,
|
||||||
caption,
|
text,
|
||||||
parseMode,
|
parseMode,
|
||||||
null,
|
null,
|
||||||
duration,
|
duration,
|
||||||
@@ -67,7 +68,7 @@ fun SendVideo(
|
|||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
video: InputFile,
|
video: InputFile,
|
||||||
thumb: InputFile? = null,
|
thumb: InputFile? = null,
|
||||||
entities: List<TextSource>,
|
entities: TextSourcesList,
|
||||||
duration: Long? = null,
|
duration: Long? = null,
|
||||||
width: Int? = null,
|
width: Int? = null,
|
||||||
height: Int? = null,
|
height: Int? = null,
|
||||||
@@ -150,8 +151,8 @@ data class SendVideoData internal constructor(
|
|||||||
DuratedSendMessageRequest<ContentMessage<VideoContent>>,
|
DuratedSendMessageRequest<ContentMessage<VideoContent>>,
|
||||||
SizedSendMessageRequest<ContentMessage<VideoContent>>
|
SizedSendMessageRequest<ContentMessage<VideoContent>>
|
||||||
{
|
{
|
||||||
override val entities: List<TextSource>? by lazy {
|
override val textSources: TextSourcesList? by lazy {
|
||||||
rawEntities ?.asTextParts(text ?: return@lazy null) ?.justTextSources()
|
rawEntities ?.asTextSources(text ?: return@lazy null)
|
||||||
}
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
|||||||
@@ -1,17 +1,18 @@
|
|||||||
package dev.inmo.tgbotapi.requests.send.media
|
package dev.inmo.tgbotapi.requests.send.media
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.*
|
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.*
|
import dev.inmo.tgbotapi.requests.abstracts.*
|
||||||
import dev.inmo.tgbotapi.requests.send.abstracts.*
|
import dev.inmo.tgbotapi.requests.send.abstracts.*
|
||||||
import dev.inmo.tgbotapi.requests.send.media.base.*
|
import dev.inmo.tgbotapi.requests.send.media.base.*
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
||||||
import dev.inmo.tgbotapi.types.message.content.media.VoiceContent
|
import dev.inmo.tgbotapi.types.message.content.media.VoiceContent
|
||||||
|
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||||
import dev.inmo.tgbotapi.utils.mapOfNotNull
|
import dev.inmo.tgbotapi.utils.mapOfNotNull
|
||||||
import dev.inmo.tgbotapi.utils.throwRangeError
|
import dev.inmo.tgbotapi.utils.throwRangeError
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
@@ -19,7 +20,7 @@ import kotlinx.serialization.*
|
|||||||
fun SendVoice(
|
fun SendVoice(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
voice: InputFile,
|
voice: InputFile,
|
||||||
caption: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
duration: Long? = null,
|
duration: Long? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
@@ -33,7 +34,7 @@ fun SendVoice(
|
|||||||
val data = SendVoiceData(
|
val data = SendVoiceData(
|
||||||
chatId,
|
chatId,
|
||||||
voiceAsFileId,
|
voiceAsFileId,
|
||||||
caption,
|
text,
|
||||||
parseMode,
|
parseMode,
|
||||||
null,
|
null,
|
||||||
duration,
|
duration,
|
||||||
@@ -56,7 +57,7 @@ fun SendVoice(
|
|||||||
fun SendVoice(
|
fun SendVoice(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
voice: InputFile,
|
voice: InputFile,
|
||||||
entities: List<TextSource>,
|
entities: TextSourcesList,
|
||||||
duration: Long? = null,
|
duration: Long? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
@@ -120,8 +121,8 @@ data class SendVoiceData internal constructor(
|
|||||||
TextableSendMessageRequest<ContentMessage<VoiceContent>>,
|
TextableSendMessageRequest<ContentMessage<VoiceContent>>,
|
||||||
DuratedSendMessageRequest<ContentMessage<VoiceContent>>
|
DuratedSendMessageRequest<ContentMessage<VoiceContent>>
|
||||||
{
|
{
|
||||||
override val entities: List<TextSource>? by lazy {
|
override val textSources: TextSourcesList? by lazy {
|
||||||
rawEntities ?.asTextParts(text ?: return@lazy null) ?.justTextSources()
|
rawEntities ?.asTextSources(text ?: return@lazy null)
|
||||||
}
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package dev.inmo.tgbotapi.requests.send.payments
|
package dev.inmo.tgbotapi.requests.send.payments
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.CommonAbstracts.CommonSendInvoiceData
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.types.*
|
import dev.inmo.tgbotapi.CommonAbstracts.types.*
|
||||||
import dev.inmo.tgbotapi.requests.send.abstracts.SendMessageRequest
|
import dev.inmo.tgbotapi.requests.send.abstracts.SendMessageRequest
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
@@ -9,7 +10,7 @@ import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializ
|
|||||||
import dev.inmo.tgbotapi.types.message.payments.InvoiceContent
|
import dev.inmo.tgbotapi.types.message.payments.InvoiceContent
|
||||||
import dev.inmo.tgbotapi.types.payments.LabeledPrice
|
import dev.inmo.tgbotapi.types.payments.LabeledPrice
|
||||||
import dev.inmo.tgbotapi.types.payments.LabeledPricesSerializer
|
import dev.inmo.tgbotapi.types.payments.LabeledPricesSerializer
|
||||||
import dev.inmo.tgbotapi.types.payments.abstracts.*
|
import dev.inmo.tgbotapi.types.payments.abstracts.Currency
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
private val invoiceMessageSerializer: DeserializationStrategy<ContentMessage<InvoiceContent>>
|
private val invoiceMessageSerializer: DeserializationStrategy<ContentMessage<InvoiceContent>>
|
||||||
@@ -23,36 +24,40 @@ data class SendInvoice(
|
|||||||
@SerialName(chatIdField)
|
@SerialName(chatIdField)
|
||||||
override val chatId: ChatId,
|
override val chatId: ChatId,
|
||||||
@SerialName(titleField)
|
@SerialName(titleField)
|
||||||
val title: String,
|
override val title: String,
|
||||||
@SerialName(descriptionField)
|
@SerialName(descriptionField)
|
||||||
val description: String,
|
override val description: String,
|
||||||
@SerialName(payloadField)
|
@SerialName(payloadField)
|
||||||
val payload: String,
|
override val payload: String,
|
||||||
@SerialName(providerTokenField)
|
@SerialName(providerTokenField)
|
||||||
val providerToken: String,
|
override val providerToken: String,
|
||||||
@SerialName(startParameterField)
|
|
||||||
val startParameter: StartParameter,
|
|
||||||
@SerialName(currencyField)
|
@SerialName(currencyField)
|
||||||
override val currency: Currency,
|
override val currency: Currency,
|
||||||
@Serializable(LabeledPricesSerializer::class)
|
@Serializable(LabeledPricesSerializer::class)
|
||||||
@SerialName(pricesField)
|
@SerialName(pricesField)
|
||||||
override val prices: List<LabeledPrice>,
|
override val prices: List<LabeledPrice>,
|
||||||
|
@SerialName(maxTipAmountField)
|
||||||
|
override val maxTipAmount: Int? = null,
|
||||||
|
@SerialName(suggestedTipAmountsField)
|
||||||
|
override val suggestedTipAmounts: List<Int>? = null,
|
||||||
|
@SerialName(startParameterField)
|
||||||
|
val startParameter: StartParameter? = null,
|
||||||
@SerialName(providerDataField)
|
@SerialName(providerDataField)
|
||||||
val providerData: String? = null,
|
override val providerData: String? = null,
|
||||||
@SerialName(requireNameField)
|
@SerialName(requireNameField)
|
||||||
val requireName: Boolean = false,
|
override val requireName: Boolean = false,
|
||||||
@SerialName(requirePhoneNumberField)
|
@SerialName(requirePhoneNumberField)
|
||||||
val requirePhoneNumber: Boolean = false,
|
override val requirePhoneNumber: Boolean = false,
|
||||||
@SerialName(requireEmailField)
|
@SerialName(requireEmailField)
|
||||||
val requireEmail: Boolean = false,
|
override val requireEmail: Boolean = false,
|
||||||
@SerialName(requireShippingAddressField)
|
@SerialName(requireShippingAddressField)
|
||||||
val requireShippingAddress: Boolean = false,
|
override val requireShippingAddress: Boolean = false,
|
||||||
@SerialName(shouldSendPhoneNumberToProviderField)
|
@SerialName(shouldSendPhoneNumberToProviderField)
|
||||||
val shouldSendPhoneNumberToProvider: Boolean = false,
|
override val shouldSendPhoneNumberToProvider: Boolean = false,
|
||||||
@SerialName(shouldSendEmailToProviderField)
|
@SerialName(shouldSendEmailToProviderField)
|
||||||
val shouldSendEmailToProvider: Boolean = false,
|
override val shouldSendEmailToProvider: Boolean = false,
|
||||||
@SerialName(priceDependOnShipAddressField)
|
@SerialName(priceDependOnShipAddressField)
|
||||||
val priceDependOnShipAddress: Boolean = false,
|
override val priceDependOnShipAddress: Boolean = false,
|
||||||
@SerialName(disableNotificationField)
|
@SerialName(disableNotificationField)
|
||||||
override val disableNotification: Boolean = false,
|
override val disableNotification: Boolean = false,
|
||||||
@SerialName(replyToMessageIdField)
|
@SerialName(replyToMessageIdField)
|
||||||
@@ -61,8 +66,7 @@ data class SendInvoice(
|
|||||||
override val allowSendingWithoutReply: Boolean? = null,
|
override val allowSendingWithoutReply: Boolean? = null,
|
||||||
@SerialName(replyMarkupField)
|
@SerialName(replyMarkupField)
|
||||||
override val replyMarkup: InlineKeyboardMarkup? = null
|
override val replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) : Currencied,
|
) : CommonSendInvoiceData,
|
||||||
Priced,
|
|
||||||
ChatRequest,
|
ChatRequest,
|
||||||
DisableNotification,
|
DisableNotification,
|
||||||
ReplyMessageId,
|
ReplyMessageId,
|
||||||
@@ -75,24 +79,35 @@ data class SendInvoice(
|
|||||||
get() = serializer()
|
get() = serializer()
|
||||||
|
|
||||||
@SerialName(photoUrlField)
|
@SerialName(photoUrlField)
|
||||||
var photoUrl: String? = null
|
override var photoUrl: String? = null
|
||||||
private set
|
private set
|
||||||
@SerialName(photoSizeField)
|
@SerialName(photoSizeField)
|
||||||
var photoSize: Long? = null
|
override var photoSize: Long? = null
|
||||||
private set
|
private set
|
||||||
|
|
||||||
@SerialName(photoWidthField)
|
@SerialName(photoWidthField)
|
||||||
var photoWidth: Int? = null
|
override var photoWidth: Int? = null
|
||||||
private set
|
private set
|
||||||
@SerialName(photoHeightField)
|
@SerialName(photoHeightField)
|
||||||
var photoHeight: Int? = null
|
override var photoHeight: Int? = null
|
||||||
private set
|
private set
|
||||||
|
|
||||||
fun setPhoto(
|
init {
|
||||||
|
suggestedTipAmounts ?.let { _ ->
|
||||||
|
require(suggestedTipAmounts.size in suggestedTipAmountsLimit)
|
||||||
|
maxTipAmount ?.let { _ ->
|
||||||
|
require(
|
||||||
|
suggestedTipAmounts.none { it > maxTipAmount }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun setPhoto(
|
||||||
photoUrl: String,
|
photoUrl: String,
|
||||||
photoSize: Long? = null,
|
photoSize: Long?,
|
||||||
photoWidth: Int? = null,
|
photoWidth: Int?,
|
||||||
photoHeight: Int? = null
|
photoHeight: Int?
|
||||||
) {
|
) {
|
||||||
this.photoUrl = photoUrl
|
this.photoUrl = photoUrl
|
||||||
this.photoSize = photoSize
|
this.photoSize = photoSize
|
||||||
@@ -100,7 +115,7 @@ data class SendInvoice(
|
|||||||
this.photoHeight = photoHeight
|
this.photoHeight = photoHeight
|
||||||
}
|
}
|
||||||
|
|
||||||
fun unsetPhoto() {
|
override fun unsetPhoto() {
|
||||||
photoUrl = null
|
photoUrl = null
|
||||||
photoSize = null
|
photoSize = null
|
||||||
photoWidth = null
|
photoWidth = null
|
||||||
|
|||||||
@@ -1,17 +1,19 @@
|
|||||||
package dev.inmo.tgbotapi.requests.send.polls
|
package dev.inmo.tgbotapi.requests.send.polls
|
||||||
|
|
||||||
import com.soywiz.klock.DateTime
|
import com.soywiz.klock.DateTime
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.*
|
import dev.inmo.tgbotapi.CommonAbstracts.TextedOutput
|
||||||
import dev.inmo.tgbotapi.requests.send.abstracts.ReplyingMarkupSendMessageRequest
|
import dev.inmo.tgbotapi.requests.send.abstracts.ReplyingMarkupSendMessageRequest
|
||||||
import dev.inmo.tgbotapi.requests.send.abstracts.SendMessageRequest
|
import dev.inmo.tgbotapi.requests.send.abstracts.SendMessageRequest
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
||||||
import dev.inmo.tgbotapi.types.message.content.PollContent
|
import dev.inmo.tgbotapi.types.message.content.PollContent
|
||||||
import dev.inmo.tgbotapi.types.polls.*
|
import dev.inmo.tgbotapi.types.polls.*
|
||||||
|
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
private val commonResultDeserializer: DeserializationStrategy<ContentMessage<PollContent>> = TelegramBotAPIMessageDeserializationStrategyClass()
|
private val commonResultDeserializer: DeserializationStrategy<ContentMessage<PollContent>> = TelegramBotAPIMessageDeserializationStrategyClass()
|
||||||
@@ -338,7 +340,7 @@ data class SendQuizPoll internal constructor(
|
|||||||
@SerialName(isClosedField)
|
@SerialName(isClosedField)
|
||||||
override val isClosed: Boolean = false,
|
override val isClosed: Boolean = false,
|
||||||
@SerialName(explanationField)
|
@SerialName(explanationField)
|
||||||
override val explanation: String? = null,
|
override val text: String? = null,
|
||||||
@SerialName(explanationParseModeField)
|
@SerialName(explanationParseModeField)
|
||||||
override val parseMode: ParseMode? = null,
|
override val parseMode: ParseMode? = null,
|
||||||
@SerialName(explanationEntitiesField)
|
@SerialName(explanationEntitiesField)
|
||||||
@@ -355,12 +357,12 @@ data class SendQuizPoll internal constructor(
|
|||||||
override val allowSendingWithoutReply: Boolean? = null,
|
override val allowSendingWithoutReply: Boolean? = null,
|
||||||
@SerialName(replyMarkupField)
|
@SerialName(replyMarkupField)
|
||||||
override val replyMarkup: KeyboardMarkup? = null
|
override val replyMarkup: KeyboardMarkup? = null
|
||||||
) : SendPoll(), ExplainedOutput {
|
) : SendPoll(), TextedOutput {
|
||||||
override val type: String = quizPollType
|
override val type: String = quizPollType
|
||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
override val entities: List<TextSource>? by lazy {
|
override val textSources: List<TextSource>? by lazy {
|
||||||
rawEntities ?.asTextParts(explanation ?: return@lazy null) ?.justTextSources()
|
rawEntities ?.asTextSources(text ?: return@lazy null)
|
||||||
}
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
@@ -371,9 +373,9 @@ data class SendQuizPoll internal constructor(
|
|||||||
throw IllegalArgumentException("Correct option id must be in range of $correctOptionIdRange, but actual " +
|
throw IllegalArgumentException("Correct option id must be in range of $correctOptionIdRange, but actual " +
|
||||||
"value is $correctOptionId")
|
"value is $correctOptionId")
|
||||||
}
|
}
|
||||||
if (explanation != null && explanation.length !in explanationLimit) {
|
if (text != null && text.length !in explanationLimit) {
|
||||||
error("Quiz poll explanation size must be in range $explanationLimit," +
|
error("Quiz poll explanation size must be in range $explanationLimit," +
|
||||||
"but actual explanation contains ${explanation.length} symbols")
|
"but actual explanation contains ${text.length} symbols")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
interface CallbackQuery {
|
sealed interface CallbackQuery : FromUser {
|
||||||
val id: CallbackQueryIdentifier
|
val id: CallbackQueryIdentifier
|
||||||
val user: User
|
|
||||||
val chatInstance: String
|
val chatInstance: String
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
package dev.inmo.tgbotapi.types.CallbackQuery
|
package dev.inmo.tgbotapi.types.CallbackQuery
|
||||||
|
|
||||||
interface DataCallbackQuery : CallbackQuery {
|
sealed interface DataCallbackQuery : CallbackQuery {
|
||||||
val data: String
|
val data: String
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
package dev.inmo.tgbotapi.types.CallbackQuery
|
package dev.inmo.tgbotapi.types.CallbackQuery
|
||||||
|
|
||||||
interface GameShortNameCallbackQuery : CallbackQuery {
|
sealed interface GameShortNameCallbackQuery : CallbackQuery {
|
||||||
val gameShortName: String
|
val gameShortName: String
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,6 @@ package dev.inmo.tgbotapi.types.CallbackQuery
|
|||||||
|
|
||||||
import dev.inmo.tgbotapi.types.InlineMessageIdentifier
|
import dev.inmo.tgbotapi.types.InlineMessageIdentifier
|
||||||
|
|
||||||
interface InlineMessageIdCallbackQuery : CallbackQuery {
|
sealed interface InlineMessageIdCallbackQuery : CallbackQuery {
|
||||||
val inlineMessageId: InlineMessageIdentifier
|
val inlineMessageId: InlineMessageIdentifier
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,6 @@ package dev.inmo.tgbotapi.types.CallbackQuery
|
|||||||
|
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||||
|
|
||||||
interface MessageCallbackQuery : CallbackQuery {
|
sealed interface MessageCallbackQuery : CallbackQuery {
|
||||||
val message: Message
|
val message: Message
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
package dev.inmo.tgbotapi.types
|
package dev.inmo.tgbotapi.types
|
||||||
|
|
||||||
import dev.inmo.micro_utils.common.Warning
|
import dev.inmo.micro_utils.common.Warning
|
||||||
import kotlinx.serialization.*
|
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||||
|
import kotlinx.serialization.KSerializer
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
import kotlinx.serialization.descriptors.SerialDescriptor
|
||||||
import kotlinx.serialization.encoding.Decoder
|
import kotlinx.serialization.encoding.Decoder
|
||||||
import kotlinx.serialization.encoding.Encoder
|
import kotlinx.serialization.encoding.Encoder
|
||||||
import kotlinx.serialization.json.JsonPrimitive
|
import kotlinx.serialization.json.JsonPrimitive
|
||||||
@@ -52,10 +55,12 @@ data class Username(
|
|||||||
|
|
||||||
fun String.toUsername(): Username = Username(this)
|
fun String.toUsername(): Username = Username(this)
|
||||||
|
|
||||||
@Serializer(ChatIdentifier::class)
|
@RiskFeature
|
||||||
internal object ChatIdentifierSerializer : KSerializer<ChatIdentifier> {
|
object ChatIdentifierSerializer : KSerializer<ChatIdentifier> {
|
||||||
|
private val internalSerializer = JsonPrimitive.serializer()
|
||||||
|
override val descriptor: SerialDescriptor = internalSerializer.descriptor
|
||||||
override fun deserialize(decoder: Decoder): ChatIdentifier {
|
override fun deserialize(decoder: Decoder): ChatIdentifier {
|
||||||
val id = JsonPrimitive.serializer().deserialize(decoder)
|
val id = internalSerializer.deserialize(decoder)
|
||||||
return id.longOrNull ?.let {
|
return id.longOrNull ?.let {
|
||||||
ChatId(it)
|
ChatId(it)
|
||||||
} ?: id.content.let {
|
} ?: id.content.let {
|
||||||
@@ -73,4 +78,4 @@ internal object ChatIdentifierSerializer : KSerializer<ChatIdentifier> {
|
|||||||
is Username -> encoder.encodeString(value.username)
|
is Username -> encoder.encodeString(value.username)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package dev.inmo.tgbotapi.types
|
package dev.inmo.tgbotapi.types
|
||||||
|
|
||||||
import com.soywiz.klock.DateTime
|
import com.soywiz.klock.DateTime
|
||||||
|
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
import kotlinx.serialization.descriptors.SerialDescriptor
|
import kotlinx.serialization.descriptors.SerialDescriptor
|
||||||
import kotlinx.serialization.encoding.Decoder
|
import kotlinx.serialization.encoding.Decoder
|
||||||
@@ -79,7 +80,7 @@ data class CommonInviteLink(
|
|||||||
get() = expireDate ?.asDate
|
get() = expireDate ?.asDate
|
||||||
}
|
}
|
||||||
|
|
||||||
@Serializer(ChatInviteLink::class)
|
@RiskFeature
|
||||||
object ChatInviteLinkSerializer : KSerializer<ChatInviteLink> {
|
object ChatInviteLinkSerializer : KSerializer<ChatInviteLink> {
|
||||||
override val descriptor: SerialDescriptor
|
override val descriptor: SerialDescriptor
|
||||||
get() = RawChatInviteLink.serializer().descriptor
|
get() = RawChatInviteLink.serializer().descriptor
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
package dev.inmo.tgbotapi.types.ChatMember
|
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.types.*
|
|
||||||
import dev.inmo.tgbotapi.types.ChatMember.abstracts.ChatMember
|
|
||||||
import kotlinx.serialization.*
|
|
||||||
|
|
||||||
@Serializable
|
|
||||||
data class LeftChatMember(@SerialName(userField) override val user: User) : ChatMember {
|
|
||||||
@SerialName(statusField)
|
|
||||||
@Required
|
|
||||||
private val type: String = "left"
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package dev.inmo.tgbotapi.types.ChatMember
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import dev.inmo.tgbotapi.types.ChatMember.abstracts.LeftChatMember
|
||||||
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class LeftChatMemberImpl(@SerialName(userField) override val user: User) : LeftChatMember {
|
||||||
|
@SerialName(statusField)
|
||||||
|
@Required
|
||||||
|
private val type: String = "left"
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated("Renamed", ReplaceWith("LeftChatMemberImpl", "dev.inmo.tgbotapi.types.ChatMember.LeftChatMemberImpl"))
|
||||||
|
typealias LeftChatMember = LeftChatMemberImpl
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
package dev.inmo.tgbotapi.types.ChatMember
|
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.types.*
|
|
||||||
import dev.inmo.tgbotapi.types.ChatMember.abstracts.ChatMember
|
|
||||||
import kotlinx.serialization.*
|
|
||||||
|
|
||||||
@Serializable
|
|
||||||
data class MemberChatMember(@SerialName(userField) override val user: User) : ChatMember {
|
|
||||||
@SerialName(statusField)
|
|
||||||
@Required
|
|
||||||
private val type: String = "member"
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package dev.inmo.tgbotapi.types.ChatMember
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import dev.inmo.tgbotapi.types.ChatMember.abstracts.MemberChatMember
|
||||||
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class MemberChatMemberImpl(@SerialName(userField) override val user: User) : MemberChatMember {
|
||||||
|
@SerialName(statusField)
|
||||||
|
@Required
|
||||||
|
private val type: String = "member"
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated("Renamed", ReplaceWith("MemberChatMember", "dev.inmo.tgbotapi.types.ChatMember.MemberChatMemberImpl"))
|
||||||
|
typealias MemberChatMember = MemberChatMemberImpl
|
||||||
@@ -1,7 +1,8 @@
|
|||||||
package dev.inmo.tgbotapi.types.ChatMember.abstracts
|
package dev.inmo.tgbotapi.types.ChatMember.abstracts
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.KSerializer
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
import kotlinx.serialization.descriptors.SerialDescriptor
|
import kotlinx.serialization.descriptors.SerialDescriptor
|
||||||
import kotlinx.serialization.encoding.Decoder
|
import kotlinx.serialization.encoding.Decoder
|
||||||
import kotlinx.serialization.encoding.Encoder
|
import kotlinx.serialization.encoding.Encoder
|
||||||
@@ -20,7 +21,6 @@ interface AdministratorChatMember : SpecialRightsChatMember {
|
|||||||
val customTitle: String?
|
val customTitle: String?
|
||||||
}
|
}
|
||||||
|
|
||||||
@Serializer(AdministratorChatMember::class)
|
|
||||||
@RiskFeature
|
@RiskFeature
|
||||||
object AdministratorChatMemberSerializer : KSerializer<AdministratorChatMember> {
|
object AdministratorChatMemberSerializer : KSerializer<AdministratorChatMember> {
|
||||||
override val descriptor: SerialDescriptor = ChatMemberSerializer.descriptor
|
override val descriptor: SerialDescriptor = ChatMemberSerializer.descriptor
|
||||||
|
|||||||
@@ -5,7 +5,8 @@ import dev.inmo.tgbotapi.types.User
|
|||||||
import dev.inmo.tgbotapi.types.statusField
|
import dev.inmo.tgbotapi.types.statusField
|
||||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||||
import dev.inmo.tgbotapi.utils.nonstrictJsonFormat
|
import dev.inmo.tgbotapi.utils.nonstrictJsonFormat
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.KSerializer
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
import kotlinx.serialization.descriptors.SerialDescriptor
|
import kotlinx.serialization.descriptors.SerialDescriptor
|
||||||
import kotlinx.serialization.encoding.Decoder
|
import kotlinx.serialization.encoding.Decoder
|
||||||
import kotlinx.serialization.encoding.Encoder
|
import kotlinx.serialization.encoding.Encoder
|
||||||
@@ -13,11 +14,10 @@ import kotlinx.serialization.json.JsonObject
|
|||||||
import kotlinx.serialization.json.jsonPrimitive
|
import kotlinx.serialization.json.jsonPrimitive
|
||||||
|
|
||||||
@Serializable(ChatMemberSerializer::class)
|
@Serializable(ChatMemberSerializer::class)
|
||||||
interface ChatMember {
|
sealed interface ChatMember {
|
||||||
val user: User
|
val user: User
|
||||||
}
|
}
|
||||||
|
|
||||||
@Serializer(ChatMember::class)
|
|
||||||
@RiskFeature
|
@RiskFeature
|
||||||
object ChatMemberSerializer : KSerializer<ChatMember> {
|
object ChatMemberSerializer : KSerializer<ChatMember> {
|
||||||
override val descriptor: SerialDescriptor = JsonObject.serializer().descriptor
|
override val descriptor: SerialDescriptor = JsonObject.serializer().descriptor
|
||||||
@@ -27,9 +27,9 @@ object ChatMemberSerializer : KSerializer<ChatMember> {
|
|||||||
return when (json[statusField] ?.jsonPrimitive ?.content ?: error("Status field of chat member must be specified, but incoming json contains next: $json")) {
|
return when (json[statusField] ?.jsonPrimitive ?.content ?: error("Status field of chat member must be specified, but incoming json contains next: $json")) {
|
||||||
"creator" -> nonstrictJsonFormat.decodeFromJsonElement(CreatorChatMember.serializer(), json)
|
"creator" -> nonstrictJsonFormat.decodeFromJsonElement(CreatorChatMember.serializer(), json)
|
||||||
"administrator" -> nonstrictJsonFormat.decodeFromJsonElement(AdministratorChatMemberImpl.serializer(), json)
|
"administrator" -> nonstrictJsonFormat.decodeFromJsonElement(AdministratorChatMemberImpl.serializer(), json)
|
||||||
"member" -> nonstrictJsonFormat.decodeFromJsonElement(MemberChatMember.serializer(), json)
|
"member" -> nonstrictJsonFormat.decodeFromJsonElement(MemberChatMemberImpl.serializer(), json)
|
||||||
"restricted" -> nonstrictJsonFormat.decodeFromJsonElement(RestrictedChatMember.serializer(), json)
|
"restricted" -> nonstrictJsonFormat.decodeFromJsonElement(RestrictedChatMember.serializer(), json)
|
||||||
"left" -> nonstrictJsonFormat.decodeFromJsonElement(LeftChatMember.serializer(), json)
|
"left" -> nonstrictJsonFormat.decodeFromJsonElement(LeftChatMemberImpl.serializer(), json)
|
||||||
"kicked" -> nonstrictJsonFormat.decodeFromJsonElement(KickedChatMember.serializer(), json)
|
"kicked" -> nonstrictJsonFormat.decodeFromJsonElement(KickedChatMember.serializer(), json)
|
||||||
else -> error("Unknown type of chat member in json: $json")
|
else -> error("Unknown type of chat member in json: $json")
|
||||||
}
|
}
|
||||||
@@ -39,9 +39,9 @@ object ChatMemberSerializer : KSerializer<ChatMember> {
|
|||||||
when (value) {
|
when (value) {
|
||||||
is CreatorChatMember -> CreatorChatMember.serializer()
|
is CreatorChatMember -> CreatorChatMember.serializer()
|
||||||
is AdministratorChatMemberImpl -> AdministratorChatMemberImpl.serializer()
|
is AdministratorChatMemberImpl -> AdministratorChatMemberImpl.serializer()
|
||||||
is MemberChatMember -> MemberChatMember.serializer()
|
is MemberChatMember -> MemberChatMemberImpl.serializer()
|
||||||
is RestrictedChatMember -> RestrictedChatMember.serializer()
|
is RestrictedChatMember -> RestrictedChatMember.serializer()
|
||||||
is LeftChatMember -> LeftChatMember.serializer()
|
is LeftChatMember -> LeftChatMemberImpl.serializer()
|
||||||
is KickedChatMember -> KickedChatMember.serializer()
|
is KickedChatMember -> KickedChatMember.serializer()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
package dev.inmo.tgbotapi.types.ChatMember.abstracts
|
||||||
|
|
||||||
|
interface LeftChatMember : ChatMember
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
package dev.inmo.tgbotapi.types.ChatMember.abstracts
|
||||||
|
|
||||||
|
interface MemberChatMember : ChatMember
|
||||||
@@ -80,6 +80,12 @@ val openPeriodPollSecondsLimit = 5 .. 600
|
|||||||
|
|
||||||
val membersLimit = 1 .. 99999
|
val membersLimit = 1 .. 99999
|
||||||
|
|
||||||
|
val suggestedTipAmountsLimit = 1 .. 4
|
||||||
|
|
||||||
|
val inputFieldPlaceholderLimit = 1 .. 64
|
||||||
|
|
||||||
|
const val botActionActualityTime: Seconds = 5
|
||||||
|
|
||||||
// Made as lazy for correct work in K/JS
|
// Made as lazy for correct work in K/JS
|
||||||
val telegramInlineModeGifPermittedMimeTypes by lazy {
|
val telegramInlineModeGifPermittedMimeTypes by lazy {
|
||||||
listOf(
|
listOf(
|
||||||
@@ -230,6 +236,7 @@ const val hideUrlField = "hide_url"
|
|||||||
|
|
||||||
const val botCommandField = "command"
|
const val botCommandField = "command"
|
||||||
const val botCommandsField = "commands"
|
const val botCommandsField = "commands"
|
||||||
|
const val scopeField = "scope"
|
||||||
|
|
||||||
const val isMemberField = "is_member"
|
const val isMemberField = "is_member"
|
||||||
const val canSendMessagesField = "can_send_messages"
|
const val canSendMessagesField = "can_send_messages"
|
||||||
@@ -313,6 +320,10 @@ const val xShiftField = "x_shift"
|
|||||||
const val yShiftField = "y_shift"
|
const val yShiftField = "y_shift"
|
||||||
const val scaleField = "scale"
|
const val scaleField = "scale"
|
||||||
|
|
||||||
|
const val maxTipAmountField = "max_tip_amount"
|
||||||
|
const val suggestedTipAmountsField = "suggested_tip_amounts"
|
||||||
|
const val chatTypeField = "chat_type"
|
||||||
|
|
||||||
const val explanationEntitiesField = "explanation_entities"
|
const val explanationEntitiesField = "explanation_entities"
|
||||||
const val explanationParseModeField = "explanation_parse_mode"
|
const val explanationParseModeField = "explanation_parse_mode"
|
||||||
const val openPeriodField = "open_period"
|
const val openPeriodField = "open_period"
|
||||||
@@ -347,6 +358,7 @@ const val providerPaymentChargeIdField = "provider_payment_charge_id"
|
|||||||
const val providerTokenField = "provider_token"
|
const val providerTokenField = "provider_token"
|
||||||
const val providerDataField = "provider_data"
|
const val providerDataField = "provider_data"
|
||||||
const val usersField = "users"
|
const val usersField = "users"
|
||||||
|
const val startDateField = "start_date"
|
||||||
|
|
||||||
const val requireNameField = "need_name"
|
const val requireNameField = "need_name"
|
||||||
const val requirePhoneNumberField = "need_phone_number"
|
const val requirePhoneNumberField = "need_phone_number"
|
||||||
@@ -356,6 +368,8 @@ const val requireShippingAddressField = "need_shipping_address"
|
|||||||
const val shouldSendPhoneNumberToProviderField = "send_phone_number_to_provider"
|
const val shouldSendPhoneNumberToProviderField = "send_phone_number_to_provider"
|
||||||
const val shouldSendEmailToProviderField = "send_email_to_provider"
|
const val shouldSendEmailToProviderField = "send_email_to_provider"
|
||||||
|
|
||||||
|
const val inputFieldPlaceholderField = "input_field_placeholder"
|
||||||
|
|
||||||
const val priceDependOnShipAddressField = "is_flexible"
|
const val priceDependOnShipAddressField = "is_flexible"
|
||||||
|
|
||||||
const val documentField = "document"
|
const val documentField = "document"
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
package dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult
|
package dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.ChosenInlineResult
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class BaseChosenInlineResult(
|
data class BaseChosenInlineResult(
|
||||||
override val resultId: InlineQueryIdentifier,
|
override val resultId: InlineQueryIdentifier,
|
||||||
|
@SerialName(fromField)
|
||||||
override val user: User,
|
override val user: User,
|
||||||
override val inlineMessageId: InlineMessageIdentifier?,
|
override val inlineMessageId: InlineMessageIdentifier?,
|
||||||
override val query: String
|
override val query: String
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.CommonAbstracts.FromUser
|
||||||
|
import dev.inmo.tgbotapi.types.InlineMessageIdentifier
|
||||||
|
import dev.inmo.tgbotapi.types.InlineQueryIdentifier
|
||||||
|
|
||||||
|
sealed interface ChosenInlineResult : FromUser {
|
||||||
|
val resultId: InlineQueryIdentifier //chosen temporary, can be changed
|
||||||
|
val inlineMessageId: InlineMessageIdentifier?
|
||||||
|
val query: String
|
||||||
|
}
|
||||||
@@ -1,11 +1,14 @@
|
|||||||
package dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult
|
package dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.ChosenInlineResult
|
|
||||||
import dev.inmo.tgbotapi.types.location.StaticLocation
|
import dev.inmo.tgbotapi.types.location.StaticLocation
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class LocationChosenInlineResult(
|
data class LocationChosenInlineResult(
|
||||||
override val resultId: InlineQueryIdentifier,
|
override val resultId: InlineQueryIdentifier,
|
||||||
|
@SerialName(fromField)
|
||||||
override val user: User,
|
override val user: User,
|
||||||
val location: StaticLocation,
|
val location: StaticLocation,
|
||||||
override val inlineMessageId: InlineMessageIdentifier?,
|
override val inlineMessageId: InlineMessageIdentifier?,
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult
|
package dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.ChosenInlineResult
|
|
||||||
import dev.inmo.tgbotapi.types.location.StaticLocation
|
import dev.inmo.tgbotapi.types.location.StaticLocation
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
|
|||||||
|
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.*
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.*
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent
|
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent
|
||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
@@ -36,4 +36,4 @@ class InlineQueryResultArticle(
|
|||||||
WithInputMessageContentInlineQueryResult,
|
WithInputMessageContentInlineQueryResult,
|
||||||
UrlInlineQueryResult {
|
UrlInlineQueryResult {
|
||||||
override val type: String = "article"
|
override val type: String = "article"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
|
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.*
|
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.audio.InlineQueryResultAudioCached
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.audio.InlineQueryResultAudioCached
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.audio.inlineQueryResultAudioType
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.audio.inlineQueryResultAudioType
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent
|
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent
|
||||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
|
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
@@ -25,10 +26,18 @@ fun InlineQueryResultAudioCachedImpl(
|
|||||||
fun InlineQueryResultAudioCachedImpl(
|
fun InlineQueryResultAudioCachedImpl(
|
||||||
id: InlineQueryIdentifier,
|
id: InlineQueryIdentifier,
|
||||||
fileId: FileId,
|
fileId: FileId,
|
||||||
entities: List<TextSource>,
|
entities: TextSourcesList,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null,
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
inputMessageContent: InputMessageContent? = null
|
inputMessageContent: InputMessageContent? = null
|
||||||
) = InlineQueryResultAudioCachedImpl(id, fileId, entities.makeString(), null, entities.toRawMessageEntities(), replyMarkup, inputMessageContent)
|
) = InlineQueryResultAudioCachedImpl(
|
||||||
|
id,
|
||||||
|
fileId,
|
||||||
|
entities.makeString(),
|
||||||
|
null,
|
||||||
|
entities.toRawMessageEntities(),
|
||||||
|
replyMarkup,
|
||||||
|
inputMessageContent
|
||||||
|
)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class InlineQueryResultAudioCachedImpl internal constructor(
|
data class InlineQueryResultAudioCachedImpl internal constructor(
|
||||||
@@ -48,7 +57,7 @@ data class InlineQueryResultAudioCachedImpl internal constructor(
|
|||||||
override val inputMessageContent: InputMessageContent? = null
|
override val inputMessageContent: InputMessageContent? = null
|
||||||
) : InlineQueryResultAudioCached {
|
) : InlineQueryResultAudioCached {
|
||||||
override val type: String = inlineQueryResultAudioType
|
override val type: String = inlineQueryResultAudioType
|
||||||
override val entities: List<TextSource>? by lazy {
|
override val textSources: TextSourcesList? by lazy {
|
||||||
rawEntities ?.asTextParts(text ?: return@lazy null) ?.justTextSources()
|
rawEntities ?.asTextSources(text ?: return@lazy null)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,15 @@
|
|||||||
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
|
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.*
|
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.audio.InlineQueryResultAudio
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.audio.InlineQueryResultAudio
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.audio.inlineQueryResultAudioType
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.audio.inlineQueryResultAudioType
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent
|
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent
|
||||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
|
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
@@ -30,10 +31,21 @@ fun InlineQueryResultAudioImpl(
|
|||||||
title: String,
|
title: String,
|
||||||
performer: String? = null,
|
performer: String? = null,
|
||||||
duration: Int? = null,
|
duration: Int? = null,
|
||||||
entities: List<TextSource>,
|
entities: TextSourcesList,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null,
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
inputMessageContent: InputMessageContent? = null
|
inputMessageContent: InputMessageContent? = null
|
||||||
) = InlineQueryResultAudioImpl(id, url, title, performer, duration, entities.makeString(), null, entities.toRawMessageEntities(), replyMarkup, inputMessageContent)
|
) = InlineQueryResultAudioImpl(
|
||||||
|
id,
|
||||||
|
url,
|
||||||
|
title,
|
||||||
|
performer,
|
||||||
|
duration,
|
||||||
|
entities.makeString(),
|
||||||
|
null,
|
||||||
|
entities.toRawMessageEntities(),
|
||||||
|
replyMarkup,
|
||||||
|
inputMessageContent
|
||||||
|
)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class InlineQueryResultAudioImpl internal constructor(
|
data class InlineQueryResultAudioImpl internal constructor(
|
||||||
@@ -59,7 +71,7 @@ data class InlineQueryResultAudioImpl internal constructor(
|
|||||||
override val inputMessageContent: InputMessageContent? = null
|
override val inputMessageContent: InputMessageContent? = null
|
||||||
) : InlineQueryResultAudio {
|
) : InlineQueryResultAudio {
|
||||||
override val type: String = inlineQueryResultAudioType
|
override val type: String = inlineQueryResultAudioType
|
||||||
override val entities: List<TextSource>? by lazy {
|
override val textSources: TextSourcesList? by lazy {
|
||||||
rawEntities ?.asTextParts(text ?: return@lazy null) ?.justTextSources()
|
rawEntities ?.asTextSources(text ?: return@lazy null)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
|
|||||||
import dev.inmo.tgbotapi.CommonAbstracts.CommonContactData
|
import dev.inmo.tgbotapi.CommonAbstracts.CommonContactData
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.*
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.*
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent
|
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent
|
||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
|
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.*
|
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.document.InlineQueryResultDocumentCached
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.document.InlineQueryResultDocumentCached
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.document.inlineQueryResultDocumentType
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.document.inlineQueryResultDocumentType
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent
|
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent
|
||||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
|
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
@@ -29,10 +30,20 @@ fun InlineQueryResultDocumentCachedImpl(
|
|||||||
fileId: FileId,
|
fileId: FileId,
|
||||||
title: String,
|
title: String,
|
||||||
description: String? = null,
|
description: String? = null,
|
||||||
entities: List<TextSource>,
|
entities: TextSourcesList,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null,
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
inputMessageContent: InputMessageContent? = null
|
inputMessageContent: InputMessageContent? = null
|
||||||
) = InlineQueryResultDocumentCachedImpl(id, fileId, title, description, entities.makeString(), null, entities.toRawMessageEntities(), replyMarkup, inputMessageContent)
|
) = InlineQueryResultDocumentCachedImpl(
|
||||||
|
id,
|
||||||
|
fileId,
|
||||||
|
title,
|
||||||
|
description,
|
||||||
|
entities.makeString(),
|
||||||
|
null,
|
||||||
|
entities.toRawMessageEntities(),
|
||||||
|
replyMarkup,
|
||||||
|
inputMessageContent
|
||||||
|
)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class InlineQueryResultDocumentCachedImpl internal constructor(
|
data class InlineQueryResultDocumentCachedImpl internal constructor(
|
||||||
@@ -56,7 +67,7 @@ data class InlineQueryResultDocumentCachedImpl internal constructor(
|
|||||||
override val inputMessageContent: InputMessageContent? = null
|
override val inputMessageContent: InputMessageContent? = null
|
||||||
) : InlineQueryResultDocumentCached {
|
) : InlineQueryResultDocumentCached {
|
||||||
override val type: String = inlineQueryResultDocumentType
|
override val type: String = inlineQueryResultDocumentType
|
||||||
override val entities: List<TextSource>? by lazy {
|
override val textSources: TextSourcesList? by lazy {
|
||||||
rawEntities ?.asTextParts(text ?: return@lazy null) ?.justTextSources()
|
rawEntities ?.asTextSources(text ?: return@lazy null)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,17 @@
|
|||||||
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
|
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.*
|
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.document.InlineQueryResultDocument
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.document.InlineQueryResultDocument
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.document.inlineQueryResultDocumentType
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.document.inlineQueryResultDocumentType
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent
|
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent
|
||||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
import dev.inmo.tgbotapi.types.files.abstracts.mimeTypeField
|
import dev.inmo.tgbotapi.types.files.abstracts.mimeTypeField
|
||||||
import dev.inmo.tgbotapi.utils.MimeType
|
import dev.inmo.tgbotapi.utils.MimeType
|
||||||
|
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
@@ -38,10 +39,24 @@ fun InlineQueryResultDocumentImpl(
|
|||||||
thumbWidth: Int? = null,
|
thumbWidth: Int? = null,
|
||||||
thumbHeight: Int? = null,
|
thumbHeight: Int? = null,
|
||||||
description: String? = null,
|
description: String? = null,
|
||||||
entities: List<TextSource>,
|
entities: TextSourcesList,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null,
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
inputMessageContent: InputMessageContent? = null
|
inputMessageContent: InputMessageContent? = null
|
||||||
) = InlineQueryResultDocumentImpl(id, url, title, mimeType, thumbUrl, thumbWidth, thumbHeight, description, entities.makeString(), null, entities.toRawMessageEntities(), replyMarkup, inputMessageContent)
|
) = InlineQueryResultDocumentImpl(
|
||||||
|
id,
|
||||||
|
url,
|
||||||
|
title,
|
||||||
|
mimeType,
|
||||||
|
thumbUrl,
|
||||||
|
thumbWidth,
|
||||||
|
thumbHeight,
|
||||||
|
description,
|
||||||
|
entities.makeString(),
|
||||||
|
null,
|
||||||
|
entities.toRawMessageEntities(),
|
||||||
|
replyMarkup,
|
||||||
|
inputMessageContent
|
||||||
|
)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class InlineQueryResultDocumentImpl internal constructor(
|
data class InlineQueryResultDocumentImpl internal constructor(
|
||||||
@@ -73,7 +88,7 @@ data class InlineQueryResultDocumentImpl internal constructor(
|
|||||||
override val inputMessageContent: InputMessageContent? = null
|
override val inputMessageContent: InputMessageContent? = null
|
||||||
) : InlineQueryResultDocument {
|
) : InlineQueryResultDocument {
|
||||||
override val type: String = inlineQueryResultDocumentType
|
override val type: String = inlineQueryResultDocumentType
|
||||||
override val entities: List<TextSource>? by lazy {
|
override val textSources: TextSourcesList? by lazy {
|
||||||
rawEntities ?.asTextParts(text ?: return@lazy null) ?.justTextSources()
|
rawEntities ?.asTextSources(text ?: return@lazy null)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
|
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.*
|
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.gif.InlineQueryResultGifCached
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.gif.InlineQueryResultGifCached
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.gif.inlineQueryResultGifType
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.gif.inlineQueryResultGifType
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent
|
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent
|
||||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
|
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
@@ -27,10 +28,19 @@ fun InlineQueryResultGifCachedImpl(
|
|||||||
id: InlineQueryIdentifier,
|
id: InlineQueryIdentifier,
|
||||||
fileId: FileId,
|
fileId: FileId,
|
||||||
title: String? = null,
|
title: String? = null,
|
||||||
entities: List<TextSource>,
|
entities: TextSourcesList,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null,
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
inputMessageContent: InputMessageContent? = null
|
inputMessageContent: InputMessageContent? = null
|
||||||
) = InlineQueryResultGifCachedImpl(id, fileId, title, entities.makeString(), null, entities.toRawMessageEntities(), replyMarkup, inputMessageContent)
|
) = InlineQueryResultGifCachedImpl(
|
||||||
|
id,
|
||||||
|
fileId,
|
||||||
|
title,
|
||||||
|
entities.makeString(),
|
||||||
|
null,
|
||||||
|
entities.toRawMessageEntities(),
|
||||||
|
replyMarkup,
|
||||||
|
inputMessageContent
|
||||||
|
)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class InlineQueryResultGifCachedImpl internal constructor(
|
data class InlineQueryResultGifCachedImpl internal constructor(
|
||||||
@@ -52,7 +62,7 @@ data class InlineQueryResultGifCachedImpl internal constructor(
|
|||||||
override val inputMessageContent: InputMessageContent? = null
|
override val inputMessageContent: InputMessageContent? = null
|
||||||
) : InlineQueryResultGifCached {
|
) : InlineQueryResultGifCached {
|
||||||
override val type: String = inlineQueryResultGifType
|
override val type: String = inlineQueryResultGifType
|
||||||
override val entities: List<TextSource>? by lazy {
|
override val textSources: TextSourcesList? by lazy {
|
||||||
rawEntities ?.asTextParts(text ?: return@lazy null) ?.justTextSources()
|
rawEntities ?.asTextSources(text ?: return@lazy null)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
|
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.*
|
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.gif.InlineQueryResultGif
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.gif.InlineQueryResultGif
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.gif.inlineQueryResultGifType
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.gif.inlineQueryResultGifType
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent
|
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent
|
||||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
import dev.inmo.tgbotapi.utils.MimeType
|
import dev.inmo.tgbotapi.utils.MimeType
|
||||||
|
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
@@ -37,10 +38,24 @@ fun InlineQueryResultGifImpl(
|
|||||||
height: Int? = null,
|
height: Int? = null,
|
||||||
duration: Int? = null,
|
duration: Int? = null,
|
||||||
title: String? = null,
|
title: String? = null,
|
||||||
entities: List<TextSource>,
|
entities: TextSourcesList,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null,
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
inputMessageContent: InputMessageContent? = null
|
inputMessageContent: InputMessageContent? = null
|
||||||
) = InlineQueryResultGifImpl(id, url, thumbUrl, thumbMimeType, width, height, duration, title, entities.makeString(), null, entities.toRawMessageEntities(), replyMarkup, inputMessageContent)
|
) = InlineQueryResultGifImpl(
|
||||||
|
id,
|
||||||
|
url,
|
||||||
|
thumbUrl,
|
||||||
|
thumbMimeType,
|
||||||
|
width,
|
||||||
|
height,
|
||||||
|
duration,
|
||||||
|
title,
|
||||||
|
entities.makeString(),
|
||||||
|
null,
|
||||||
|
entities.toRawMessageEntities(),
|
||||||
|
replyMarkup,
|
||||||
|
inputMessageContent
|
||||||
|
)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class InlineQueryResultGifImpl internal constructor(
|
data class InlineQueryResultGifImpl internal constructor(
|
||||||
@@ -72,8 +87,8 @@ data class InlineQueryResultGifImpl internal constructor(
|
|||||||
override val inputMessageContent: InputMessageContent? = null
|
override val inputMessageContent: InputMessageContent? = null
|
||||||
) : InlineQueryResultGif {
|
) : InlineQueryResultGif {
|
||||||
override val type: String = inlineQueryResultGifType
|
override val type: String = inlineQueryResultGifType
|
||||||
override val entities: List<TextSource>? by lazy {
|
override val textSources: TextSourcesList? by lazy {
|
||||||
rawEntities ?.asTextParts(text ?: return@lazy null) ?.justTextSources()
|
rawEntities ?.asTextSources(text ?: return@lazy null)
|
||||||
}
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
|
|||||||
import dev.inmo.tgbotapi.CommonAbstracts.*
|
import dev.inmo.tgbotapi.CommonAbstracts.*
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.*
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.*
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent
|
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent
|
||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
|
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.*
|
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.mpeg4gif.InlineQueryResultMpeg4GifCached
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.mpeg4gif.InlineQueryResultMpeg4GifCached
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.mpeg4gif.inlineQueryResultMpeg4GifType
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.mpeg4gif.inlineQueryResultMpeg4GifType
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent
|
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent
|
||||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
|
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
@@ -27,10 +28,19 @@ fun InlineQueryResultMpeg4GifCachedImpl(
|
|||||||
id: InlineQueryIdentifier,
|
id: InlineQueryIdentifier,
|
||||||
fileId: FileId,
|
fileId: FileId,
|
||||||
title: String? = null,
|
title: String? = null,
|
||||||
entities: List<TextSource>,
|
entities: TextSourcesList,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null,
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
inputMessageContent: InputMessageContent? = null
|
inputMessageContent: InputMessageContent? = null
|
||||||
) = InlineQueryResultMpeg4GifCachedImpl(id, fileId, title, entities.makeString(), null, entities.toRawMessageEntities(), replyMarkup, inputMessageContent)
|
) = InlineQueryResultMpeg4GifCachedImpl(
|
||||||
|
id,
|
||||||
|
fileId,
|
||||||
|
title,
|
||||||
|
entities.makeString(),
|
||||||
|
null,
|
||||||
|
entities.toRawMessageEntities(),
|
||||||
|
replyMarkup,
|
||||||
|
inputMessageContent
|
||||||
|
)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class InlineQueryResultMpeg4GifCachedImpl internal constructor(
|
data class InlineQueryResultMpeg4GifCachedImpl internal constructor(
|
||||||
@@ -52,7 +62,7 @@ data class InlineQueryResultMpeg4GifCachedImpl internal constructor(
|
|||||||
override val inputMessageContent: InputMessageContent? = null
|
override val inputMessageContent: InputMessageContent? = null
|
||||||
) : InlineQueryResultMpeg4GifCached {
|
) : InlineQueryResultMpeg4GifCached {
|
||||||
override val type: String = inlineQueryResultMpeg4GifType
|
override val type: String = inlineQueryResultMpeg4GifType
|
||||||
override val entities: List<TextSource>? by lazy {
|
override val textSources: TextSourcesList? by lazy {
|
||||||
rawEntities ?.asTextParts(text ?: return@lazy null) ?.justTextSources()
|
rawEntities ?.asTextSources(text ?: return@lazy null)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
|
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.*
|
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.mpeg4gif.InlineQueryResultMpeg4Gif
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.mpeg4gif.InlineQueryResultMpeg4Gif
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.mpeg4gif.inlineQueryResultMpeg4GifType
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.mpeg4gif.inlineQueryResultMpeg4GifType
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent
|
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent
|
||||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
import dev.inmo.tgbotapi.utils.MimeType
|
import dev.inmo.tgbotapi.utils.MimeType
|
||||||
|
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
@@ -37,10 +38,24 @@ fun InlineQueryResultMpeg4GifImpl(
|
|||||||
height: Int? = null,
|
height: Int? = null,
|
||||||
duration: Int? = null,
|
duration: Int? = null,
|
||||||
title: String? = null,
|
title: String? = null,
|
||||||
entities: List<TextSource>,
|
entities: TextSourcesList,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null,
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
inputMessageContent: InputMessageContent? = null
|
inputMessageContent: InputMessageContent? = null
|
||||||
) = InlineQueryResultMpeg4GifImpl(id, url, thumbUrl, thumbMimeType, width, height, duration, title, entities.makeString(), null, entities.toRawMessageEntities(), replyMarkup, inputMessageContent)
|
) = InlineQueryResultMpeg4GifImpl(
|
||||||
|
id,
|
||||||
|
url,
|
||||||
|
thumbUrl,
|
||||||
|
thumbMimeType,
|
||||||
|
width,
|
||||||
|
height,
|
||||||
|
duration,
|
||||||
|
title,
|
||||||
|
entities.makeString(),
|
||||||
|
null,
|
||||||
|
entities.toRawMessageEntities(),
|
||||||
|
replyMarkup,
|
||||||
|
inputMessageContent
|
||||||
|
)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class InlineQueryResultMpeg4GifImpl internal constructor(
|
data class InlineQueryResultMpeg4GifImpl internal constructor(
|
||||||
@@ -72,8 +87,8 @@ data class InlineQueryResultMpeg4GifImpl internal constructor(
|
|||||||
override val inputMessageContent: InputMessageContent? = null
|
override val inputMessageContent: InputMessageContent? = null
|
||||||
) : InlineQueryResultMpeg4Gif {
|
) : InlineQueryResultMpeg4Gif {
|
||||||
override val type: String = inlineQueryResultMpeg4GifType
|
override val type: String = inlineQueryResultMpeg4GifType
|
||||||
override val entities: List<TextSource>? by lazy {
|
override val textSources: TextSourcesList? by lazy {
|
||||||
rawEntities ?.asTextParts(text ?: return@lazy null) ?.justTextSources()
|
rawEntities ?.asTextSources(text ?: return@lazy null)
|
||||||
}
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
|
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.*
|
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.photo.InlineQueryResultPhotoCached
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.photo.InlineQueryResultPhotoCached
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.photo.inlineQueryResultPhotoType
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.photo.inlineQueryResultPhotoType
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent
|
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent
|
||||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
|
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
@@ -29,10 +30,20 @@ fun InlineQueryResultPhotoCachedImpl(
|
|||||||
fileId: FileId,
|
fileId: FileId,
|
||||||
title: String? = null,
|
title: String? = null,
|
||||||
description: String? = null,
|
description: String? = null,
|
||||||
entities: List<TextSource>,
|
entities: TextSourcesList,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null,
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
inputMessageContent: InputMessageContent? = null
|
inputMessageContent: InputMessageContent? = null
|
||||||
) = InlineQueryResultPhotoCachedImpl(id, fileId, title, description, entities.makeString(), null, entities.toRawMessageEntities(), replyMarkup, inputMessageContent)
|
) = InlineQueryResultPhotoCachedImpl(
|
||||||
|
id,
|
||||||
|
fileId,
|
||||||
|
title,
|
||||||
|
description,
|
||||||
|
entities.makeString(),
|
||||||
|
null,
|
||||||
|
entities.toRawMessageEntities(),
|
||||||
|
replyMarkup,
|
||||||
|
inputMessageContent
|
||||||
|
)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class InlineQueryResultPhotoCachedImpl internal constructor(
|
data class InlineQueryResultPhotoCachedImpl internal constructor(
|
||||||
@@ -56,7 +67,7 @@ data class InlineQueryResultPhotoCachedImpl internal constructor(
|
|||||||
override val inputMessageContent: InputMessageContent? = null
|
override val inputMessageContent: InputMessageContent? = null
|
||||||
) : InlineQueryResultPhotoCached {
|
) : InlineQueryResultPhotoCached {
|
||||||
override val type: String = inlineQueryResultPhotoType
|
override val type: String = inlineQueryResultPhotoType
|
||||||
override val entities: List<TextSource>? by lazy {
|
override val textSources: TextSourcesList? by lazy {
|
||||||
rawEntities ?.asTextParts(text ?: return@lazy null) ?.justTextSources()
|
rawEntities ?.asTextSources(text ?: return@lazy null)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,15 @@
|
|||||||
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
|
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.*
|
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.photo.InlineQueryResultPhoto
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.photo.InlineQueryResultPhoto
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.photo.inlineQueryResultPhotoType
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.photo.inlineQueryResultPhotoType
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent
|
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent
|
||||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
|
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
@@ -34,10 +35,23 @@ fun InlineQueryResultPhotoImpl(
|
|||||||
height: Int? = null,
|
height: Int? = null,
|
||||||
title: String? = null,
|
title: String? = null,
|
||||||
description: String? = null,
|
description: String? = null,
|
||||||
entities: List<TextSource>,
|
entities: TextSourcesList,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null,
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
inputMessageContent: InputMessageContent? = null
|
inputMessageContent: InputMessageContent? = null
|
||||||
) = InlineQueryResultPhotoImpl(id, url, thumbUrl, width, height, title, description, entities.makeString(), null, entities.toRawMessageEntities(), replyMarkup, inputMessageContent)
|
) = InlineQueryResultPhotoImpl(
|
||||||
|
id,
|
||||||
|
url,
|
||||||
|
thumbUrl,
|
||||||
|
width,
|
||||||
|
height,
|
||||||
|
title,
|
||||||
|
description,
|
||||||
|
entities.makeString(),
|
||||||
|
null,
|
||||||
|
entities.toRawMessageEntities(),
|
||||||
|
replyMarkup,
|
||||||
|
inputMessageContent
|
||||||
|
)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class InlineQueryResultPhotoImpl internal constructor(
|
data class InlineQueryResultPhotoImpl internal constructor(
|
||||||
@@ -67,7 +81,7 @@ data class InlineQueryResultPhotoImpl internal constructor(
|
|||||||
override val inputMessageContent: InputMessageContent? = null
|
override val inputMessageContent: InputMessageContent? = null
|
||||||
) : InlineQueryResultPhoto {
|
) : InlineQueryResultPhoto {
|
||||||
override val type: String = inlineQueryResultPhotoType
|
override val type: String = inlineQueryResultPhotoType
|
||||||
override val entities: List<TextSource>? by lazy {
|
override val textSources: TextSourcesList? by lazy {
|
||||||
rawEntities ?.asTextParts(text ?: return@lazy null) ?.justTextSources()
|
rawEntities ?.asTextSources(text ?: return@lazy null)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
|
|||||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.*
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.*
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent
|
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent
|
||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import dev.inmo.tgbotapi.CommonAbstracts.CommonVenueData
|
|||||||
import dev.inmo.tgbotapi.CommonAbstracts.Locationed
|
import dev.inmo.tgbotapi.CommonAbstracts.Locationed
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.*
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.*
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent
|
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent
|
||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
|
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.*
|
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.video.InlineQueryResultVideoCached
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.video.InlineQueryResultVideoCached
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.video.inlineQueryResultVideoType
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.video.inlineQueryResultVideoType
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent
|
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent
|
||||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
|
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
@@ -29,10 +30,20 @@ fun InlineQueryResultVideoCachedImpl(
|
|||||||
fileId: FileId,
|
fileId: FileId,
|
||||||
title: String,
|
title: String,
|
||||||
description: String? = null,
|
description: String? = null,
|
||||||
entities: List<TextSource>,
|
entities: TextSourcesList,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null,
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
inputMessageContent: InputMessageContent? = null
|
inputMessageContent: InputMessageContent? = null
|
||||||
) = InlineQueryResultVideoCachedImpl(id, fileId, title, description, entities.makeString(), null, entities.toRawMessageEntities(), replyMarkup, inputMessageContent)
|
) = InlineQueryResultVideoCachedImpl(
|
||||||
|
id,
|
||||||
|
fileId,
|
||||||
|
title,
|
||||||
|
description,
|
||||||
|
entities.makeString(),
|
||||||
|
null,
|
||||||
|
entities.toRawMessageEntities(),
|
||||||
|
replyMarkup,
|
||||||
|
inputMessageContent
|
||||||
|
)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class InlineQueryResultVideoCachedImpl internal constructor(
|
data class InlineQueryResultVideoCachedImpl internal constructor(
|
||||||
@@ -56,7 +67,7 @@ data class InlineQueryResultVideoCachedImpl internal constructor(
|
|||||||
override val inputMessageContent: InputMessageContent? = null
|
override val inputMessageContent: InputMessageContent? = null
|
||||||
) : InlineQueryResultVideoCached {
|
) : InlineQueryResultVideoCached {
|
||||||
override val type: String = inlineQueryResultVideoType
|
override val type: String = inlineQueryResultVideoType
|
||||||
override val entities: List<TextSource>? by lazy {
|
override val textSources: TextSourcesList? by lazy {
|
||||||
rawEntities ?.asTextParts(text ?: return@lazy null) ?.justTextSources()
|
rawEntities ?.asTextSources(text ?: return@lazy null)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,17 @@
|
|||||||
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
|
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.*
|
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.video.InlineQueryResultVideo
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.video.InlineQueryResultVideo
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.video.inlineQueryResultVideoType
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.video.inlineQueryResultVideoType
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent
|
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent
|
||||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
import dev.inmo.tgbotapi.types.files.abstracts.mimeTypeField
|
import dev.inmo.tgbotapi.types.files.abstracts.mimeTypeField
|
||||||
import dev.inmo.tgbotapi.utils.MimeType
|
import dev.inmo.tgbotapi.utils.MimeType
|
||||||
|
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
@@ -43,7 +44,22 @@ fun InlineQueryResultVideoImpl(
|
|||||||
entities: List<TextSource>,
|
entities: List<TextSource>,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null,
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
inputMessageContent: InputMessageContent? = null
|
inputMessageContent: InputMessageContent? = null
|
||||||
) = InlineQueryResultVideoImpl(id, url, thumbUrl, mimeType, title, width, height, duration, description, entities.makeString(), null, entities.toRawMessageEntities(), replyMarkup, inputMessageContent)
|
) = InlineQueryResultVideoImpl(
|
||||||
|
id,
|
||||||
|
url,
|
||||||
|
thumbUrl,
|
||||||
|
mimeType,
|
||||||
|
title,
|
||||||
|
width,
|
||||||
|
height,
|
||||||
|
duration,
|
||||||
|
description,
|
||||||
|
entities.makeString(),
|
||||||
|
null,
|
||||||
|
entities.toRawMessageEntities(),
|
||||||
|
replyMarkup,
|
||||||
|
inputMessageContent
|
||||||
|
)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class InlineQueryResultVideoImpl internal constructor(
|
data class InlineQueryResultVideoImpl internal constructor(
|
||||||
@@ -77,7 +93,7 @@ data class InlineQueryResultVideoImpl internal constructor(
|
|||||||
override val inputMessageContent: InputMessageContent? = null
|
override val inputMessageContent: InputMessageContent? = null
|
||||||
) : InlineQueryResultVideo {
|
) : InlineQueryResultVideo {
|
||||||
override val type: String = inlineQueryResultVideoType
|
override val type: String = inlineQueryResultVideoType
|
||||||
override val entities: List<TextSource>? by lazy {
|
override val textSources: List<TextSource>? by lazy {
|
||||||
rawEntities ?.asTextParts(text ?: return@lazy null) ?.justTextSources()
|
rawEntities ?.asTextSources(text ?: return@lazy null)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
|
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.*
|
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.voice.InlineQueryResultVoiceCached
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.voice.InlineQueryResultVoiceCached
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.voice.inlineQueryResultVoiceType
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.voice.inlineQueryResultVoiceType
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent
|
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent
|
||||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
|
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
@@ -27,10 +28,19 @@ fun InlineQueryResultVoiceCachedImpl(
|
|||||||
id: InlineQueryIdentifier,
|
id: InlineQueryIdentifier,
|
||||||
fileId: FileId,
|
fileId: FileId,
|
||||||
title: String,
|
title: String,
|
||||||
entities: List<TextSource>,
|
entities: TextSourcesList,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null,
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
inputMessageContent: InputMessageContent? = null
|
inputMessageContent: InputMessageContent? = null
|
||||||
) = InlineQueryResultVoiceCachedImpl(id, fileId, title, entities.makeString(), null, entities.toRawMessageEntities(), replyMarkup, inputMessageContent)
|
) = InlineQueryResultVoiceCachedImpl(
|
||||||
|
id,
|
||||||
|
fileId,
|
||||||
|
title,
|
||||||
|
entities.makeString(),
|
||||||
|
null,
|
||||||
|
entities.toRawMessageEntities(),
|
||||||
|
replyMarkup,
|
||||||
|
inputMessageContent
|
||||||
|
)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class InlineQueryResultVoiceCachedImpl internal constructor(
|
data class InlineQueryResultVoiceCachedImpl internal constructor(
|
||||||
@@ -52,7 +62,7 @@ data class InlineQueryResultVoiceCachedImpl internal constructor(
|
|||||||
override val inputMessageContent: InputMessageContent? = null
|
override val inputMessageContent: InputMessageContent? = null
|
||||||
) : InlineQueryResultVoiceCached {
|
) : InlineQueryResultVoiceCached {
|
||||||
override val type: String = inlineQueryResultVoiceType
|
override val type: String = inlineQueryResultVoiceType
|
||||||
override val entities: List<TextSource>? by lazy {
|
override val textSources: TextSourcesList? by lazy {
|
||||||
rawEntities ?.asTextParts(text ?: return@lazy null) ?.justTextSources()
|
rawEntities ?.asTextSources(text ?: return@lazy null)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,15 @@
|
|||||||
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
|
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.*
|
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.voice.InlineQueryResultVoice
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.voice.InlineQueryResultVoice
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.voice.inlineQueryResultVoiceType
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.voice.inlineQueryResultVoiceType
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent
|
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent
|
||||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
|
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
@@ -38,10 +39,20 @@ fun InlineQueryResultVoiceImpl(
|
|||||||
url: String,
|
url: String,
|
||||||
title: String,
|
title: String,
|
||||||
duration: Int? = null,
|
duration: Int? = null,
|
||||||
entities: List<TextSource>,
|
entities: TextSourcesList,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null,
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
inputMessageContent: InputMessageContent? = null
|
inputMessageContent: InputMessageContent? = null
|
||||||
) = InlineQueryResultVoiceImpl(id, url, title, duration, entities.makeString(), null, entities.toRawMessageEntities(), replyMarkup, inputMessageContent)
|
) = InlineQueryResultVoiceImpl(
|
||||||
|
id,
|
||||||
|
url,
|
||||||
|
title,
|
||||||
|
duration,
|
||||||
|
entities.makeString(),
|
||||||
|
null,
|
||||||
|
entities.toRawMessageEntities(),
|
||||||
|
replyMarkup,
|
||||||
|
inputMessageContent
|
||||||
|
)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class InlineQueryResultVoiceImpl internal constructor(
|
data class InlineQueryResultVoiceImpl internal constructor(
|
||||||
@@ -65,7 +76,7 @@ data class InlineQueryResultVoiceImpl internal constructor(
|
|||||||
override val inputMessageContent: InputMessageContent? = null
|
override val inputMessageContent: InputMessageContent? = null
|
||||||
) : InlineQueryResultVoice {
|
) : InlineQueryResultVoice {
|
||||||
override val type: String = inlineQueryResultVoiceType
|
override val type: String = inlineQueryResultVoiceType
|
||||||
override val entities: List<TextSource>? by lazy {
|
override val textSources: TextSourcesList? by lazy {
|
||||||
rawEntities ?.asTextParts(text ?: return@lazy null) ?.justTextSources()
|
rawEntities ?.asTextSources(text ?: return@lazy null)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts
|
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent
|
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent
|
||||||
|
|
||||||
interface WithInputMessageContentInlineQueryResult : InlineQueryResult {
|
interface WithInputMessageContentInlineQueryResult : InlineQueryResult {
|
||||||
val inputMessageContent: InputMessageContent?
|
val inputMessageContent: InputMessageContent?
|
||||||
|
|||||||
@@ -2,13 +2,15 @@ package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.serializers
|
|||||||
|
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.*
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.*
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.InlineQueryResult
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.InlineQueryResult
|
||||||
import kotlinx.serialization.*
|
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||||
|
import kotlinx.serialization.InternalSerializationApi
|
||||||
|
import kotlinx.serialization.KSerializer
|
||||||
import kotlinx.serialization.descriptors.*
|
import kotlinx.serialization.descriptors.*
|
||||||
import kotlinx.serialization.encoding.Decoder
|
import kotlinx.serialization.encoding.Decoder
|
||||||
import kotlinx.serialization.encoding.Encoder
|
import kotlinx.serialization.encoding.Encoder
|
||||||
|
|
||||||
@Serializer(InlineQueryResult::class)
|
@RiskFeature
|
||||||
internal object InlineQueryResultSerializer : KSerializer<InlineQueryResult> {
|
object InlineQueryResultSerializer : KSerializer<InlineQueryResult> {
|
||||||
@InternalSerializationApi
|
@InternalSerializationApi
|
||||||
override val descriptor: SerialDescriptor = buildSerialDescriptor(InlineQueryResult::class.toString(), PolymorphicKind.OPEN)
|
override val descriptor: SerialDescriptor = buildSerialDescriptor(InlineQueryResult::class.toString(), PolymorphicKind.OPEN)
|
||||||
override fun serialize(encoder: Encoder, value: InlineQueryResult) {
|
override fun serialize(encoder: Encoder, value: InlineQueryResult) {
|
||||||
@@ -39,4 +41,4 @@ internal object InlineQueryResultSerializer : KSerializer<InlineQueryResult> {
|
|||||||
override fun deserialize(decoder: Decoder): InlineQueryResult {
|
override fun deserialize(decoder: Decoder): InlineQueryResult {
|
||||||
throw TODO()
|
throw TODO()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent
|
|||||||
|
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.CommonContactData
|
import dev.inmo.tgbotapi.CommonAbstracts.CommonContactData
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent
|
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
@@ -16,4 +15,4 @@ data class InputContactMessageContent(
|
|||||||
override val lastName: String? = null,
|
override val lastName: String? = null,
|
||||||
@SerialName(vcardField)
|
@SerialName(vcardField)
|
||||||
override val vcard: String? = null
|
override val vcard: String? = null
|
||||||
) : CommonContactData, InputMessageContent
|
) : CommonContactData, InputMessageContent
|
||||||
|
|||||||
@@ -0,0 +1,79 @@
|
|||||||
|
package dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.CommonAbstracts.CommonSendInvoiceData
|
||||||
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import dev.inmo.tgbotapi.types.payments.LabeledPrice
|
||||||
|
import dev.inmo.tgbotapi.types.payments.LabeledPricesSerializer
|
||||||
|
import dev.inmo.tgbotapi.types.payments.abstracts.Currency
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
class InputInvoiceMessageContent(
|
||||||
|
@SerialName(titleField)
|
||||||
|
override val title: String,
|
||||||
|
@SerialName(descriptionField)
|
||||||
|
override val description: String,
|
||||||
|
@SerialName(payloadField)
|
||||||
|
override val payload: String,
|
||||||
|
@SerialName(providerTokenField)
|
||||||
|
override val providerToken: String,
|
||||||
|
@SerialName(currencyField)
|
||||||
|
override val currency: Currency,
|
||||||
|
@Serializable(LabeledPricesSerializer::class)
|
||||||
|
@SerialName(pricesField)
|
||||||
|
override val prices: List<LabeledPrice>,
|
||||||
|
@SerialName(maxTipAmountField)
|
||||||
|
override val maxTipAmount: Int? = null,
|
||||||
|
@SerialName(suggestedTipAmountsField)
|
||||||
|
override val suggestedTipAmounts: List<Int>? = null,
|
||||||
|
@SerialName(providerDataField)
|
||||||
|
override val providerData: String? = null,
|
||||||
|
@SerialName(requireNameField)
|
||||||
|
override val requireName: Boolean = false,
|
||||||
|
@SerialName(requirePhoneNumberField)
|
||||||
|
override val requirePhoneNumber: Boolean = false,
|
||||||
|
@SerialName(requireEmailField)
|
||||||
|
override val requireEmail: Boolean = false,
|
||||||
|
@SerialName(requireShippingAddressField)
|
||||||
|
override val requireShippingAddress: Boolean = false,
|
||||||
|
@SerialName(shouldSendPhoneNumberToProviderField)
|
||||||
|
override val shouldSendPhoneNumberToProvider: Boolean = false,
|
||||||
|
@SerialName(shouldSendEmailToProviderField)
|
||||||
|
override val shouldSendEmailToProvider: Boolean = false,
|
||||||
|
@SerialName(priceDependOnShipAddressField)
|
||||||
|
override val priceDependOnShipAddress: Boolean = false
|
||||||
|
) : InputMessageContent, CommonSendInvoiceData {
|
||||||
|
@SerialName(photoUrlField)
|
||||||
|
override var photoUrl: String? = null
|
||||||
|
private set
|
||||||
|
@SerialName(photoSizeField)
|
||||||
|
override var photoSize: Long? = null
|
||||||
|
private set
|
||||||
|
|
||||||
|
@SerialName(photoWidthField)
|
||||||
|
override var photoWidth: Int? = null
|
||||||
|
private set
|
||||||
|
@SerialName(photoHeightField)
|
||||||
|
override var photoHeight: Int? = null
|
||||||
|
private set
|
||||||
|
|
||||||
|
override fun setPhoto(
|
||||||
|
photoUrl: String,
|
||||||
|
photoSize: Long?,
|
||||||
|
photoWidth: Int?,
|
||||||
|
photoHeight: Int?
|
||||||
|
) {
|
||||||
|
this.photoUrl = photoUrl
|
||||||
|
this.photoSize = photoSize
|
||||||
|
this.photoWidth = photoWidth
|
||||||
|
this.photoHeight = photoHeight
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun unsetPhoto() {
|
||||||
|
photoUrl = null
|
||||||
|
photoSize = null
|
||||||
|
photoWidth = null
|
||||||
|
photoHeight = null
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,7 +2,6 @@ package dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent
|
|||||||
|
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.*
|
import dev.inmo.tgbotapi.CommonAbstracts.*
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent
|
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
@@ -20,4 +19,4 @@ data class InputLocationMessageContent(
|
|||||||
override val heading: Degrees? = null,
|
override val heading: Degrees? = null,
|
||||||
@SerialName(proximityAlertRadiusField)
|
@SerialName(proximityAlertRadiusField)
|
||||||
override val proximityAlertRadius: Meters? = null
|
override val proximityAlertRadius: Meters? = null
|
||||||
) : Locationed, HorizontallyAccured, ProximityAlertable, Livable, Headed, InputMessageContent
|
) : Locationed, HorizontallyAccured, ProximityAlertable, Livable, Headed, InputMessageContent
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContentSerializer
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable(InputMessageContentSerializer::class)
|
||||||
|
sealed interface InputMessageContent
|
||||||
@@ -1,12 +1,13 @@
|
|||||||
package dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent
|
package dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.*
|
import dev.inmo.tgbotapi.CommonAbstracts.TextedOutput
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.types.DisableWebPagePreview
|
import dev.inmo.tgbotapi.CommonAbstracts.types.DisableWebPagePreview
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent
|
|
||||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||||
|
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
@@ -23,7 +24,7 @@ fun InputTextMessageContent(
|
|||||||
* Represents the [InputMessageContent] of a text message to be sent as the result of an inline query.
|
* Represents the [InputMessageContent] of a text message to be sent as the result of an inline query.
|
||||||
*/
|
*/
|
||||||
fun InputTextMessageContent(
|
fun InputTextMessageContent(
|
||||||
entities: List<TextSource>,
|
entities: TextSourcesList,
|
||||||
disableWebPagePreview: Boolean? = null
|
disableWebPagePreview: Boolean? = null
|
||||||
) = InputTextMessageContent(entities.makeString(), null, entities.toRawMessageEntities(), disableWebPagePreview)
|
) = InputTextMessageContent(entities.makeString(), null, entities.toRawMessageEntities(), disableWebPagePreview)
|
||||||
|
|
||||||
@@ -38,7 +39,7 @@ data class InputTextMessageContent internal constructor(
|
|||||||
@SerialName(disableWebPagePreviewField)
|
@SerialName(disableWebPagePreviewField)
|
||||||
override val disableWebPagePreview: Boolean? = null
|
override val disableWebPagePreview: Boolean? = null
|
||||||
) : TextedOutput, DisableWebPagePreview, InputMessageContent {
|
) : TextedOutput, DisableWebPagePreview, InputMessageContent {
|
||||||
override val entities: List<TextSource>? by lazy {
|
override val textSources: TextSourcesList? by lazy {
|
||||||
rawEntities ?.asTextParts(text) ?.justTextSources()
|
rawEntities ?.asTextSources(text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent
|
|||||||
import dev.inmo.tgbotapi.CommonAbstracts.CommonVenueData
|
import dev.inmo.tgbotapi.CommonAbstracts.CommonVenueData
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.Locationed
|
import dev.inmo.tgbotapi.CommonAbstracts.Locationed
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent
|
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,15 @@
|
|||||||
package dev.inmo.tgbotapi.types.InlineQueries
|
package dev.inmo.tgbotapi.types.InlineQueries
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.*
|
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.*
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent
|
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.InternalSerializationApi
|
||||||
|
import kotlinx.serialization.KSerializer
|
||||||
import kotlinx.serialization.descriptors.*
|
import kotlinx.serialization.descriptors.*
|
||||||
import kotlinx.serialization.encoding.Decoder
|
import kotlinx.serialization.encoding.Decoder
|
||||||
import kotlinx.serialization.encoding.Encoder
|
import kotlinx.serialization.encoding.Encoder
|
||||||
|
|
||||||
@Serializer(InputMessageContent::class)
|
@RiskFeature
|
||||||
internal object InputMessageContentSerializer : KSerializer<InputMessageContent> {
|
object InputMessageContentSerializer : KSerializer<InputMessageContent> {
|
||||||
@InternalSerializationApi
|
@InternalSerializationApi
|
||||||
override val descriptor: SerialDescriptor = buildSerialDescriptor(InputMessageContent::class.toString(), PolymorphicKind.OPEN)
|
override val descriptor: SerialDescriptor = buildSerialDescriptor(InputMessageContent::class.toString(), PolymorphicKind.OPEN)
|
||||||
override fun serialize(encoder: Encoder, value: InputMessageContent) {
|
override fun serialize(encoder: Encoder, value: InputMessageContent) {
|
||||||
@@ -17,6 +18,7 @@ internal object InputMessageContentSerializer : KSerializer<InputMessageContent>
|
|||||||
is InputLocationMessageContent -> InputLocationMessageContent.serializer().serialize(encoder, value)
|
is InputLocationMessageContent -> InputLocationMessageContent.serializer().serialize(encoder, value)
|
||||||
is InputTextMessageContent -> InputTextMessageContent.serializer().serialize(encoder, value)
|
is InputTextMessageContent -> InputTextMessageContent.serializer().serialize(encoder, value)
|
||||||
is InputVenueMessageContent -> InputVenueMessageContent.serializer().serialize(encoder, value)
|
is InputVenueMessageContent -> InputVenueMessageContent.serializer().serialize(encoder, value)
|
||||||
|
is InputInvoiceMessageContent -> InputInvoiceMessageContent.serializer().serialize(encoder, value)
|
||||||
else -> throw IllegalArgumentException("Unknown for serializing InputContactMessageContent")
|
else -> throw IllegalArgumentException("Unknown for serializing InputContactMessageContent")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,6 @@
|
|||||||
package dev.inmo.tgbotapi.types.InlineQueries.abstracts
|
package dev.inmo.tgbotapi.types.InlineQueries.abstracts
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult.ChosenInlineResult
|
||||||
|
|
||||||
interface ChosenInlineResult {
|
@Deprecated("Replaced", ReplaceWith("ChosenInlineResult", "dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult.ChosenInlineResult"))
|
||||||
val resultId: InlineQueryIdentifier //chosen temporary, can be changed
|
typealias ChosenInlineResult = ChosenInlineResult
|
||||||
val user: User
|
|
||||||
val inlineMessageId: InlineMessageIdentifier?
|
|
||||||
val query: String
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,11 +1,6 @@
|
|||||||
package dev.inmo.tgbotapi.types.InlineQueries.abstracts
|
package dev.inmo.tgbotapi.types.InlineQueries.abstracts
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.types.InlineQueryIdentifier
|
import dev.inmo.tgbotapi.types.InlineQueries.query.InlineQuery
|
||||||
import dev.inmo.tgbotapi.types.User
|
|
||||||
|
|
||||||
interface InlineQuery {
|
@Deprecated("Replaced", ReplaceWith("InlineQuery", "dev.inmo.tgbotapi.types.InlineQueries.query.InlineQuery"))
|
||||||
val id: InlineQueryIdentifier
|
typealias InlineQuery = InlineQuery
|
||||||
val from: User
|
|
||||||
val query: String
|
|
||||||
val offset: String
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package dev.inmo.tgbotapi.types.InlineQueries.abstracts
|
package dev.inmo.tgbotapi.types.InlineQueries.abstracts
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContentSerializer
|
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent
|
||||||
import kotlinx.serialization.Serializable
|
|
||||||
|
|
||||||
@Serializable(InputMessageContentSerializer::class)
|
@Deprecated("Replaced", ReplaceWith("InputMessageContent", "dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent"))
|
||||||
interface InputMessageContent
|
typealias InputMessageContent = InputMessageContent
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
package dev.inmo.tgbotapi.types.InlineQueries.query
|
package dev.inmo.tgbotapi.types.InlineQueries.query
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InlineQuery
|
|
||||||
import dev.inmo.tgbotapi.types.InlineQueryIdentifier
|
import dev.inmo.tgbotapi.types.InlineQueryIdentifier
|
||||||
import dev.inmo.tgbotapi.types.User
|
import dev.inmo.tgbotapi.types.User
|
||||||
|
import dev.inmo.tgbotapi.types.chat.ChatType
|
||||||
|
|
||||||
data class BaseInlineQuery(
|
data class BaseInlineQuery(
|
||||||
override val id: InlineQueryIdentifier,
|
override val id: InlineQueryIdentifier,
|
||||||
override val from: User,
|
override val from: User,
|
||||||
override val query: String,
|
override val query: String,
|
||||||
override val offset: String
|
override val offset: String,
|
||||||
|
override val chatType: ChatType?
|
||||||
) : InlineQuery
|
) : InlineQuery
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user