mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2025-11-19 13:55:57 +00:00
Compare commits
127 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d3499cdde1 | |||
| 01d04f9d2b | |||
| d290992e40 | |||
| 867bdb8bd7 | |||
| 5f0a67187f | |||
| d9638849e2 | |||
| 5568720b5b | |||
| c0c591fe08 | |||
| 3c1f8421c9 | |||
| 35b20d102c | |||
| 70e6dc8fc9 | |||
| 4f0de376ab | |||
| 10c52c695c | |||
| 2d2c745527 | |||
| 1238843bde | |||
| 1ebaa1c387 | |||
| b2bc47ec04 | |||
| 514620b2bd | |||
| 054f06e18b | |||
| 00d467d091 | |||
| 6426ed6571 | |||
| fba6707f44 | |||
| 0c2fe6bce7 | |||
| eee9fe439f | |||
| 3547c09383 | |||
| 956f02d26d | |||
| 468fc0a49b | |||
| 441f3cee3d | |||
| 1ea79b9f7f | |||
| 094f88867d | |||
| 85a8a8eedc | |||
| 28fce0b4c1 | |||
| 2f5fdcdca0 | |||
| 21799d7e4a | |||
| ca409db0ee | |||
| 33c8ee0803 | |||
| 0c0ec22348 | |||
| 24bffbbd97 | |||
| a615d1c4fd | |||
| a76b7977b3 | |||
| 6004879aef | |||
| 98ff2558e9 | |||
| 61c00b38b1 | |||
| 2096671147 | |||
| 094d58f59f | |||
| 578a66b758 | |||
| b5bb40576b | |||
| 953638ddf5 | |||
| 1c9ca7a493 | |||
| c220412b02 | |||
| 41852dde7c | |||
| 3150cd6a37 | |||
| 07de18efd8 | |||
| 9552550198 | |||
| e1c94f772d | |||
| fbed81a1b3 | |||
| b61912d99a | |||
| 5efe74171d | |||
| 393981560c | |||
| 73b355df55 | |||
| 86885e7698 | |||
| 4d9be1a995 | |||
| 596176ee93 | |||
| 2348434048 | |||
| 5c6a430f38 | |||
| 148791ad68 | |||
| 5c5a19c91a | |||
| bd60c4f411 | |||
| e5a36225f8 | |||
| bd2c13c178 | |||
| 6f1f94299b | |||
| 72b8231eab | |||
| 323e5fb391 | |||
| dca5bb40e3 | |||
| c21975a150 | |||
| 8675833b99 | |||
| faf669c035 | |||
| 2f3a683fa0 | |||
| 2a617b5c4d | |||
|
|
aa1e7eea1d | ||
| 22eac5414c | |||
| 8206aefbb6 | |||
| fb8cfed382 | |||
| 2de22a08a3 | |||
| e8022a2ded | |||
| d6cef5984b | |||
| 49bea1bcef | |||
| 85a4459072 | |||
| ce74631580 | |||
| 1e5ce6bb5c | |||
| dc89e914a1 | |||
| ee815c7335 | |||
| 69f4033807 | |||
| 0581587adf | |||
| 23f93075a4 | |||
| 6c3425d5f9 | |||
| d285590348 | |||
| 2e0ad6dd3c | |||
| 96a5e55894 | |||
| 4e3b085cdb | |||
| 8baa601af7 | |||
|
|
facd732fa8 | ||
| e19561367e | |||
| 249efeee7e | |||
| b8cc2421b6 | |||
| 2fa1a064ec | |||
| 63e864741e | |||
| e4f35c0eba | |||
| 944fe6d820 | |||
| 8ea50f36aa | |||
| 17308a6d99 | |||
| 6eabea2529 | |||
| ffe9166fee | |||
| f1be3e2819 | |||
| c4c016c438 | |||
| a85e7d7387 | |||
| fc59ab0cdd | |||
| 9ed7ded967 | |||
| a76a7ae630 | |||
| 4715eb424f | |||
| c24d536d4c | |||
| c969d88bf0 | |||
| 44e9dc9253 | |||
| 10c62bf2c7 | |||
| 20b1645935 | |||
| c5bf9ab1a2 | |||
| cd6d108a9a |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -10,4 +10,5 @@ build/
|
|||||||
out/
|
out/
|
||||||
|
|
||||||
local.properties
|
local.properties
|
||||||
|
kotlin-js-store/
|
||||||
secret.gradle
|
secret.gradle
|
||||||
|
|||||||
197
CHANGELOG.md
197
CHANGELOG.md
@@ -1,12 +1,205 @@
|
|||||||
# TelegramBotAPI changelog
|
# TelegramBotAPI changelog
|
||||||
|
|
||||||
## 0.36.1
|
## 0.38.7
|
||||||
|
|
||||||
|
* `Common`:
|
||||||
|
* `Version`:
|
||||||
|
* `MicroUtils`: `0.9.9` -> `0.9.12`
|
||||||
|
* `Klock`: `2.5.2` -> `2.6.2`
|
||||||
|
* `Core`:
|
||||||
|
* `SimplePollOption#votes` now is `0` by default
|
||||||
|
* New function `PollOption.Companion#simple`
|
||||||
|
|
||||||
|
## 0.38.6
|
||||||
|
|
||||||
|
* `Common`:
|
||||||
|
* `Version`:
|
||||||
|
* `MicroUtils`: `0.9.6` -> `0.9.9`
|
||||||
|
* `Klock`: `2.4.13` -> `2.5.2`
|
||||||
|
* `Core`:
|
||||||
|
* New member of `MentionTextSource` - `username`
|
||||||
|
|
||||||
|
## 0.38.5
|
||||||
|
|
||||||
|
* `Common`:
|
||||||
|
* `Version`:
|
||||||
|
* `MicroUtils`: `0.9.5` -> `0.9.6`
|
||||||
|
* `Core`:
|
||||||
|
* `Username` got new property `usernameWithoutAt` which will return `username` without leading `@`
|
||||||
|
* `Utils`:
|
||||||
|
* Several new functions for working with deep links:
|
||||||
|
* `makeUsernameDeepLinkPrefix`
|
||||||
|
* `makeTelegramDeepLink`
|
||||||
|
* `makeDeepLink`
|
||||||
|
|
||||||
|
## 0.38.4
|
||||||
|
|
||||||
|
__This update contains including of [Telegram Bot API 5.7](https://core.telegram.org/bots/api-changelog#january-31-2022)__
|
||||||
|
|
||||||
|
* `Core`:
|
||||||
|
* Support of new fields `Sticker`
|
||||||
|
* Support of new fields `StickerSet`
|
||||||
|
* Support of new fields in creating of sticker set and sticker
|
||||||
|
* `Utils`:
|
||||||
|
* Rename `PathedFile` to avoid clash with core file (fix of [#529](https://github.com/InsanusMokrassar/TelegramBotAPI/issues/529))
|
||||||
|
|
||||||
|
## 0.38.3
|
||||||
|
|
||||||
|
* `Common`:
|
||||||
|
* `Version`:
|
||||||
|
* `MicroUtils`: `0.9.1` -> `0.9.2`
|
||||||
|
* `Klock`: `2.4.10` -> `2.4.12`
|
||||||
|
* `UUID`: `0.3.1` -> `0.4.0`
|
||||||
|
* `API`
|
||||||
|
* New extensions `TelegramBot#send*` for media groups with contents
|
||||||
|
|
||||||
|
## 0.38.2
|
||||||
|
|
||||||
|
* `Common`:
|
||||||
|
* `Version`:
|
||||||
|
* `MicroUtils`: `0.9.0` -> `0.9.1`
|
||||||
|
* `API`
|
||||||
|
* New extensions `TelegramBot#copyMessages` for media groups
|
||||||
|
|
||||||
|
## 0.38.1
|
||||||
|
|
||||||
|
* `Core`:
|
||||||
|
* `MessageCallbackQuery` (and all implementers as well) has changed the type of `message`: now it is `ContentMessage<MessageContent>` instead of `Message`
|
||||||
|
* New type `ForwardFromPublicChatInfo` as extender of `ForwardInfo`:
|
||||||
|
* `ForwardFromChannelInfo` now extends `ForwardFromPublicChatInfo`
|
||||||
|
* `ForwardFromSupergroupInfo` now extends `ForwardFromPublicChatInfo`
|
||||||
|
* New type of events: `UserLoggedIn`
|
||||||
|
* `Utils`:
|
||||||
|
* ([#511](https://github.com/InsanusMokrassar/TelegramBotAPI/issues/511)) New extensions properties (raw fields as in original API) for several types have been added:
|
||||||
|
* `Message`
|
||||||
|
* `CallbackQuery`
|
||||||
|
* `ChosenInlineResult`
|
||||||
|
* `InlineQuery`
|
||||||
|
* `Poll`
|
||||||
|
|
||||||
|
## 0.38.0
|
||||||
|
|
||||||
|
_This update contains [Telegram Bot API 5.6](https://core.telegram.org/bots/api-changelog#december-30-2021) implementation_
|
||||||
|
|
||||||
|
_This update contains migration onto Kotlin 1.6_
|
||||||
|
|
||||||
|
_This update has changed constructors of all `CommonMessage` implementations_
|
||||||
|
|
||||||
|
|
||||||
|
* `Common`:
|
||||||
|
* `Version`:
|
||||||
|
* `Kotlin`: `1.5.31` -> `1.6.10`
|
||||||
|
* `Coroutines`: `1.5.2` -> `1.6.0`
|
||||||
|
* `Serialization`: `1.3.1` -> `1.3.2`
|
||||||
|
* `Klock`: `2.4.8` -> `2.4.10`
|
||||||
|
* `Ktor`: `1.6.5` -> `1.6.7`
|
||||||
|
* `MicroUtils`: `0.8.7` -> `0.9.0`
|
||||||
|
* `Core`:
|
||||||
|
* Add `SpoilerTextSource` (as part of `Telegram Bot API 5.6` update)
|
||||||
|
* Add support of `protect_content` as a field `protectContent` in all send message requests and parameter in all
|
||||||
|
functions related to that requests (as part of `Telegram Bot API 5.6` update)
|
||||||
|
* **ALL IMPLEMENTERS OF `CommonMessage` HAS CHANGED THEIR CONSTRUCTOR: NOW THEY GET `hasProtectedContent` instead of
|
||||||
|
`forwardable` (inversed) field**
|
||||||
|
* `ChannelContentMessageImpl`
|
||||||
|
* `ChannelMediaGroupMessage`
|
||||||
|
* `CommonMediaGroupMessage`
|
||||||
|
* `GroupContentMessage` implementers
|
||||||
|
* `ConnectedFromChannelGroupContentMessageImpl`
|
||||||
|
* `UnconnectedFromChannelGroupContentMessageImpl`
|
||||||
|
* `AnonymousGroupContentMessageImpl`
|
||||||
|
* `CommonGroupContentMessageImpl`
|
||||||
|
* `PrivateContentMessageImpl`
|
||||||
|
|
||||||
|
## 0.37.4
|
||||||
|
|
||||||
|
* `Common`:
|
||||||
|
* `Version`:
|
||||||
|
* `MicroUtils`: `0.8.7` -> `0.8.9`
|
||||||
|
* `Core`:
|
||||||
|
* New `SupergroupEvent` subtype: `MigratedToSupergroup`. This event is sent when a group is converted to a supergroup while bot is in the group.
|
||||||
|
* Helper extenstion functions on `ChatEvent` to cast it to `MigratedToSupergroup`.
|
||||||
|
|
||||||
|
## 0.37.3 Hotfix of 0.37.2
|
||||||
|
|
||||||
|
* `Core`:
|
||||||
|
* Fixes in hierarchy (and creating) of messages from channels
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
`0.37.2` changelog:
|
||||||
|
|
||||||
|
_This update contains [Telegram Bot API 5.5](https://core.telegram.org/bots/api-changelog#december-7-2021) implementation_
|
||||||
|
|
||||||
|
* `Common`:
|
||||||
|
* `Version`:
|
||||||
|
* `MicroUtils`: `0.8.2` -> `0.8.7`
|
||||||
|
* `Core`:
|
||||||
|
* New request type: `ChatSenderRequest`
|
||||||
|
* New request `BanChatSenderChat`
|
||||||
|
* New request `UnbanChatSenderChat`
|
||||||
|
* `ExtendedPrivateChat` got new properties: `hasPrivateForwards` and `allowCreateUserIdLink` (same as `hasPrivateForwards`)
|
||||||
|
* All `ContentMessage` got field `forwardable` (old constructors marked as `Deprecated`)
|
||||||
|
* `FromChannelGroupContentMessage` has been divided for two interfaces (and corresponding classes):
|
||||||
|
* `ConnectedFromChannelGroupContentMessage` (and `ConnectedFromChannelGroupContentMessageImpl`) for connected to the group channels messages
|
||||||
|
* `UnconnectedFromChannelGroupContentMessage` (and `UnconnectedFromChannelGroupContentMessageImpl`) for unconnected channels
|
||||||
|
* `API`:
|
||||||
|
* New extensions `TelegramBot#banChatSenderChat`
|
||||||
|
* New extensions `TelegramBot#unbanChatSenderChat`
|
||||||
|
* `Utils`:
|
||||||
|
* Fix of `EntitiesBuilder#linkln`
|
||||||
|
|
||||||
|
## 0.37.2 Telegram Bot API 5.5
|
||||||
|
|
||||||
|
* `Common`:
|
||||||
|
* `Version`:
|
||||||
|
* `MicroUtils`: `0.8.2` -> `0.8.7`
|
||||||
|
* `Core`:
|
||||||
|
* New request type: `ChatSenderRequest`
|
||||||
|
* New request `BanChatSenderChat`
|
||||||
|
* New request `UnbanChatSenderChat`
|
||||||
|
* `ExtendedPrivateChat` got new properties: `hasPrivateForwards` and `allowCreateUserIdLink` (same as `hasPrivateForwards`)
|
||||||
|
* All `ContentMessage` got field `forwardable` (old constructors marked as `Deprecated`)
|
||||||
|
* `ChannelContentMessage` has been divided for two interfaces (and corresponding classes):
|
||||||
|
* `ConnectedChannelContentMessage` (and `ConnectedChannelContentMessageImpl`) for connected to the group channels messages
|
||||||
|
* `UnconnectedChannelContentMessage` (and `UnconnectedChannelContentMessageImpl`) for unconnected channels
|
||||||
|
* `API`:
|
||||||
|
* New extensions `TelegramBot#banChatSenderChat`
|
||||||
|
* New extensions `TelegramBot#unbanChatSenderChat`
|
||||||
|
* `Utils`:
|
||||||
|
* Fix of `EntitiesBuilder#linkln`
|
||||||
|
|
||||||
|
## 0.37.1
|
||||||
|
|
||||||
|
* `Common`:
|
||||||
|
* `Version`:
|
||||||
|
* `Serialization`: `1.3.0` -> `1.3.1`
|
||||||
|
* `Klock`: `2.4.7` -> `2.4.8`
|
||||||
|
* `MicroUtils`: `0.8.1` -> `0.8.2`
|
||||||
|
|
||||||
|
## 0.37.0 Telegram Bot API 5.4
|
||||||
|
|
||||||
|
**ALL DEPRECATIONS WERE REMOVED**
|
||||||
|
|
||||||
* `Common`:
|
* `Common`:
|
||||||
* `Version`:
|
* `Version`:
|
||||||
* `Klock`: `2.4.6` -> `2.4.7`
|
* `Klock`: `2.4.6` -> `2.4.7`
|
||||||
* `Ktor`: `1.6.4` -> `1.6.5`
|
* `Ktor`: `1.6.4` -> `1.6.5`
|
||||||
* `MicroUtils`: `0.7.3` -> `0.7.5`
|
* `MicroUtils`: `0.7.3` -> `0.8.1`
|
||||||
|
* `Core`:
|
||||||
|
* Replacement of simple `CreateChatInviteLink` and `EditChatInviteLink` with several new:
|
||||||
|
* `CreateChatInviteLinkSimple`
|
||||||
|
* `CreateChatInviteLinkWithLimitedMembers`
|
||||||
|
* `CreateChatInviteLinkWithJoinRequest`
|
||||||
|
* `EditChatInviteLinkSimple`
|
||||||
|
* `EditChatInviteLinkWithLimitedMembers`
|
||||||
|
* `EditChatInviteLinkWithJoinRequest`
|
||||||
|
* New `BotAction`: `ChooseStickerAction`
|
||||||
|
* Now requester will throw exceptions related to responses decoding directly instead of wrapping in
|
||||||
|
`RequestException`
|
||||||
|
*
|
||||||
|
* `BehaviourBuilder FSM`:
|
||||||
|
* **Incompatible changes** (now generics are used in state machines)
|
||||||
|
* `strictlyOn` and `onStateOrSubstate` now are part of `BehaviourContextWithFSMBuilder`
|
||||||
|
|
||||||
## 0.36.1
|
## 0.36.1
|
||||||
|
|
||||||
|
|||||||
25
README.md
25
README.md
@@ -1,28 +1,11 @@
|
|||||||
[Participate in our common survey ☺](https://forms.gle/q6Xf8K3fD1pPsYUw9)
|
# TelegramBotAPI [](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi) [](https://core.telegram.org/bots/api-changelog#january-31-2022)
|
||||||
|
|
||||||
# TelegramBotAPI
|
| [](https://github.com/KotlinBy/awesome-kotlin) [](https://github.com/InsanusMokrassar/TelegramBotAPI/actions) [](https://forms.gle/2Hex2ynbHWHhi1KY7) [](https://t.me/InMoTelegramBotAPI) |
|
||||||
|
|:---:|
|
||||||
- [TelegramBotAPI](#telegrambotapi)
|
| [](https://github.com/InsanusMokrassar/TelegramBotAPI-bot_template/generate) [](https://github.com/InsanusMokrassar/TelegramBotAPI-examples/) [](https://tgbotapi.inmo.dev/index.html) [](https://bookstack.inmo.dev/books/telegrambotapi/chapter/introduction-tutorial) |
|
||||||
* [Examples](#examples)
|
|
||||||
+ [Most common example](#most-common-example)
|
|
||||||
+ [Handling only last messages](#handling-only-last-messages)
|
|
||||||
+ [Build a little bit more complex behaviour](#build-a-little-bit-more-complex-behaviour)
|
|
||||||
+ [More examples](#more-examples)
|
|
||||||
|
|
||||||
<small><i><a href='http://ecotrust-canada.github.io/markdown-toc/'>Table of contents generated with markdown-toc</a></i></small>
|
|
||||||
|
|
||||||
Hello! This is a set of libraries for working with Telegram Bot API.
|
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)|
|
|
||||||
| -------------------------------------:|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
||||||
| 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 API Extensions status | [](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi.api) |
|
|
||||||
| TelegramBotAPI Util Extensions status | [](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi.utils) |
|
|
||||||
| TelegramBotAPI Behaviour Builder Extensions status | [](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi.behaviour_builder) |
|
|
||||||
| TelegramBotAPI Behaviour Builder FSM Extensions status | [](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi.behaviour_builder.fsm) |
|
|
||||||
| TelegramBotAPI All status | [](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi) |
|
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
There are several things you need to do to launch examples below:
|
There are several things you need to do to launch examples below:
|
||||||
|
|||||||
@@ -23,7 +23,13 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
jvm()
|
jvm {
|
||||||
|
compilations.main {
|
||||||
|
kotlinOptions {
|
||||||
|
jvmTarget = "1.8"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
js(IR) {
|
js(IR) {
|
||||||
browser()
|
browser()
|
||||||
nodejs()
|
nodejs()
|
||||||
@@ -91,3 +97,8 @@ Object callback = {
|
|||||||
|
|
||||||
tasks.dokkaGfm(callback)
|
tasks.dokkaGfm(callback)
|
||||||
tasks.dokkaHtml(callback)
|
tasks.dokkaHtml(callback)
|
||||||
|
|
||||||
|
java {
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,3 +1 @@
|
|||||||
dokka_version=1.5.31
|
|
||||||
|
|
||||||
org.gradle.jvmargs=-Xmx1024m
|
org.gradle.jvmargs=-Xmx1024m
|
||||||
|
|||||||
@@ -5,18 +5,21 @@ kotlin.js.generate.externals=true
|
|||||||
kotlin.incremental=true
|
kotlin.incremental=true
|
||||||
kotlin.incremental.js=true
|
kotlin.incremental.js=true
|
||||||
|
|
||||||
kotlin_version=1.5.31
|
kotlin_version=1.6.10
|
||||||
kotlin_coroutines_version=1.5.2
|
kotlin_coroutines_version=1.6.0
|
||||||
kotlin_serialisation_runtime_version=1.3.0
|
kotlin_serialisation_runtime_version=1.3.2
|
||||||
klock_version=2.4.7
|
klock_version=2.6.2
|
||||||
uuid_version=0.3.1
|
uuid_version=0.4.0
|
||||||
ktor_version=1.6.5
|
ktor_version=1.6.7
|
||||||
|
|
||||||
micro_utils_version=0.7.5
|
micro_utils_version=0.9.12
|
||||||
|
|
||||||
javax_activation_version=1.1.1
|
javax_activation_version=1.1.1
|
||||||
|
|
||||||
|
|
||||||
|
dokka_version=1.6.10
|
||||||
|
|
||||||
library_group=dev.inmo
|
library_group=dev.inmo
|
||||||
library_version=0.36.2
|
library_version=0.38.7
|
||||||
|
|
||||||
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-7.2-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-bin.zip
|
||||||
|
|||||||
97
readmes/exceptions_handling.md
Normal file
97
readmes/exceptions_handling.md
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
# Exceptions handling
|
||||||
|
|
||||||
|
Unfortunatelly, exceptions handling in this library is a bit difficult in some places, but that have at least two reasons: flexibility and usability.
|
||||||
|
|
||||||
|
## "In place" handling
|
||||||
|
|
||||||
|
In case you know, where exceptions are happening, you may use several tools for exceptions catching:
|
||||||
|
|
||||||
|
* Catching with result
|
||||||
|
* Catching with callback
|
||||||
|
|
||||||
|
### Catching with result
|
||||||
|
|
||||||
|
If you prefer to receive `Result` objects instead of some weird callbacks, you may use the next syntax:
|
||||||
|
|
||||||
|
```kotlin
|
||||||
|
safelyWithResult {
|
||||||
|
// do something
|
||||||
|
}.onSuccess { // will be called if everything is right
|
||||||
|
// handle success
|
||||||
|
}.onFailure { // will be called if something went wrong
|
||||||
|
// handle error
|
||||||
|
it.printStackTrace()
|
||||||
|
}.getOrThrow() // will return value or throw exception
|
||||||
|
```
|
||||||
|
|
||||||
|
### Catching with callback
|
||||||
|
|
||||||
|
Also there is more simple (in some cases) way to handle exceptions with callbacks:
|
||||||
|
|
||||||
|
```kotlin
|
||||||
|
safely(
|
||||||
|
{
|
||||||
|
// handle error
|
||||||
|
it.printStackTrace()
|
||||||
|
null // return value
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
// do something
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Bonus: different types of handling
|
||||||
|
|
||||||
|
There are two types of handling:
|
||||||
|
|
||||||
|
* Just safely - when you are using something to obviously retrieve value or throw exception. When handling callback has been skipped, it will throw exception by default. For example:
|
||||||
|
```kotlin
|
||||||
|
safely(
|
||||||
|
{
|
||||||
|
it.printStackTrace()
|
||||||
|
"error"
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
error("Hi :)") // emulate exception throwing
|
||||||
|
"ok"
|
||||||
|
} // result will be with type String
|
||||||
|
```
|
||||||
|
* Safely without exceptions - almost the same as `safely`, but this type by default allow to return nullable value (when exception was thrown) instead of just throwing (as with `safely`):
|
||||||
|
```kotlin
|
||||||
|
safelyWithouExceptions {
|
||||||
|
// do something
|
||||||
|
} // will returns nullable result type
|
||||||
|
```
|
||||||
|
|
||||||
|
## Global exceptions handling
|
||||||
|
|
||||||
|
The most simple way to configure exceptions handling is to change `CoroutineContext` when you are creating your `CoroutineScope` for bot processing:
|
||||||
|
|
||||||
|
```kotlin
|
||||||
|
val bot = telegramBot("TOKEN")
|
||||||
|
|
||||||
|
bot.buildBehaviour (
|
||||||
|
scope = scope,
|
||||||
|
defaultExceptionsHandler = {
|
||||||
|
it.printStackTrace()
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
// ...
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
OR
|
||||||
|
|
||||||
|
```kotlin
|
||||||
|
val bot = telegramBotWithBehaviour (
|
||||||
|
"TOKEN",
|
||||||
|
scope = scope,
|
||||||
|
defaultExceptionsHandler = {
|
||||||
|
it.printStackTrace()
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
// ...
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Here we have used `ContextSafelyExceptionHandler` class. It will pass default handling of exceptions and will call the block in most cases when something inside of your bot logic has thrown exception.
|
||||||
@@ -26,7 +26,13 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
jvm()
|
jvm {
|
||||||
|
compilations.main {
|
||||||
|
kotlinOptions {
|
||||||
|
jvmTarget = "1.8"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
js(IR) {
|
js(IR) {
|
||||||
browser()
|
browser()
|
||||||
nodejs()
|
nodejs()
|
||||||
@@ -43,8 +49,7 @@ kotlin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
java {
|
java {
|
||||||
toolchain {
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||||
languageVersion = JavaLanguageVersion.of(8)
|
targetCompatibility = JavaVersion.VERSION_1_8
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
apply plugin: 'maven-publish'
|
apply plugin: 'maven-publish'
|
||||||
apply plugin: 'signing'
|
|
||||||
|
|
||||||
task javadocsJar(type: Jar) {
|
task javadocsJar(type: Jar) {
|
||||||
classifier = 'javadoc'
|
classifier = 'javadoc'
|
||||||
@@ -63,7 +62,18 @@ publishing {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
signing {
|
if (project.hasProperty("signing.gnupg.keyName")) {
|
||||||
useGpgCmd()
|
apply plugin: 'signing'
|
||||||
sign publishing.publications
|
|
||||||
|
signing {
|
||||||
|
useGpgCmd()
|
||||||
|
|
||||||
|
sign publishing.publications
|
||||||
|
}
|
||||||
|
|
||||||
|
task signAll {
|
||||||
|
tasks.withType(Sign).forEach {
|
||||||
|
dependsOn(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE"}],"mavenConfig":{"name":"Telegram Bot API Extensions for API","description":"API extensions which provide work with RequestsExecutor of TelegramBotAPI almost like it is described in original Telegram Bot API reference","url":"https://insanusmokrassar.github.io/TelegramBotAPI/TelegramBotAPI-extensions-api","vcsUrl":"https://github.com/insanusmokrassar/TelegramBotAPI.git","includeGpgSigning":true,"developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}],"repositories":[{"name":"GithubPackages","url":"https://maven.pkg.github.com/InsanusMokrassar/TelegramBotAPI"},{"name":"sonatype","url":"https://oss.sonatype.org/service/local/staging/deploy/maven2/"}]}}
|
{"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE"}],"mavenConfig":{"name":"Telegram Bot API Extensions for API","description":"API extensions which provide work with RequestsExecutor of TelegramBotAPI almost like it is described in original Telegram Bot API reference","url":"https://insanusmokrassar.github.io/TelegramBotAPI/TelegramBotAPI-extensions-api","vcsUrl":"https://github.com/insanusmokrassar/TelegramBotAPI.git","developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}],"repositories":[{"name":"GithubPackages","url":"https://maven.pkg.github.com/InsanusMokrassar/TelegramBotAPI"},{"name":"sonatype","url":"https://oss.sonatype.org/service/local/staging/deploy/maven2/"}],"gpgSigning":{"type":"dev.inmo.kmppscriptbuilder.core.models.GpgSigning.Optional"}}}
|
||||||
@@ -11,40 +11,46 @@ suspend fun TelegramBot.forwardMessage(
|
|||||||
fromChatId: ChatIdentifier,
|
fromChatId: ChatIdentifier,
|
||||||
toChatId: ChatIdentifier,
|
toChatId: ChatIdentifier,
|
||||||
messageId: MessageIdentifier,
|
messageId: MessageIdentifier,
|
||||||
disableNotification: Boolean = false
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false
|
||||||
) = execute(
|
) = execute(
|
||||||
ForwardMessage(fromChatId, toChatId, messageId, disableNotification)
|
ForwardMessage(fromChatId, toChatId, messageId, disableNotification, protectContent)
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun TelegramBot.forwardMessage(
|
suspend fun TelegramBot.forwardMessage(
|
||||||
fromChat: Chat,
|
fromChat: Chat,
|
||||||
toChatId: ChatIdentifier,
|
toChatId: ChatIdentifier,
|
||||||
messageId: MessageIdentifier,
|
messageId: MessageIdentifier,
|
||||||
disableNotification: Boolean = false
|
disableNotification: Boolean = false,
|
||||||
) = forwardMessage(fromChat.id, toChatId, messageId, disableNotification)
|
protectContent: Boolean = false
|
||||||
|
) = forwardMessage(fromChat.id, toChatId, messageId, disableNotification, protectContent)
|
||||||
|
|
||||||
suspend fun TelegramBot.forwardMessage(
|
suspend fun TelegramBot.forwardMessage(
|
||||||
fromChatId: ChatIdentifier,
|
fromChatId: ChatIdentifier,
|
||||||
toChat: Chat,
|
toChat: Chat,
|
||||||
messageId: MessageIdentifier,
|
messageId: MessageIdentifier,
|
||||||
disableNotification: Boolean = false
|
disableNotification: Boolean = false,
|
||||||
) = forwardMessage(fromChatId, toChat.id, messageId, disableNotification)
|
protectContent: Boolean = false
|
||||||
|
) = forwardMessage(fromChatId, toChat.id, messageId, disableNotification, protectContent)
|
||||||
|
|
||||||
suspend fun TelegramBot.forwardMessage(
|
suspend fun TelegramBot.forwardMessage(
|
||||||
fromChat: Chat,
|
fromChat: Chat,
|
||||||
toChat: Chat,
|
toChat: Chat,
|
||||||
messageId: MessageIdentifier,
|
messageId: MessageIdentifier,
|
||||||
disableNotification: Boolean = false
|
disableNotification: Boolean = false,
|
||||||
) = forwardMessage(fromChat.id, toChat.id, messageId, disableNotification)
|
protectContent: Boolean = false
|
||||||
|
) = forwardMessage(fromChat.id, toChat.id, messageId, disableNotification, protectContent)
|
||||||
|
|
||||||
suspend fun TelegramBot.forwardMessage(
|
suspend fun TelegramBot.forwardMessage(
|
||||||
toChatId: ChatIdentifier,
|
toChatId: ChatIdentifier,
|
||||||
message: Message,
|
message: Message,
|
||||||
disableNotification: Boolean = false
|
disableNotification: Boolean = false,
|
||||||
) = forwardMessage(message.chat, toChatId, message.messageId, disableNotification)
|
protectContent: Boolean = false
|
||||||
|
) = forwardMessage(message.chat, toChatId, message.messageId, disableNotification, protectContent)
|
||||||
|
|
||||||
suspend fun TelegramBot.forwardMessage(
|
suspend fun TelegramBot.forwardMessage(
|
||||||
toChat: Chat,
|
toChat: Chat,
|
||||||
message: Message,
|
message: Message,
|
||||||
disableNotification: Boolean = false
|
disableNotification: Boolean = false,
|
||||||
) = forwardMessage(message.chat, toChat, message.messageId, disableNotification)
|
protectContent: Boolean = false
|
||||||
|
) = forwardMessage(message.chat, toChat, message.messageId, disableNotification, protectContent)
|
||||||
|
|||||||
@@ -91,6 +91,7 @@ suspend fun TelegramBot.startLiveLocation(
|
|||||||
initHeading: Degrees? = null,
|
initHeading: Degrees? = null,
|
||||||
initProximityAlertRadius: Meters? = null,
|
initProximityAlertRadius: Meters? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
@@ -106,6 +107,7 @@ suspend fun TelegramBot.startLiveLocation(
|
|||||||
initHeading,
|
initHeading,
|
||||||
initProximityAlertRadius,
|
initProximityAlertRadius,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
allowSendingWithoutReply,
|
allowSendingWithoutReply,
|
||||||
replyMarkup
|
replyMarkup
|
||||||
@@ -134,6 +136,7 @@ suspend fun TelegramBot.startLiveLocation(
|
|||||||
initHeading: Degrees? = null,
|
initHeading: Degrees? = null,
|
||||||
initProximityAlertRadius: Meters? = null,
|
initProximityAlertRadius: Meters? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
@@ -147,6 +150,7 @@ suspend fun TelegramBot.startLiveLocation(
|
|||||||
initHeading,
|
initHeading,
|
||||||
initProximityAlertRadius,
|
initProximityAlertRadius,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
allowSendingWithoutReply,
|
allowSendingWithoutReply,
|
||||||
replyMarkup
|
replyMarkup
|
||||||
@@ -165,6 +169,7 @@ suspend fun TelegramBot.startLiveLocation(
|
|||||||
initHeading: Degrees? = null,
|
initHeading: Degrees? = null,
|
||||||
initProximityAlertRadius: Meters? = null,
|
initProximityAlertRadius: Meters? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
@@ -178,6 +183,7 @@ suspend fun TelegramBot.startLiveLocation(
|
|||||||
initHeading,
|
initHeading,
|
||||||
initProximityAlertRadius,
|
initProximityAlertRadius,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
allowSendingWithoutReply,
|
allowSendingWithoutReply,
|
||||||
replyMarkup
|
replyMarkup
|
||||||
@@ -196,6 +202,7 @@ suspend fun TelegramBot.startLiveLocation(
|
|||||||
initHeading: Degrees? = null,
|
initHeading: Degrees? = null,
|
||||||
initProximityAlertRadius: Meters? = null,
|
initProximityAlertRadius: Meters? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
@@ -209,6 +216,7 @@ suspend fun TelegramBot.startLiveLocation(
|
|||||||
initHeading,
|
initHeading,
|
||||||
initProximityAlertRadius,
|
initProximityAlertRadius,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
allowSendingWithoutReply,
|
allowSendingWithoutReply,
|
||||||
replyMarkup
|
replyMarkup
|
||||||
@@ -228,6 +236,7 @@ suspend inline fun TelegramBot.replyWithLiveLocation(
|
|||||||
initHeading: Degrees? = null,
|
initHeading: Degrees? = null,
|
||||||
initProximityAlertRadius: Meters? = null,
|
initProximityAlertRadius: Meters? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = startLiveLocation(
|
) = startLiveLocation(
|
||||||
@@ -240,6 +249,7 @@ suspend inline fun TelegramBot.replyWithLiveLocation(
|
|||||||
initHeading,
|
initHeading,
|
||||||
initProximityAlertRadius,
|
initProximityAlertRadius,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
to.messageId,
|
to.messageId,
|
||||||
allowSendingWithoutReply,
|
allowSendingWithoutReply,
|
||||||
replyMarkup
|
replyMarkup
|
||||||
@@ -258,6 +268,7 @@ suspend inline fun TelegramBot.replyWithLiveLocation(
|
|||||||
initHeading: Degrees? = null,
|
initHeading: Degrees? = null,
|
||||||
initProximityAlertRadius: Meters? = null,
|
initProximityAlertRadius: Meters? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = startLiveLocation(
|
) = startLiveLocation(
|
||||||
@@ -269,6 +280,7 @@ suspend inline fun TelegramBot.replyWithLiveLocation(
|
|||||||
initHeading,
|
initHeading,
|
||||||
initProximityAlertRadius,
|
initProximityAlertRadius,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
to.messageId,
|
to.messageId,
|
||||||
allowSendingWithoutReply,
|
allowSendingWithoutReply,
|
||||||
replyMarkup
|
replyMarkup
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api.chat.invite_links
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.requests.chat.invite_links.ApproveChatJoinRequest
|
||||||
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import dev.inmo.tgbotapi.types.chat.abstracts.PublicChat
|
||||||
|
import dev.inmo.tgbotapi.types.update.ChatJoinRequestUpdate
|
||||||
|
|
||||||
|
suspend fun TelegramBot.approveChatJoinRequest(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
userId: UserId
|
||||||
|
) = execute(ApproveChatJoinRequest(chatId, userId))
|
||||||
|
|
||||||
|
suspend fun TelegramBot.approveChatJoinRequest(
|
||||||
|
chat: PublicChat,
|
||||||
|
userId: UserId
|
||||||
|
) = approveChatJoinRequest(chat.id, userId)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.approveChatJoinRequest(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
user: User
|
||||||
|
) = approveChatJoinRequest(chatId, user.id)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.approveChatJoinRequest(
|
||||||
|
chat: PublicChat,
|
||||||
|
user: User
|
||||||
|
) = approveChatJoinRequest(chat.id, user.id)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.approveChatJoinRequest(
|
||||||
|
chatJoinRequest: ChatJoinRequest
|
||||||
|
) = approveChatJoinRequest(chatJoinRequest.chat, chatJoinRequest.user)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.approve(
|
||||||
|
chatJoinRequest: ChatJoinRequest
|
||||||
|
) = approveChatJoinRequest(chatJoinRequest)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.approveChatJoinRequest(
|
||||||
|
chatJoinRequestUpdate: ChatJoinRequestUpdate
|
||||||
|
) = approveChatJoinRequest(chatJoinRequestUpdate.data)
|
||||||
@@ -6,26 +6,78 @@ import dev.inmo.tgbotapi.requests.chat.invite_links.CreateChatInviteLink
|
|||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.chat.abstracts.PublicChat
|
import dev.inmo.tgbotapi.types.chat.abstracts.PublicChat
|
||||||
|
|
||||||
suspend fun TelegramBot.createChatInviteLink(
|
suspend fun TelegramBot.createChatInviteLinkUnlimited(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
expiration: TelegramDate? = null,
|
name: String? = null,
|
||||||
membersLimit: MembersLimit? = null
|
expiration: TelegramDate? = null
|
||||||
) = execute(CreateChatInviteLink(chatId, expiration, membersLimit))
|
) = execute(CreateChatInviteLink.unlimited(chatId, name, expiration))
|
||||||
|
|
||||||
suspend fun TelegramBot.createChatInviteLink(
|
suspend fun TelegramBot.createChatInviteLinkUnlimited(
|
||||||
chat: PublicChat,
|
chat: PublicChat,
|
||||||
|
name: String? = null,
|
||||||
expiration: TelegramDate? = null,
|
expiration: TelegramDate? = null,
|
||||||
membersLimit: MembersLimit? = null
|
) = createChatInviteLinkUnlimited(chat.id, name, expiration)
|
||||||
) = createChatInviteLink(chat.id, expiration, membersLimit)
|
|
||||||
|
|
||||||
suspend fun TelegramBot.createChatInviteLink(
|
suspend fun TelegramBot.createChatInviteLinkUnlimited(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
expiration: DateTime,
|
expiration: DateTime,
|
||||||
membersLimit: MembersLimit? = null
|
name: String? = null,
|
||||||
) = createChatInviteLink(chatId, expiration.toTelegramDate(), membersLimit)
|
) = createChatInviteLinkUnlimited(chatId, name, expiration.toTelegramDate())
|
||||||
|
|
||||||
suspend fun TelegramBot.createChatInviteLink(
|
suspend fun TelegramBot.createChatInviteLinkUnlimited(
|
||||||
chat: PublicChat,
|
chat: PublicChat,
|
||||||
expiration: DateTime,
|
expiration: DateTime,
|
||||||
membersLimit: MembersLimit? = null
|
name: String? = null
|
||||||
) = createChatInviteLink(chat.id, expiration.toTelegramDate(), membersLimit)
|
) = createChatInviteLinkUnlimited(chat.id, name, expiration.toTelegramDate())
|
||||||
|
|
||||||
|
suspend fun TelegramBot.createChatInviteLinkWithLimitedMembers(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
membersLimit: MembersLimit,
|
||||||
|
name: String? = null,
|
||||||
|
expiration: TelegramDate? = null
|
||||||
|
) = execute(CreateChatInviteLink.withLimitedMembers(chatId, membersLimit, name, expiration))
|
||||||
|
|
||||||
|
suspend fun TelegramBot.createChatInviteLinkWithLimitedMembers(
|
||||||
|
chat: PublicChat,
|
||||||
|
membersLimit: MembersLimit,
|
||||||
|
name: String? = null,
|
||||||
|
expiration: TelegramDate? = null,
|
||||||
|
) = createChatInviteLinkWithLimitedMembers(chat.id, membersLimit, name, expiration)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.createChatInviteLinkWithLimitedMembers(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
membersLimit: MembersLimit,
|
||||||
|
expiration: DateTime,
|
||||||
|
name: String? = null,
|
||||||
|
) = createChatInviteLinkWithLimitedMembers(chatId, membersLimit, name, expiration.toTelegramDate())
|
||||||
|
|
||||||
|
suspend fun TelegramBot.createChatInviteLinkWithLimitedMembers(
|
||||||
|
chat: PublicChat,
|
||||||
|
membersLimit: MembersLimit,
|
||||||
|
expiration: DateTime,
|
||||||
|
name: String? = null,
|
||||||
|
) = createChatInviteLinkWithLimitedMembers(chat.id, membersLimit, name, expiration.toTelegramDate())
|
||||||
|
|
||||||
|
suspend fun TelegramBot.createChatInviteLinkWithJoinRequest(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
name: String? = null,
|
||||||
|
expiration: TelegramDate? = null
|
||||||
|
) = execute(CreateChatInviteLink.withJoinRequest(chatId, name, expiration))
|
||||||
|
|
||||||
|
suspend fun TelegramBot.createChatInviteLinkWithJoinRequest(
|
||||||
|
chat: PublicChat,
|
||||||
|
name: String? = null,
|
||||||
|
expiration: TelegramDate? = null,
|
||||||
|
) = createChatInviteLinkWithJoinRequest(chat.id, name, expiration)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.createChatInviteLinkWithJoinRequest(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
expiration: DateTime,
|
||||||
|
name: String? = null,
|
||||||
|
) = createChatInviteLinkWithJoinRequest(chatId, name, expiration.toTelegramDate())
|
||||||
|
|
||||||
|
suspend fun TelegramBot.createChatInviteLinkWithJoinRequest(
|
||||||
|
chat: PublicChat,
|
||||||
|
expiration: DateTime,
|
||||||
|
name: String? = null,
|
||||||
|
) = createChatInviteLinkWithJoinRequest(chat.id, name, expiration.toTelegramDate())
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api.chat.invite_links
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.requests.chat.invite_links.ApproveChatJoinRequest
|
||||||
|
import dev.inmo.tgbotapi.requests.chat.invite_links.DeclineChatJoinRequest
|
||||||
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import dev.inmo.tgbotapi.types.chat.abstracts.PublicChat
|
||||||
|
import dev.inmo.tgbotapi.types.update.ChatJoinRequestUpdate
|
||||||
|
|
||||||
|
suspend fun TelegramBot.declineChatJoinRequest(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
userId: UserId
|
||||||
|
) = execute(DeclineChatJoinRequest(chatId, userId))
|
||||||
|
|
||||||
|
suspend fun TelegramBot.declineChatJoinRequest(
|
||||||
|
chat: PublicChat,
|
||||||
|
userId: UserId
|
||||||
|
) = declineChatJoinRequest(chat.id, userId)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.declineChatJoinRequest(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
user: User
|
||||||
|
) = declineChatJoinRequest(chatId, user.id)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.declineChatJoinRequest(
|
||||||
|
chat: PublicChat,
|
||||||
|
user: User
|
||||||
|
) = declineChatJoinRequest(chat.id, user.id)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.declineChatJoinRequest(
|
||||||
|
chatJoinRequest: ChatJoinRequest
|
||||||
|
) = declineChatJoinRequest(chatJoinRequest.chat, chatJoinRequest.user)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.decline(
|
||||||
|
chatJoinRequest: ChatJoinRequest
|
||||||
|
) = declineChatJoinRequest(chatJoinRequest)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.declineChatJoinRequest(
|
||||||
|
chatJoinRequestUpdate: ChatJoinRequestUpdate
|
||||||
|
) = declineChatJoinRequest(chatJoinRequestUpdate.data)
|
||||||
@@ -6,58 +6,178 @@ import dev.inmo.tgbotapi.requests.chat.invite_links.EditChatInviteLink
|
|||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.chat.abstracts.PublicChat
|
import dev.inmo.tgbotapi.types.chat.abstracts.PublicChat
|
||||||
|
|
||||||
suspend fun TelegramBot.editChatInviteLink(
|
suspend fun TelegramBot.editChatInviteLinkUnlimited(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
previousLink: String,
|
previousLink: String,
|
||||||
expiration: TelegramDate? = null,
|
name: String? = null,
|
||||||
membersLimit: MembersLimit? = null
|
expiration: TelegramDate? = null
|
||||||
) = execute(EditChatInviteLink(chatId, previousLink, expiration, membersLimit))
|
) = execute(EditChatInviteLink.unlimited(chatId, previousLink, name, expiration))
|
||||||
|
|
||||||
suspend fun TelegramBot.editChatInviteLink(
|
suspend fun TelegramBot.editChatInviteLinkUnlimited(
|
||||||
chat: PublicChat,
|
chat: PublicChat,
|
||||||
previousLink: String,
|
previousLink: String,
|
||||||
|
name: String? = null,
|
||||||
expiration: TelegramDate? = null,
|
expiration: TelegramDate? = null,
|
||||||
membersLimit: MembersLimit? = null
|
) = editChatInviteLinkUnlimited(chat.id, previousLink, name, expiration)
|
||||||
) = editChatInviteLink(chat.id, previousLink, expiration, membersLimit)
|
|
||||||
|
|
||||||
suspend fun TelegramBot.editChatInviteLink(
|
suspend fun TelegramBot.editChatInviteLinkUnlimited(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
previousLink: String,
|
previousLink: String,
|
||||||
expiration: DateTime,
|
expiration: DateTime,
|
||||||
membersLimit: MembersLimit? = null
|
name: String? = null,
|
||||||
) = editChatInviteLink(chatId, previousLink, expiration.toTelegramDate(), membersLimit)
|
) = editChatInviteLinkUnlimited(chatId, previousLink, name , expiration.toTelegramDate())
|
||||||
|
|
||||||
suspend fun TelegramBot.editChatInviteLink(
|
suspend fun TelegramBot.editChatInviteLinkUnlimited(
|
||||||
chat: PublicChat,
|
chat: PublicChat,
|
||||||
previousLink: String,
|
previousLink: String,
|
||||||
expiration: DateTime,
|
expiration: DateTime,
|
||||||
membersLimit: MembersLimit? = null
|
name: String? = null,
|
||||||
) = editChatInviteLink(chat.id, previousLink, expiration.toTelegramDate(), membersLimit)
|
) = editChatInviteLinkUnlimited(chat.id, previousLink, name , expiration.toTelegramDate())
|
||||||
|
|
||||||
suspend fun TelegramBot.editChatInviteLink(
|
suspend fun TelegramBot.editChatInviteLinkWithLimitedMembers(
|
||||||
chat: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
previousLink: ChatInviteLink,
|
previousLink: String,
|
||||||
expiration: TelegramDate? = previousLink.expirationDateTime ?.toTelegramDate(),
|
membersLimit: MembersLimit,
|
||||||
membersLimit: MembersLimit? = previousLink.membersLimit
|
name: String? = null,
|
||||||
) = editChatInviteLink(chat, previousLink.inviteLink, expiration, membersLimit)
|
expiration: TelegramDate? = null
|
||||||
|
) = execute(EditChatInviteLink.withLimitedMembers(chatId, previousLink, membersLimit, name, expiration))
|
||||||
|
|
||||||
suspend fun TelegramBot.editChatInviteLink(
|
suspend fun TelegramBot.editChatInviteLinkWithLimitedMembers(
|
||||||
chat: ChatIdentifier,
|
chat: PublicChat,
|
||||||
previousLink: ChatInviteLink,
|
previousLink: String,
|
||||||
|
membersLimit: MembersLimit,
|
||||||
|
name: String? = null,
|
||||||
|
expiration: TelegramDate? = null,
|
||||||
|
) = editChatInviteLinkWithLimitedMembers(chat.id, previousLink, membersLimit, name, expiration)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.editChatInviteLinkWithLimitedMembers(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
previousLink: String,
|
||||||
|
membersLimit: MembersLimit,
|
||||||
expiration: DateTime,
|
expiration: DateTime,
|
||||||
membersLimit: MembersLimit? = previousLink.membersLimit
|
name: String? = null,
|
||||||
) = editChatInviteLink(chat, previousLink.inviteLink, expiration, membersLimit)
|
) = editChatInviteLinkWithLimitedMembers(chatId, previousLink, membersLimit, name , expiration.toTelegramDate())
|
||||||
|
|
||||||
suspend fun TelegramBot.editChatInviteLink(
|
suspend fun TelegramBot.editChatInviteLinkWithLimitedMembers(
|
||||||
|
chat: PublicChat,
|
||||||
|
previousLink: String,
|
||||||
|
membersLimit: MembersLimit,
|
||||||
|
expiration: DateTime,
|
||||||
|
name: String? = null,
|
||||||
|
) = editChatInviteLinkWithLimitedMembers(chat.id, previousLink, membersLimit, name , expiration.toTelegramDate())
|
||||||
|
|
||||||
|
suspend fun TelegramBot.editChatInviteLinkWithJoinRequest(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
previousLink: String,
|
||||||
|
name: String? = null,
|
||||||
|
expiration: TelegramDate? = null
|
||||||
|
) = execute(EditChatInviteLink.withJoinRequest(chatId, previousLink, name, expiration))
|
||||||
|
|
||||||
|
suspend fun TelegramBot.editChatInviteLinkWithJoinRequest(
|
||||||
|
chat: PublicChat,
|
||||||
|
previousLink: String,
|
||||||
|
name: String? = null,
|
||||||
|
expiration: TelegramDate? = null,
|
||||||
|
) = editChatInviteLinkWithJoinRequest(chat.id, previousLink, name, expiration)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.editChatInviteLinkWithJoinRequest(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
previousLink: String,
|
||||||
|
expiration: DateTime,
|
||||||
|
name: String? = null,
|
||||||
|
) = editChatInviteLinkWithJoinRequest(chatId, previousLink, name , expiration.toTelegramDate())
|
||||||
|
|
||||||
|
suspend fun TelegramBot.editChatInviteLinkWithJoinRequest(
|
||||||
|
chat: PublicChat,
|
||||||
|
previousLink: String,
|
||||||
|
expiration: DateTime,
|
||||||
|
name: String? = null,
|
||||||
|
) = editChatInviteLinkWithJoinRequest(chat.id, previousLink, name , expiration.toTelegramDate())
|
||||||
|
|
||||||
|
suspend fun TelegramBot.editChatInviteLinkUnlimited(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
previousLink: ChatInviteLink,
|
||||||
|
name: String? = null,
|
||||||
|
expiration: TelegramDate? = null
|
||||||
|
) = editChatInviteLinkUnlimited(chatId, previousLink.inviteLink, name, expiration)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.editChatInviteLinkUnlimited(
|
||||||
chat: PublicChat,
|
chat: PublicChat,
|
||||||
previousLink: ChatInviteLink,
|
previousLink: ChatInviteLink,
|
||||||
expiration: TelegramDate? = previousLink.expirationDateTime ?.toTelegramDate(),
|
name: String? = null,
|
||||||
membersLimit: MembersLimit? = previousLink.membersLimit
|
expiration: TelegramDate? = null,
|
||||||
) = editChatInviteLink(chat, previousLink.inviteLink, expiration, membersLimit)
|
) = editChatInviteLinkUnlimited(chat.id, previousLink, name, expiration)
|
||||||
|
|
||||||
suspend fun TelegramBot.editChatInviteLink(
|
suspend fun TelegramBot.editChatInviteLinkUnlimited(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
previousLink: ChatInviteLink,
|
||||||
|
expiration: DateTime,
|
||||||
|
name: String? = null,
|
||||||
|
) = editChatInviteLinkUnlimited(chatId, previousLink, name, expiration.toTelegramDate())
|
||||||
|
|
||||||
|
suspend fun TelegramBot.editChatInviteLinkUnlimited(
|
||||||
chat: PublicChat,
|
chat: PublicChat,
|
||||||
previousLink: ChatInviteLink,
|
previousLink: ChatInviteLink,
|
||||||
expiration: DateTime,
|
expiration: DateTime,
|
||||||
membersLimit: MembersLimit? = previousLink.membersLimit
|
name: String? = null,
|
||||||
) = editChatInviteLink(chat, previousLink.inviteLink, expiration, membersLimit)
|
) = editChatInviteLinkUnlimited(chat.id, previousLink, name , expiration.toTelegramDate())
|
||||||
|
|
||||||
|
suspend fun TelegramBot.editChatInviteLinkWithLimitedMembers(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
previousLink: ChatInviteLink,
|
||||||
|
membersLimit: MembersLimit,
|
||||||
|
name: String? = null,
|
||||||
|
expiration: TelegramDate? = null
|
||||||
|
) = editChatInviteLinkWithLimitedMembers(chatId, previousLink.inviteLink, membersLimit, name, expiration)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.editChatInviteLinkWithLimitedMembers(
|
||||||
|
chat: PublicChat,
|
||||||
|
previousLink: ChatInviteLink,
|
||||||
|
membersLimit: MembersLimit,
|
||||||
|
name: String? = null,
|
||||||
|
expiration: TelegramDate? = null,
|
||||||
|
) = editChatInviteLinkWithLimitedMembers(chat.id, previousLink, membersLimit, name, expiration)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.editChatInviteLinkWithLimitedMembers(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
previousLink: ChatInviteLink,
|
||||||
|
membersLimit: MembersLimit,
|
||||||
|
expiration: DateTime,
|
||||||
|
name: String? = null,
|
||||||
|
) = editChatInviteLinkWithLimitedMembers(chatId, previousLink, membersLimit, name , expiration.toTelegramDate())
|
||||||
|
|
||||||
|
suspend fun TelegramBot.editChatInviteLinkWithLimitedMembers(
|
||||||
|
chat: PublicChat,
|
||||||
|
previousLink: ChatInviteLink,
|
||||||
|
membersLimit: MembersLimit,
|
||||||
|
expiration: DateTime,
|
||||||
|
name: String? = null,
|
||||||
|
) = editChatInviteLinkWithLimitedMembers(chat.id, previousLink, membersLimit, name , expiration.toTelegramDate())
|
||||||
|
|
||||||
|
suspend fun TelegramBot.editChatInviteLinkWithJoinRequest(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
previousLink: ChatInviteLink,
|
||||||
|
name: String? = null,
|
||||||
|
expiration: TelegramDate? = null
|
||||||
|
) = editChatInviteLinkWithJoinRequest(chatId, previousLink.inviteLink, name, expiration)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.editChatInviteLinkWithJoinRequest(
|
||||||
|
chat: PublicChat,
|
||||||
|
previousLink: ChatInviteLink,
|
||||||
|
name: String? = null,
|
||||||
|
expiration: TelegramDate? = null,
|
||||||
|
) = editChatInviteLinkWithJoinRequest(chat.id, previousLink, name, expiration)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.editChatInviteLinkWithJoinRequest(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
previousLink: ChatInviteLink,
|
||||||
|
expiration: DateTime,
|
||||||
|
name: String? = null,
|
||||||
|
) = editChatInviteLinkWithJoinRequest(chatId, previousLink, name , expiration.toTelegramDate())
|
||||||
|
|
||||||
|
suspend fun TelegramBot.editChatInviteLinkWithJoinRequest(
|
||||||
|
chat: PublicChat,
|
||||||
|
previousLink: ChatInviteLink,
|
||||||
|
expiration: DateTime,
|
||||||
|
name: String? = null,
|
||||||
|
) = editChatInviteLinkWithJoinRequest(chat.id, previousLink, name , expiration.toTelegramDate())
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api.chat.members
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.requests.chat.members.BanChatMember
|
||||||
|
import dev.inmo.tgbotapi.requests.chat.members.BanChatSenderChat
|
||||||
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import dev.inmo.tgbotapi.types.chat.abstracts.PublicChat
|
||||||
|
|
||||||
|
suspend fun TelegramBot.banChatSenderChat(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
senderChatId: ChatId
|
||||||
|
) = execute(BanChatSenderChat(chatId, senderChatId))
|
||||||
|
|
||||||
|
suspend fun TelegramBot.banChatSenderChat(
|
||||||
|
chat: PublicChat,
|
||||||
|
senderChatId: ChatId
|
||||||
|
) = banChatSenderChat(chat.id, senderChatId)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.banChatSenderChat(
|
||||||
|
chatId: ChatId,
|
||||||
|
senderChat: PublicChat
|
||||||
|
) = banChatSenderChat(chatId, senderChat.id)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.banChatSenderChat(
|
||||||
|
chat: PublicChat,
|
||||||
|
senderChat: PublicChat,
|
||||||
|
) = banChatSenderChat(chat.id, senderChat)
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api.chat.members
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.requests.chat.members.*
|
||||||
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import dev.inmo.tgbotapi.types.chat.abstracts.PublicChat
|
||||||
|
|
||||||
|
suspend fun TelegramBot.unbanChatSenderChat(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
senderChatId: ChatId
|
||||||
|
) = execute(UnbanChatSenderChat(chatId, senderChatId))
|
||||||
|
|
||||||
|
suspend fun TelegramBot.unbanChatSenderChat(
|
||||||
|
chat: PublicChat,
|
||||||
|
senderChatId: ChatId
|
||||||
|
) = unbanChatSenderChat(chat.id, senderChatId)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.unbanChatSenderChat(
|
||||||
|
chatId: ChatId,
|
||||||
|
senderChat: PublicChat
|
||||||
|
) = unbanChatSenderChat(chatId, senderChat.id)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.unbanChatSenderChat(
|
||||||
|
chat: PublicChat,
|
||||||
|
senderChat: PublicChat,
|
||||||
|
) = unbanChatSenderChat(chat.id, senderChat)
|
||||||
@@ -2,7 +2,7 @@ package dev.inmo.tgbotapi.extensions.api.get
|
|||||||
|
|
||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.get.GetStickerSet
|
import dev.inmo.tgbotapi.requests.get.GetStickerSet
|
||||||
import dev.inmo.tgbotapi.types.files.Sticker
|
import dev.inmo.tgbotapi.types.files.sticker.Sticker
|
||||||
|
|
||||||
suspend fun TelegramBot.getStickerSet(
|
suspend fun TelegramBot.getStickerSet(
|
||||||
name: String
|
name: String
|
||||||
|
|||||||
@@ -21,11 +21,12 @@ suspend inline fun TelegramBot.copyMessage(
|
|||||||
text: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
CopyMessage(fromChatId, toChatId, messageId, text, parseMode, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
CopyMessage(fromChatId, toChatId, messageId, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -39,10 +40,11 @@ suspend inline fun TelegramBot.copyMessage(
|
|||||||
text: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = copyMessage(fromChat.id, toChatId, messageId, text, parseMode, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = copyMessage(fromChat.id, toChatId, messageId, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
@@ -55,10 +57,11 @@ suspend inline fun TelegramBot.copyMessage(
|
|||||||
text: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = copyMessage(fromChatId, toChat.id, messageId, text, parseMode, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = copyMessage(fromChatId, toChat.id, messageId, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
@@ -71,10 +74,11 @@ suspend inline fun TelegramBot.copyMessage(
|
|||||||
text: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = copyMessage(fromChat.id, toChat.id, messageId, text, parseMode, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = copyMessage(fromChat.id, toChat.id, messageId, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
@@ -86,10 +90,11 @@ suspend inline fun TelegramBot.copyMessage(
|
|||||||
text: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = copyMessage(message.chat, toChatId, message.messageId, text, parseMode, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = copyMessage(message.chat, toChatId, message.messageId, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
@@ -101,10 +106,11 @@ suspend inline fun TelegramBot.copyMessage(
|
|||||||
text: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = copyMessage(message.chat, toChat, message.messageId, text, parseMode, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = copyMessage(message.chat, toChat, message.messageId, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -117,11 +123,12 @@ suspend inline fun TelegramBot.copyMessage(
|
|||||||
messageId: MessageIdentifier,
|
messageId: MessageIdentifier,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
CopyMessage(fromChatId, toChatId, messageId, entities, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
CopyMessage(fromChatId, toChatId, messageId, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -134,10 +141,11 @@ suspend inline fun TelegramBot.copyMessage(
|
|||||||
messageId: MessageIdentifier,
|
messageId: MessageIdentifier,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = copyMessage(fromChat.id, toChatId, messageId, entities, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = copyMessage(fromChat.id, toChatId, messageId, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
@@ -149,10 +157,11 @@ suspend inline fun TelegramBot.copyMessage(
|
|||||||
messageId: MessageIdentifier,
|
messageId: MessageIdentifier,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = copyMessage(fromChatId, toChat.id, messageId, entities, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = copyMessage(fromChatId, toChat.id, messageId, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
@@ -164,10 +173,11 @@ suspend inline fun TelegramBot.copyMessage(
|
|||||||
messageId: MessageIdentifier,
|
messageId: MessageIdentifier,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = copyMessage(fromChat.id, toChat.id, messageId, entities, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = copyMessage(fromChat.id, toChat.id, messageId, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
@@ -178,10 +188,11 @@ suspend inline fun TelegramBot.copyMessage(
|
|||||||
message: Message,
|
message: Message,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = copyMessage(message.chat, toChatId, message.messageId, entities, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = copyMessage(message.chat, toChatId, message.messageId, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
@@ -192,7 +203,8 @@ suspend inline fun TelegramBot.copyMessage(
|
|||||||
message: Message,
|
message: Message,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = copyMessage(message.chat, toChat, message.messageId, entities, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = copyMessage(message.chat, toChat, message.messageId, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|||||||
@@ -0,0 +1,177 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api.send
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.extensions.api.send.media.sendMediaGroup
|
||||||
|
import dev.inmo.tgbotapi.requests.send.CopyMessage
|
||||||
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
|
import dev.inmo.tgbotapi.types.InputMedia.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||||
|
import dev.inmo.tgbotapi.types.MessageIdentifier
|
||||||
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
|
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||||
|
import dev.inmo.tgbotapi.types.chat.abstracts.Chat
|
||||||
|
import dev.inmo.tgbotapi.types.message.abstracts.MediaGroupMessage
|
||||||
|
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||||
|
import dev.inmo.tgbotapi.types.message.content.abstracts.MediaGroupContent
|
||||||
|
import dev.inmo.tgbotapi.types.update.MediaGroupUpdates.MediaGroupUpdate
|
||||||
|
import dev.inmo.tgbotapi.types.update.MediaGroupUpdates.SentMediaGroupUpdate
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send media group via [sendMediaGroup] extension with edited [entities] of first [messages] element. Other elements
|
||||||
|
* will be copied as they are
|
||||||
|
*/
|
||||||
|
suspend inline fun TelegramBot.copyMessages(
|
||||||
|
toChatId: ChatIdentifier,
|
||||||
|
messages: List<MediaGroupMessage<MediaGroupContent>>,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
allowSendingWithoutReply: Boolean? = null
|
||||||
|
): List<MediaGroupMessage<MediaGroupContent>> {
|
||||||
|
val first = messages.first().content.toMediaGroupMemberInputMedia().let {
|
||||||
|
if (text != null) {
|
||||||
|
when (it) {
|
||||||
|
is InputMediaAudio -> it.copy(text = text, parseMode = parseMode)
|
||||||
|
is InputMediaDocument -> it.copy(text = text, parseMode = parseMode)
|
||||||
|
is InputMediaPhoto -> it.copy(text = text, parseMode = parseMode)
|
||||||
|
is InputMediaVideo -> it.copy(text = text, parseMode = parseMode)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
it
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return sendMediaGroup(
|
||||||
|
toChatId,
|
||||||
|
listOf(first) + messages.drop(1).map {
|
||||||
|
it.content.toMediaGroupMemberInputMedia()
|
||||||
|
},
|
||||||
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
|
replyToMessageId,
|
||||||
|
allowSendingWithoutReply
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send media group via [sendMediaGroup] extension with edited [entities] of first [messages] element. Other elements
|
||||||
|
* will be copied as they are
|
||||||
|
*/
|
||||||
|
suspend inline fun TelegramBot.copyMessages(
|
||||||
|
toChat: Chat,
|
||||||
|
messages: List<MediaGroupMessage<MediaGroupContent>>,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
allowSendingWithoutReply: Boolean? = null
|
||||||
|
) = copyMessages(toChat.id, messages, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send media group via [sendMediaGroup] extension with edited [entities] of first [messages] element. Other elements
|
||||||
|
* will be copied as they are
|
||||||
|
*/
|
||||||
|
suspend inline fun TelegramBot.copyMessages(
|
||||||
|
toChat: ChatIdentifier,
|
||||||
|
update: SentMediaGroupUpdate,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
allowSendingWithoutReply: Boolean? = null
|
||||||
|
) = copyMessages(toChat, update.data, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send media group via [sendMediaGroup] extension with edited [entities] of first [messages] element. Other elements
|
||||||
|
* will be copied as they are
|
||||||
|
*/
|
||||||
|
suspend inline fun TelegramBot.copyMessages(
|
||||||
|
toChat: Chat,
|
||||||
|
update: SentMediaGroupUpdate,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
allowSendingWithoutReply: Boolean? = null
|
||||||
|
) = copyMessages(toChat.id, update, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send media group via [sendMediaGroup] extension with edited [entities] of first [messages] element. Other elements
|
||||||
|
* will be copied as they are
|
||||||
|
*/
|
||||||
|
suspend inline fun TelegramBot.copyMessages(
|
||||||
|
toChatId: ChatIdentifier,
|
||||||
|
messages: List<MediaGroupMessage<MediaGroupContent>>,
|
||||||
|
entities: TextSourcesList,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
allowSendingWithoutReply: Boolean? = null
|
||||||
|
): List<MediaGroupMessage<MediaGroupContent>> {
|
||||||
|
val first = messages.first().content.toMediaGroupMemberInputMedia().let {
|
||||||
|
when (it) {
|
||||||
|
is InputMediaAudio -> InputMediaAudio(it.file, entities, it.duration, it.performer, it.title, it.thumb)
|
||||||
|
is InputMediaDocument -> InputMediaDocument(it.file, entities, it.thumb, it.disableContentTypeDetection)
|
||||||
|
is InputMediaPhoto -> InputMediaPhoto(it.file, entities)
|
||||||
|
is InputMediaVideo -> InputMediaVideo(it.file, entities, it.width, it.height, it.duration, it.thumb)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return sendMediaGroup(
|
||||||
|
toChatId,
|
||||||
|
listOf(first) + messages.drop(1).map {
|
||||||
|
it.content.toMediaGroupMemberInputMedia()
|
||||||
|
},
|
||||||
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
|
replyToMessageId,
|
||||||
|
allowSendingWithoutReply
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send media group via [sendMediaGroup] extension with edited [entities] of first [messages] element. Other elements
|
||||||
|
* will be copied as they are
|
||||||
|
*/
|
||||||
|
suspend inline fun TelegramBot.copyMessages(
|
||||||
|
toChat: Chat,
|
||||||
|
messages: List<MediaGroupMessage<MediaGroupContent>>,
|
||||||
|
entities: TextSourcesList,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
allowSendingWithoutReply: Boolean? = null
|
||||||
|
) = copyMessages(toChat.id, messages, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send media group via [sendMediaGroup] extension with edited [entities] of first [messages] element. Other elements
|
||||||
|
* will be copied as they are
|
||||||
|
*/
|
||||||
|
suspend inline fun TelegramBot.copyMessages(
|
||||||
|
toChat: ChatIdentifier,
|
||||||
|
update: SentMediaGroupUpdate,
|
||||||
|
entities: TextSourcesList,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
allowSendingWithoutReply: Boolean? = null
|
||||||
|
) = copyMessages(toChat, update.data, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send media group via [sendMediaGroup] extension with edited [entities] of first [messages] element. Other elements
|
||||||
|
* will be copied as they are
|
||||||
|
*/
|
||||||
|
suspend inline fun TelegramBot.copyMessages(
|
||||||
|
toChat: Chat,
|
||||||
|
update: SentMediaGroupUpdate,
|
||||||
|
entities: TextSourcesList,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
allowSendingWithoutReply: Boolean? = null
|
||||||
|
) = copyMessages(toChat.id, update, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply)
|
||||||
@@ -16,6 +16,7 @@ import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
|||||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||||
import dev.inmo.tgbotapi.types.dice.DiceAnimationType
|
import dev.inmo.tgbotapi.types.dice.DiceAnimationType
|
||||||
import dev.inmo.tgbotapi.types.files.*
|
import dev.inmo.tgbotapi.types.files.*
|
||||||
|
import dev.inmo.tgbotapi.types.files.sticker.Sticker
|
||||||
import dev.inmo.tgbotapi.types.games.Game
|
import dev.inmo.tgbotapi.types.games.Game
|
||||||
import dev.inmo.tgbotapi.types.location.StaticLocation
|
import dev.inmo.tgbotapi.types.location.StaticLocation
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||||
@@ -38,6 +39,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
firstName: String,
|
firstName: String,
|
||||||
lastName: String? = null,
|
lastName: String? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendContact(
|
) = sendContact(
|
||||||
@@ -46,6 +48,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
firstName,
|
firstName,
|
||||||
lastName,
|
lastName,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
to.messageId,
|
to.messageId,
|
||||||
allowSendingWithoutReply,
|
allowSendingWithoutReply,
|
||||||
replyMarkup
|
replyMarkup
|
||||||
@@ -59,12 +62,14 @@ suspend inline fun TelegramBot.reply(
|
|||||||
to: Message,
|
to: Message,
|
||||||
contact: Contact,
|
contact: Contact,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendContact(
|
) = sendContact(
|
||||||
to.chat,
|
to.chat,
|
||||||
contact,
|
contact,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
to.messageId,
|
to.messageId,
|
||||||
allowSendingWithoutReply,
|
allowSendingWithoutReply,
|
||||||
replyMarkup
|
replyMarkup
|
||||||
@@ -81,9 +86,10 @@ suspend inline fun TelegramBot.replyWithDice(
|
|||||||
to: Message,
|
to: Message,
|
||||||
animationType: DiceAnimationType? = null,
|
animationType: DiceAnimationType? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendDice(to.chat, animationType, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendDice(to.chat, animationType, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
@@ -93,9 +99,10 @@ suspend inline fun TelegramBot.reply(
|
|||||||
to: Message,
|
to: Message,
|
||||||
animationType: DiceAnimationType,
|
animationType: DiceAnimationType,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = replyWithDice(to, animationType, disableNotification, allowSendingWithoutReply, replyMarkup)
|
) = replyWithDice(to, animationType, disableNotification, protectContent, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
// Location
|
// Location
|
||||||
@@ -109,12 +116,14 @@ suspend inline fun TelegramBot.reply(
|
|||||||
latitude: Double,
|
latitude: Double,
|
||||||
longitude: Double,
|
longitude: Double,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendLocation(
|
) = sendLocation(
|
||||||
to.chat,
|
to.chat,
|
||||||
latitude,
|
latitude,
|
||||||
longitude,
|
longitude,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
to.messageId,
|
to.messageId,
|
||||||
replyMarkup
|
replyMarkup
|
||||||
)
|
)
|
||||||
@@ -127,11 +136,13 @@ suspend inline fun TelegramBot.reply(
|
|||||||
to: Message,
|
to: Message,
|
||||||
location: StaticLocation,
|
location: StaticLocation,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendLocation(
|
) = sendLocation(
|
||||||
to.chat,
|
to.chat,
|
||||||
location,
|
location,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
to.messageId,
|
to.messageId,
|
||||||
replyMarkup
|
replyMarkup
|
||||||
)
|
)
|
||||||
@@ -149,6 +160,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
disableWebPagePreview: Boolean? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendTextMessage(
|
) = sendTextMessage(
|
||||||
@@ -157,6 +169,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
parseMode,
|
parseMode,
|
||||||
disableWebPagePreview,
|
disableWebPagePreview,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
to.messageId,
|
to.messageId,
|
||||||
allowSendingWithoutReply,
|
allowSendingWithoutReply,
|
||||||
replyMarkup
|
replyMarkup
|
||||||
@@ -171,6 +184,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableWebPagePreview: Boolean? = null,
|
disableWebPagePreview: Boolean? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendTextMessage(
|
) = sendTextMessage(
|
||||||
@@ -178,6 +192,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
entities,
|
entities,
|
||||||
disableWebPagePreview,
|
disableWebPagePreview,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
to.messageId,
|
to.messageId,
|
||||||
allowSendingWithoutReply,
|
allowSendingWithoutReply,
|
||||||
replyMarkup
|
replyMarkup
|
||||||
@@ -201,6 +216,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
googlePlaceId: GooglePlaceId? = null,
|
googlePlaceId: GooglePlaceId? = null,
|
||||||
googlePlaceType: GooglePlaceType? = null,
|
googlePlaceType: GooglePlaceType? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendVenue(
|
) = sendVenue(
|
||||||
@@ -214,6 +230,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
googlePlaceId = googlePlaceId,
|
googlePlaceId = googlePlaceId,
|
||||||
googlePlaceType = googlePlaceType,
|
googlePlaceType = googlePlaceType,
|
||||||
disableNotification = disableNotification,
|
disableNotification = disableNotification,
|
||||||
|
protectContent = protectContent,
|
||||||
replyToMessageId = to.messageId,
|
replyToMessageId = to.messageId,
|
||||||
allowSendingWithoutReply = allowSendingWithoutReply,
|
allowSendingWithoutReply = allowSendingWithoutReply,
|
||||||
replyMarkup = replyMarkup
|
replyMarkup = replyMarkup
|
||||||
@@ -229,6 +246,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
googlePlaceId: GooglePlaceId? = null,
|
googlePlaceId: GooglePlaceId? = null,
|
||||||
googlePlaceType: GooglePlaceType? = null,
|
googlePlaceType: GooglePlaceType? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendVenue(
|
) = sendVenue(
|
||||||
@@ -242,6 +260,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
googlePlaceId = googlePlaceId,
|
googlePlaceId = googlePlaceId,
|
||||||
googlePlaceType = googlePlaceType,
|
googlePlaceType = googlePlaceType,
|
||||||
disableNotification = disableNotification,
|
disableNotification = disableNotification,
|
||||||
|
protectContent = protectContent,
|
||||||
replyToMessageId = to.messageId,
|
replyToMessageId = to.messageId,
|
||||||
allowSendingWithoutReply = allowSendingWithoutReply,
|
allowSendingWithoutReply = allowSendingWithoutReply,
|
||||||
replyMarkup = replyMarkup
|
replyMarkup = replyMarkup
|
||||||
@@ -251,12 +270,14 @@ suspend inline fun TelegramBot.reply(
|
|||||||
to: Message,
|
to: Message,
|
||||||
venue: Venue,
|
venue: Venue,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendVenue(
|
) = sendVenue(
|
||||||
chat = to.chat,
|
chat = to.chat,
|
||||||
venue = venue,
|
venue = venue,
|
||||||
disableNotification = disableNotification,
|
disableNotification = disableNotification,
|
||||||
|
protectContent = protectContent,
|
||||||
replyToMessageId = to.messageId,
|
replyToMessageId = to.messageId,
|
||||||
allowSendingWithoutReply = allowSendingWithoutReply,
|
allowSendingWithoutReply = allowSendingWithoutReply,
|
||||||
replyMarkup = replyMarkup
|
replyMarkup = replyMarkup
|
||||||
@@ -269,29 +290,32 @@ suspend inline fun TelegramBot.replyWithGame(
|
|||||||
to: Message,
|
to: Message,
|
||||||
gameShortName: String,
|
gameShortName: String,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendGame(
|
) = sendGame(
|
||||||
to.chat, gameShortName, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup
|
to.chat, gameShortName, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.replyWithGame(
|
suspend inline fun TelegramBot.replyWithGame(
|
||||||
to: Message,
|
to: Message,
|
||||||
game: Game,
|
game: Game,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendGame(
|
) = sendGame(
|
||||||
to.chat, game.title, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup
|
to.chat, game.title, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: Message,
|
||||||
game: Game,
|
game: Game,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = replyWithGame(to, game, disableNotification, allowSendingWithoutReply, replyMarkup)
|
) = replyWithGame(to, game, disableNotification, protectContent, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
// Animation
|
// Animation
|
||||||
@@ -306,6 +330,7 @@ suspend inline fun TelegramBot.replyWithAnimation(
|
|||||||
width: Int? = null,
|
width: Int? = null,
|
||||||
height: Int? = null,
|
height: Int? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendAnimation(
|
) = sendAnimation(
|
||||||
@@ -318,6 +343,7 @@ suspend inline fun TelegramBot.replyWithAnimation(
|
|||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
to.messageId,
|
to.messageId,
|
||||||
allowSendingWithoutReply,
|
allowSendingWithoutReply,
|
||||||
replyMarkup
|
replyMarkup
|
||||||
@@ -332,9 +358,10 @@ suspend inline fun TelegramBot.reply(
|
|||||||
width: Int? = null,
|
width: Int? = null,
|
||||||
height: Int? = null,
|
height: Int? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendAnimation(to.chat, animation, text, parseMode, duration, width, height, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendAnimation(to.chat, animation, text, parseMode, duration, width, height, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.replyWithAnimation(
|
suspend inline fun TelegramBot.replyWithAnimation(
|
||||||
to: Message,
|
to: Message,
|
||||||
@@ -345,6 +372,7 @@ suspend inline fun TelegramBot.replyWithAnimation(
|
|||||||
width: Int? = null,
|
width: Int? = null,
|
||||||
height: Int? = null,
|
height: Int? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendAnimation(
|
) = sendAnimation(
|
||||||
@@ -356,6 +384,7 @@ suspend inline fun TelegramBot.replyWithAnimation(
|
|||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
to.messageId,
|
to.messageId,
|
||||||
allowSendingWithoutReply,
|
allowSendingWithoutReply,
|
||||||
replyMarkup
|
replyMarkup
|
||||||
@@ -369,9 +398,10 @@ suspend inline fun TelegramBot.reply(
|
|||||||
width: Int? = null,
|
width: Int? = null,
|
||||||
height: Int? = null,
|
height: Int? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendAnimation(to.chat, animation, entities, duration, width, height, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendAnimation(to.chat, animation, entities, duration, width, height, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
// Audio
|
// Audio
|
||||||
@@ -386,9 +416,10 @@ suspend inline fun TelegramBot.replyWithAudio(
|
|||||||
performer: String? = null,
|
performer: String? = null,
|
||||||
title: String? = null,
|
title: String? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendAudio(to.chat, audio, thumb, text, parseMode, duration, performer, title, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendAudio(to.chat, audio, thumb, text, parseMode, duration, performer, title, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: Message,
|
||||||
@@ -397,9 +428,10 @@ suspend inline fun TelegramBot.reply(
|
|||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
title: String? = null,
|
title: String? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendAudio(to.chat, audio, text, parseMode, title, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendAudio(to.chat, audio, text, parseMode, title, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.replyWithAudio(
|
suspend inline fun TelegramBot.replyWithAudio(
|
||||||
to: Message,
|
to: Message,
|
||||||
@@ -410,9 +442,10 @@ suspend inline fun TelegramBot.replyWithAudio(
|
|||||||
performer: String? = null,
|
performer: String? = null,
|
||||||
title: String? = null,
|
title: String? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendAudio(to.chat, audio, thumb, entities, duration, performer, title, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendAudio(to.chat, audio, thumb, entities, duration, performer, title, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: Message,
|
||||||
@@ -420,9 +453,10 @@ suspend inline fun TelegramBot.reply(
|
|||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
title: String? = null,
|
title: String? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendAudio(to.chat, audio, entities, title, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendAudio(to.chat, audio, entities, title, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
// Documents
|
// Documents
|
||||||
@@ -434,10 +468,11 @@ suspend inline fun TelegramBot.replyWithDocument(
|
|||||||
text: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null,
|
replyMarkup: KeyboardMarkup? = null,
|
||||||
disableContentTypeDetection: Boolean? = null
|
disableContentTypeDetection: Boolean? = null
|
||||||
) = sendDocument(to.chat, document, thumb, text, parseMode, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
|
) = sendDocument(to.chat, document, thumb, text, parseMode, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: Message,
|
||||||
@@ -445,10 +480,11 @@ suspend inline fun TelegramBot.reply(
|
|||||||
text: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null,
|
replyMarkup: KeyboardMarkup? = null,
|
||||||
disableContentTypeDetection: Boolean? = null
|
disableContentTypeDetection: Boolean? = null
|
||||||
) = sendDocument(to.chat, document, text, parseMode, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
|
) = sendDocument(to.chat, document, text, parseMode, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.replyWithDocument(
|
suspend inline fun TelegramBot.replyWithDocument(
|
||||||
to: Message,
|
to: Message,
|
||||||
@@ -456,20 +492,22 @@ suspend inline fun TelegramBot.replyWithDocument(
|
|||||||
thumb: InputFile? = null,
|
thumb: InputFile? = null,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null,
|
replyMarkup: KeyboardMarkup? = null,
|
||||||
disableContentTypeDetection: Boolean? = null
|
disableContentTypeDetection: Boolean? = null
|
||||||
) = sendDocument(to.chat, document, thumb, entities, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
|
) = sendDocument(to.chat, document, thumb, entities, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: Message,
|
||||||
document: DocumentFile,
|
document: DocumentFile,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null,
|
replyMarkup: KeyboardMarkup? = null,
|
||||||
disableContentTypeDetection: Boolean? = null
|
disableContentTypeDetection: Boolean? = null
|
||||||
) = sendDocument(to.chat, document, entities, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
|
) = sendDocument(to.chat, document, entities, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
|
||||||
|
|
||||||
|
|
||||||
// Media Group
|
// Media Group
|
||||||
@@ -479,29 +517,33 @@ suspend inline fun TelegramBot.replyWithMediaGroup(
|
|||||||
to: Message,
|
to: Message,
|
||||||
media: List<MediaGroupMemberInputMedia>,
|
media: List<MediaGroupMemberInputMedia>,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null
|
allowSendingWithoutReply: Boolean? = null
|
||||||
) = sendMediaGroup(to.chat, media, disableNotification, to.messageId, allowSendingWithoutReply)
|
) = sendMediaGroup(to.chat, media, disableNotification, protectContent, to.messageId, allowSendingWithoutReply)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.replyWithPlaylist(
|
suspend inline fun TelegramBot.replyWithPlaylist(
|
||||||
to: Message,
|
to: Message,
|
||||||
media: List<AudioMediaGroupMemberInputMedia>,
|
media: List<AudioMediaGroupMemberInputMedia>,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null
|
allowSendingWithoutReply: Boolean? = null
|
||||||
) = sendPlaylist(to.chat, media, disableNotification, to.messageId, allowSendingWithoutReply)
|
) = sendPlaylist(to.chat, media, disableNotification, protectContent, to.messageId, allowSendingWithoutReply)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.replyWithDocuments(
|
suspend inline fun TelegramBot.replyWithDocuments(
|
||||||
to: Message,
|
to: Message,
|
||||||
media: List<DocumentMediaGroupMemberInputMedia>,
|
media: List<DocumentMediaGroupMemberInputMedia>,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null
|
allowSendingWithoutReply: Boolean? = null
|
||||||
) = sendDocumentsGroup(to.chat, media, disableNotification, to.messageId, allowSendingWithoutReply)
|
) = sendDocumentsGroup(to.chat, media, disableNotification, protectContent, to.messageId, allowSendingWithoutReply)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.replyWithGallery(
|
suspend inline fun TelegramBot.replyWithGallery(
|
||||||
to: Message,
|
to: Message,
|
||||||
media: List<VisualMediaGroupMemberInputMedia>,
|
media: List<VisualMediaGroupMemberInputMedia>,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null
|
allowSendingWithoutReply: Boolean? = null
|
||||||
) = sendVisualMediaGroup(to.chat, media, disableNotification, to.messageId, allowSendingWithoutReply)
|
) = sendVisualMediaGroup(to.chat, media, disableNotification, protectContent, to.messageId, allowSendingWithoutReply)
|
||||||
|
|
||||||
|
|
||||||
// Photo
|
// Photo
|
||||||
@@ -512,9 +554,10 @@ suspend inline fun TelegramBot.replyWithPhoto(
|
|||||||
text: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendPhoto(to.chat, fileId, text, parseMode, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendPhoto(to.chat, fileId, text, parseMode, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: Message,
|
||||||
@@ -522,9 +565,10 @@ suspend inline fun TelegramBot.reply(
|
|||||||
text: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendPhoto(to.chat, photo, text, parseMode, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendPhoto(to.chat, photo, text, parseMode, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
suspend inline fun TelegramBot.replyWithPhoto(
|
suspend inline fun TelegramBot.replyWithPhoto(
|
||||||
@@ -532,18 +576,20 @@ suspend inline fun TelegramBot.replyWithPhoto(
|
|||||||
fileId: InputFile,
|
fileId: InputFile,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendPhoto(to.chat, fileId, entities, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendPhoto(to.chat, fileId, entities, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: Message,
|
||||||
photo: Photo,
|
photo: Photo,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendPhoto(to.chat, photo, entities, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendPhoto(to.chat, photo, entities, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
// Sticker
|
// Sticker
|
||||||
@@ -552,17 +598,19 @@ suspend inline fun TelegramBot.replyWithSticker(
|
|||||||
to: Message,
|
to: Message,
|
||||||
sticker: InputFile,
|
sticker: InputFile,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendSticker(to.chat, sticker, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendSticker(to.chat, sticker, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: Message,
|
||||||
sticker: Sticker,
|
sticker: Sticker,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendSticker(to.chat, sticker, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendSticker(to.chat, sticker, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
// Videos
|
// Videos
|
||||||
@@ -577,9 +625,10 @@ suspend inline fun TelegramBot.replyWithVideo(
|
|||||||
width: Int? = null,
|
width: Int? = null,
|
||||||
height: Int? = null,
|
height: Int? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendVideo(to.chat, video, thumb, text, parseMode, duration, width, height, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendVideo(to.chat, video, thumb, text, parseMode, duration, width, height, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: Message,
|
||||||
@@ -587,9 +636,10 @@ suspend inline fun TelegramBot.reply(
|
|||||||
text: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendVideo(to.chat, video, text, parseMode, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendVideo(to.chat, video, text, parseMode, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.replyWithVideo(
|
suspend inline fun TelegramBot.replyWithVideo(
|
||||||
to: Message,
|
to: Message,
|
||||||
@@ -600,18 +650,20 @@ suspend inline fun TelegramBot.replyWithVideo(
|
|||||||
width: Int? = null,
|
width: Int? = null,
|
||||||
height: Int? = null,
|
height: Int? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendVideo(to.chat, video, thumb, entities, duration, width, height, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendVideo(to.chat, video, thumb, entities, duration, width, height, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: Message,
|
||||||
video: VideoFile,
|
video: VideoFile,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendVideo(to.chat, video, entities, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendVideo(to.chat, video, entities, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
// VideoNotes
|
// VideoNotes
|
||||||
@@ -623,17 +675,19 @@ suspend inline fun TelegramBot.replyWithVideoNote(
|
|||||||
duration: Long? = null,
|
duration: Long? = null,
|
||||||
size: Int? = null,
|
size: Int? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendVideoNote(to.chat, videoNote, thumb, duration, size, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendVideoNote(to.chat, videoNote, thumb, duration, size, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: Message,
|
||||||
videoNote: VideoNoteFile,
|
videoNote: VideoNoteFile,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendVideoNote(to.chat, videoNote, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendVideoNote(to.chat, videoNote, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
// Voice
|
// Voice
|
||||||
@@ -645,9 +699,10 @@ suspend inline fun TelegramBot.replyWithVoice(
|
|||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
duration: Long? = null,
|
duration: Long? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendVoice(to.chat, voice, text, parseMode, duration, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendVoice(to.chat, voice, text, parseMode, duration, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: Message,
|
||||||
@@ -655,9 +710,10 @@ suspend inline fun TelegramBot.reply(
|
|||||||
text: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendVoice(to.chat, voice, text, parseMode, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendVoice(to.chat, voice, text, parseMode, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
suspend inline fun TelegramBot.replyWithVoice(
|
suspend inline fun TelegramBot.replyWithVoice(
|
||||||
@@ -666,18 +722,20 @@ suspend inline fun TelegramBot.replyWithVoice(
|
|||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
duration: Long? = null,
|
duration: Long? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendVoice(to.chat, voice, entities, duration, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendVoice(to.chat, voice, entities, duration, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: Message,
|
||||||
voice: VoiceFile,
|
voice: VoiceFile,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendVoice(to.chat, voice, entities, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendVoice(to.chat, voice, entities, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
// Invoice
|
// Invoice
|
||||||
@@ -706,9 +764,10 @@ suspend inline fun TelegramBot.reply(
|
|||||||
shouldSendEmailToProvider: Boolean = false,
|
shouldSendEmailToProvider: Boolean = false,
|
||||||
priceDependOnShipAddress: Boolean = false,
|
priceDependOnShipAddress: Boolean = false,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = sendInvoice(to.chat.id, title, description, payload, providerToken, currency, prices, maxTipAmount, suggestedTipAmounts, startParameter, providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendInvoice(to.chat.id, title, description, payload, providerToken, currency, prices, maxTipAmount, suggestedTipAmounts, startParameter, providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
// Polls
|
// Polls
|
||||||
@@ -722,9 +781,10 @@ suspend inline fun TelegramBot.reply(
|
|||||||
allowMultipleAnswers: Boolean = false,
|
allowMultipleAnswers: Boolean = false,
|
||||||
closeInfo: ScheduledCloseInfo? = null,
|
closeInfo: ScheduledCloseInfo? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendRegularPoll(to.chat, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendRegularPoll(to.chat, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: Message,
|
||||||
@@ -736,9 +796,10 @@ suspend inline fun TelegramBot.reply(
|
|||||||
allowMultipleAnswers: Boolean = poll.allowMultipleAnswers,
|
allowMultipleAnswers: Boolean = poll.allowMultipleAnswers,
|
||||||
closeInfo: ScheduledCloseInfo? = null,
|
closeInfo: ScheduledCloseInfo? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendRegularPoll(to.chat, poll, isClosed, question, options, isAnonymous, allowMultipleAnswers, closeInfo, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendRegularPoll(to.chat, poll, isClosed, question, options, isAnonymous, allowMultipleAnswers, closeInfo, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: Message,
|
||||||
@@ -751,9 +812,10 @@ suspend inline fun TelegramBot.reply(
|
|||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
closeInfo: ScheduledCloseInfo? = null,
|
closeInfo: ScheduledCloseInfo? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendQuizPoll(to.chat, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendQuizPoll(to.chat, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: Message,
|
||||||
@@ -767,9 +829,10 @@ suspend inline fun TelegramBot.reply(
|
|||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
closeInfo: ScheduledCloseInfo? = null,
|
closeInfo: ScheduledCloseInfo? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendQuizPoll(to.chat, isClosed, quizPoll, question, options, correctOptionId, isAnonymous, explanation, parseMode, closeInfo, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendQuizPoll(to.chat, isClosed, quizPoll, question, options, correctOptionId, isAnonymous, explanation, parseMode, closeInfo, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: Message,
|
||||||
@@ -781,9 +844,10 @@ suspend inline fun TelegramBot.reply(
|
|||||||
isClosed: Boolean = false,
|
isClosed: Boolean = false,
|
||||||
closeInfo: ScheduledCloseInfo? = null,
|
closeInfo: ScheduledCloseInfo? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendQuizPoll(to.chat, question, options, correctOptionId, isAnonymous, isClosed, entities, closeInfo, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendQuizPoll(to.chat, question, options, correctOptionId, isAnonymous, isClosed, entities, closeInfo, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: Message,
|
||||||
@@ -796,6 +860,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
isAnonymous: Boolean = quizPoll.isAnonymous,
|
isAnonymous: Boolean = quizPoll.isAnonymous,
|
||||||
closeInfo: ScheduledCloseInfo? = null,
|
closeInfo: ScheduledCloseInfo? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendQuizPoll(to.chat, isClosed, quizPoll, question, options, correctOptionId, isAnonymous, entities, closeInfo, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendQuizPoll(to.chat, isClosed, quizPoll, question, options, correctOptionId, isAnonymous, entities, closeInfo, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|||||||
@@ -100,3 +100,7 @@ suspend fun TelegramBot.sendActionUploadVideoNote(
|
|||||||
chat: Chat
|
chat: Chat
|
||||||
) = sendBotAction(chat, UploadVideoNoteAction)
|
) = sendBotAction(chat, UploadVideoNoteAction)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.sendActionChooseStickerAction(
|
||||||
|
chat: Chat
|
||||||
|
) = sendBotAction(chat, ChooseStickerAction)
|
||||||
|
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ suspend fun <T> TelegramBot.withUploadDocumentAction(chatId: ChatId, block: Tele
|
|||||||
suspend fun <T> TelegramBot.withFindLocationAction(chatId: ChatId, block: TelegramBotActionCallback<T>) = withAction(chatId, FindLocationAction, block)
|
suspend fun <T> TelegramBot.withFindLocationAction(chatId: ChatId, block: TelegramBotActionCallback<T>) = withAction(chatId, FindLocationAction, block)
|
||||||
suspend fun <T> TelegramBot.withRecordVideoNoteAction(chatId: ChatId, block: TelegramBotActionCallback<T>) = withAction(chatId, RecordVideoNoteAction, block)
|
suspend fun <T> TelegramBot.withRecordVideoNoteAction(chatId: ChatId, block: TelegramBotActionCallback<T>) = withAction(chatId, RecordVideoNoteAction, block)
|
||||||
suspend fun <T> TelegramBot.withUploadVideoNoteAction(chatId: ChatId, block: TelegramBotActionCallback<T>) = withAction(chatId, UploadVideoNoteAction, block)
|
suspend fun <T> TelegramBot.withUploadVideoNoteAction(chatId: ChatId, block: TelegramBotActionCallback<T>) = withAction(chatId, UploadVideoNoteAction, block)
|
||||||
|
suspend fun <T> TelegramBot.withChooseStickerAction(chatId: ChatId, block: TelegramBotActionCallback<T>) = withAction(chatId, ChooseStickerAction, block)
|
||||||
|
|
||||||
|
|
||||||
suspend fun <T> TelegramBot.withTypingAction(chat: Chat, block: TelegramBotActionCallback<T>) = withAction(chat, TypingAction, block)
|
suspend fun <T> TelegramBot.withTypingAction(chat: Chat, block: TelegramBotActionCallback<T>) = withAction(chat, TypingAction, block)
|
||||||
@@ -71,3 +72,4 @@ suspend fun <T> TelegramBot.withUploadDocumentAction(chat: Chat, block: Telegram
|
|||||||
suspend fun <T> TelegramBot.withFindLocationAction(chat: Chat, block: TelegramBotActionCallback<T>) = withAction(chat, FindLocationAction, block)
|
suspend fun <T> TelegramBot.withFindLocationAction(chat: Chat, block: TelegramBotActionCallback<T>) = withAction(chat, FindLocationAction, block)
|
||||||
suspend fun <T> TelegramBot.withRecordVideoNoteAction(chat: Chat, block: TelegramBotActionCallback<T>) = withAction(chat, RecordVideoNoteAction, block)
|
suspend fun <T> TelegramBot.withRecordVideoNoteAction(chat: Chat, block: TelegramBotActionCallback<T>) = withAction(chat, RecordVideoNoteAction, block)
|
||||||
suspend fun <T> TelegramBot.withUploadVideoNoteAction(chat: Chat, block: TelegramBotActionCallback<T>) = withAction(chat, UploadVideoNoteAction, block)
|
suspend fun <T> TelegramBot.withUploadVideoNoteAction(chat: Chat, block: TelegramBotActionCallback<T>) = withAction(chat, UploadVideoNoteAction, block)
|
||||||
|
suspend fun <T> TelegramBot.withChooseStickerAction(chat: Chat, block: TelegramBotActionCallback<T>) = withAction(chat, ChooseStickerAction, block)
|
||||||
|
|||||||
@@ -16,12 +16,13 @@ suspend fun TelegramBot.sendContact(
|
|||||||
firstName: String,
|
firstName: String,
|
||||||
lastName: String? = null,
|
lastName: String? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
SendContact(
|
SendContact(
|
||||||
chatId, phoneNumber, firstName, lastName, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
chatId, phoneNumber, firstName, lastName, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -33,12 +34,13 @@ suspend fun TelegramBot.sendContact(
|
|||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
contact: Contact,
|
contact: Contact,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
SendContact(
|
SendContact(
|
||||||
chatId, contact, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
chatId, contact, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -52,11 +54,12 @@ suspend fun TelegramBot.sendContact(
|
|||||||
firstName: String,
|
firstName: String,
|
||||||
lastName: String? = null,
|
lastName: String? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendContact(
|
) = sendContact(
|
||||||
chat.id, phoneNumber, firstName, lastName, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
chat.id, phoneNumber, firstName, lastName, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -67,9 +70,10 @@ suspend fun TelegramBot.sendContact(
|
|||||||
chat: Chat,
|
chat: Chat,
|
||||||
contact: Contact,
|
contact: Contact,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendContact(
|
) = sendContact(
|
||||||
chat.id, contact, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
chat.id, contact, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -16,11 +16,12 @@ suspend fun TelegramBot.sendDice(
|
|||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
animationType: DiceAnimationType? = null,
|
animationType: DiceAnimationType? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
SendDice(chatId, animationType, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
SendDice(chatId, animationType, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -31,7 +32,8 @@ suspend fun TelegramBot.sendDice(
|
|||||||
chat: Chat,
|
chat: Chat,
|
||||||
animationType: DiceAnimationType? = null,
|
animationType: DiceAnimationType? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendDice(chat.id, animationType, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendDice(chat.id, animationType, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ suspend fun TelegramBot.sendLocation(
|
|||||||
latitude: Double,
|
latitude: Double,
|
||||||
longitude: Double,
|
longitude: Double,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
@@ -25,6 +26,7 @@ suspend fun TelegramBot.sendLocation(
|
|||||||
latitude,
|
latitude,
|
||||||
longitude,
|
longitude,
|
||||||
disableNotification = disableNotification,
|
disableNotification = disableNotification,
|
||||||
|
protectContent = protectContent,
|
||||||
replyToMessageId = replyToMessageId,
|
replyToMessageId = replyToMessageId,
|
||||||
replyMarkup = replyMarkup
|
replyMarkup = replyMarkup
|
||||||
)
|
)
|
||||||
@@ -38,6 +40,7 @@ suspend fun TelegramBot.sendLocation(
|
|||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
location: StaticLocation,
|
location: StaticLocation,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendLocation(
|
) = sendLocation(
|
||||||
@@ -45,6 +48,7 @@ suspend fun TelegramBot.sendLocation(
|
|||||||
location.latitude,
|
location.latitude,
|
||||||
location.longitude,
|
location.longitude,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
replyMarkup
|
replyMarkup
|
||||||
)
|
)
|
||||||
@@ -58,6 +62,7 @@ suspend fun TelegramBot.sendLocation(
|
|||||||
latitude: Double,
|
latitude: Double,
|
||||||
longitude: Double,
|
longitude: Double,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendLocation(
|
) = sendLocation(
|
||||||
@@ -65,6 +70,7 @@ suspend fun TelegramBot.sendLocation(
|
|||||||
latitude,
|
latitude,
|
||||||
longitude,
|
longitude,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
replyMarkup
|
replyMarkup
|
||||||
)
|
)
|
||||||
@@ -77,6 +83,7 @@ suspend fun TelegramBot.sendLocation(
|
|||||||
chat: Chat,
|
chat: Chat,
|
||||||
location: StaticLocation,
|
location: StaticLocation,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendLocation(
|
) = sendLocation(
|
||||||
@@ -84,6 +91,7 @@ suspend fun TelegramBot.sendLocation(
|
|||||||
location.latitude,
|
location.latitude,
|
||||||
location.longitude,
|
location.longitude,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
replyMarkup
|
replyMarkup
|
||||||
)
|
)
|
||||||
@@ -97,9 +105,10 @@ suspend fun TelegramBot.sendStaticLocation(
|
|||||||
latitude: Double,
|
latitude: Double,
|
||||||
longitude: Double,
|
longitude: Double,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendLocation(chatId, latitude, longitude, disableNotification, replyToMessageId, replyMarkup)
|
) = sendLocation(chatId, latitude, longitude, disableNotification, protectContent, replyToMessageId, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
@@ -109,9 +118,10 @@ suspend fun TelegramBot.sendStaticLocation(
|
|||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
location: StaticLocation,
|
location: StaticLocation,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendLocation(chatId, location.latitude, location.longitude, disableNotification, replyToMessageId, replyMarkup)
|
) = sendLocation(chatId, location.latitude, location.longitude, disableNotification, protectContent, replyToMessageId, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
@@ -122,9 +132,10 @@ suspend fun TelegramBot.sendStaticLocation(
|
|||||||
latitude: Double,
|
latitude: Double,
|
||||||
longitude: Double,
|
longitude: Double,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendLocation(chat.id, latitude, longitude, disableNotification, replyToMessageId, replyMarkup)
|
) = sendLocation(chat.id, latitude, longitude, disableNotification, protectContent, replyToMessageId, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
@@ -134,6 +145,7 @@ suspend fun TelegramBot.sendStaticLocation(
|
|||||||
chat: Chat,
|
chat: Chat,
|
||||||
location: StaticLocation,
|
location: StaticLocation,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendLocation(chat.id, location.latitude, location.longitude, disableNotification, replyToMessageId, replyMarkup)
|
) = sendLocation(chat.id, location.latitude, location.longitude, disableNotification, protectContent, replyToMessageId, replyMarkup)
|
||||||
|
|||||||
@@ -19,11 +19,12 @@ suspend fun TelegramBot.sendMessage(
|
|||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
disableWebPagePreview: Boolean? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
SendTextMessage(chatId, text, parseMode, disableWebPagePreview, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
SendTextMessage(chatId, text, parseMode, disableWebPagePreview, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -36,11 +37,12 @@ suspend fun TelegramBot.sendTextMessage(
|
|||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
disableWebPagePreview: Boolean? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendMessage(
|
) = sendMessage(
|
||||||
chatId, text, parseMode, disableWebPagePreview, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
chatId, text, parseMode, disableWebPagePreview, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -53,10 +55,11 @@ suspend fun TelegramBot.sendMessage(
|
|||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
disableWebPagePreview: Boolean? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendMessage(chat.id, text, parseMode, disableWebPagePreview, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendMessage(chat.id, text, parseMode, disableWebPagePreview, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -69,10 +72,11 @@ suspend fun TelegramBot.sendTextMessage(
|
|||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
disableWebPagePreview: Boolean? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendTextMessage(chat.id, text, parseMode, disableWebPagePreview, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendTextMessage(chat.id, text, parseMode, disableWebPagePreview, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
@@ -83,11 +87,12 @@ suspend fun TelegramBot.sendMessage(
|
|||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableWebPagePreview: Boolean? = null,
|
disableWebPagePreview: Boolean? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
SendTextMessage(chatId, entities, disableWebPagePreview, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
SendTextMessage(chatId, entities, disableWebPagePreview, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -99,11 +104,12 @@ suspend fun TelegramBot.sendTextMessage(
|
|||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableWebPagePreview: Boolean? = null,
|
disableWebPagePreview: Boolean? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendMessage(
|
) = sendMessage(
|
||||||
chatId, entities, disableWebPagePreview, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
chatId, entities, disableWebPagePreview, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -115,10 +121,11 @@ suspend fun TelegramBot.sendMessage(
|
|||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableWebPagePreview: Boolean? = null,
|
disableWebPagePreview: Boolean? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendMessage(chat.id, entities, disableWebPagePreview, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendMessage(chat.id, entities, disableWebPagePreview, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -130,7 +137,8 @@ suspend fun TelegramBot.sendTextMessage(
|
|||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableWebPagePreview: Boolean? = null,
|
disableWebPagePreview: Boolean? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendTextMessage(chat.id, entities, disableWebPagePreview, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendTextMessage(chat.id, entities, disableWebPagePreview, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ suspend fun TelegramBot.sendVenue(
|
|||||||
googlePlaceId: GooglePlaceId? = null,
|
googlePlaceId: GooglePlaceId? = null,
|
||||||
googlePlaceType: GooglePlaceType? = null,
|
googlePlaceType: GooglePlaceType? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
@@ -38,6 +39,7 @@ suspend fun TelegramBot.sendVenue(
|
|||||||
googlePlaceId = googlePlaceId,
|
googlePlaceId = googlePlaceId,
|
||||||
googlePlaceType = googlePlaceType,
|
googlePlaceType = googlePlaceType,
|
||||||
disableNotification = disableNotification,
|
disableNotification = disableNotification,
|
||||||
|
protectContent = protectContent,
|
||||||
replyToMessageId = replyToMessageId,
|
replyToMessageId = replyToMessageId,
|
||||||
allowSendingWithoutReply = allowSendingWithoutReply,
|
allowSendingWithoutReply = allowSendingWithoutReply,
|
||||||
replyMarkup = replyMarkup
|
replyMarkup = replyMarkup
|
||||||
@@ -59,6 +61,7 @@ suspend fun TelegramBot.sendVenue(
|
|||||||
googlePlaceId: GooglePlaceId? = null,
|
googlePlaceId: GooglePlaceId? = null,
|
||||||
googlePlaceType: GooglePlaceType? = null,
|
googlePlaceType: GooglePlaceType? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
@@ -73,6 +76,7 @@ suspend fun TelegramBot.sendVenue(
|
|||||||
googlePlaceId = googlePlaceId,
|
googlePlaceId = googlePlaceId,
|
||||||
googlePlaceType = googlePlaceType,
|
googlePlaceType = googlePlaceType,
|
||||||
disableNotification = disableNotification,
|
disableNotification = disableNotification,
|
||||||
|
protectContent = protectContent,
|
||||||
replyToMessageId = replyToMessageId,
|
replyToMessageId = replyToMessageId,
|
||||||
allowSendingWithoutReply = allowSendingWithoutReply,
|
allowSendingWithoutReply = allowSendingWithoutReply,
|
||||||
replyMarkup = replyMarkup
|
replyMarkup = replyMarkup
|
||||||
@@ -92,6 +96,7 @@ suspend fun TelegramBot.sendVenue(
|
|||||||
googlePlaceId: GooglePlaceId? = null,
|
googlePlaceId: GooglePlaceId? = null,
|
||||||
googlePlaceType: GooglePlaceType? = null,
|
googlePlaceType: GooglePlaceType? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
@@ -106,6 +111,7 @@ suspend fun TelegramBot.sendVenue(
|
|||||||
googlePlaceId = googlePlaceId,
|
googlePlaceId = googlePlaceId,
|
||||||
googlePlaceType = googlePlaceType,
|
googlePlaceType = googlePlaceType,
|
||||||
disableNotification = disableNotification,
|
disableNotification = disableNotification,
|
||||||
|
protectContent = protectContent,
|
||||||
replyToMessageId = replyToMessageId,
|
replyToMessageId = replyToMessageId,
|
||||||
allowSendingWithoutReply = allowSendingWithoutReply,
|
allowSendingWithoutReply = allowSendingWithoutReply,
|
||||||
replyMarkup = replyMarkup
|
replyMarkup = replyMarkup
|
||||||
@@ -125,6 +131,7 @@ suspend fun TelegramBot.sendVenue(
|
|||||||
googlePlaceId: GooglePlaceId? = null,
|
googlePlaceId: GooglePlaceId? = null,
|
||||||
googlePlaceType: GooglePlaceType? = null,
|
googlePlaceType: GooglePlaceType? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
@@ -139,6 +146,7 @@ suspend fun TelegramBot.sendVenue(
|
|||||||
googlePlaceId = googlePlaceId,
|
googlePlaceId = googlePlaceId,
|
||||||
googlePlaceType = googlePlaceType,
|
googlePlaceType = googlePlaceType,
|
||||||
disableNotification = disableNotification,
|
disableNotification = disableNotification,
|
||||||
|
protectContent = protectContent,
|
||||||
replyToMessageId = replyToMessageId,
|
replyToMessageId = replyToMessageId,
|
||||||
allowSendingWithoutReply = allowSendingWithoutReply,
|
allowSendingWithoutReply = allowSendingWithoutReply,
|
||||||
replyMarkup = replyMarkup
|
replyMarkup = replyMarkup
|
||||||
@@ -152,6 +160,7 @@ suspend fun TelegramBot.sendVenue(
|
|||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
venue: Venue,
|
venue: Venue,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
@@ -160,6 +169,7 @@ suspend fun TelegramBot.sendVenue(
|
|||||||
chatId = chatId,
|
chatId = chatId,
|
||||||
venue = venue,
|
venue = venue,
|
||||||
disableNotification = disableNotification,
|
disableNotification = disableNotification,
|
||||||
|
protectContent = protectContent,
|
||||||
replyToMessageId = replyToMessageId,
|
replyToMessageId = replyToMessageId,
|
||||||
allowSendingWithoutReply = allowSendingWithoutReply,
|
allowSendingWithoutReply = allowSendingWithoutReply,
|
||||||
replyMarkup = replyMarkup
|
replyMarkup = replyMarkup
|
||||||
@@ -174,6 +184,7 @@ suspend fun TelegramBot.sendVenue(
|
|||||||
chat: Chat,
|
chat: Chat,
|
||||||
venue: Venue,
|
venue: Venue,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
@@ -181,6 +192,7 @@ suspend fun TelegramBot.sendVenue(
|
|||||||
chatId = chat.id,
|
chatId = chat.id,
|
||||||
venue = venue,
|
venue = venue,
|
||||||
disableNotification = disableNotification,
|
disableNotification = disableNotification,
|
||||||
|
protectContent = protectContent,
|
||||||
replyToMessageId = replyToMessageId,
|
replyToMessageId = replyToMessageId,
|
||||||
allowSendingWithoutReply = allowSendingWithoutReply,
|
allowSendingWithoutReply = allowSendingWithoutReply,
|
||||||
replyMarkup = replyMarkup
|
replyMarkup = replyMarkup
|
||||||
|
|||||||
@@ -16,12 +16,13 @@ suspend fun TelegramBot.sendGame(
|
|||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
gameShortName: String,
|
gameShortName: String,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
SendGame(
|
SendGame(
|
||||||
chatId, gameShortName, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
chatId, gameShortName, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -33,11 +34,12 @@ suspend fun TelegramBot.sendGame(
|
|||||||
chat: Chat,
|
chat: Chat,
|
||||||
gameShortName: String,
|
gameShortName: String,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendGame(
|
) = sendGame(
|
||||||
chat.id, gameShortName, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
chat.id, gameShortName, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -48,11 +50,12 @@ suspend fun TelegramBot.sendGame(
|
|||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
game: Game,
|
game: Game,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendGame(
|
) = sendGame(
|
||||||
chatId, game.title, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
chatId, game.title, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -63,9 +66,10 @@ suspend fun TelegramBot.sendGame(
|
|||||||
chat: Chat,
|
chat: Chat,
|
||||||
game: Game,
|
game: Game,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendGame(
|
) = sendGame(
|
||||||
chat.id, game.title, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
chat.id, game.title, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ suspend fun TelegramBot.sendAnimation(
|
|||||||
width: Int? = null,
|
width: Int? = null,
|
||||||
height: Int? = null,
|
height: Int? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
@@ -39,6 +40,7 @@ suspend fun TelegramBot.sendAnimation(
|
|||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
allowSendingWithoutReply,
|
allowSendingWithoutReply,
|
||||||
replyMarkup
|
replyMarkup
|
||||||
@@ -58,11 +60,12 @@ suspend fun TelegramBot.sendAnimation(
|
|||||||
width: Int? = null,
|
width: Int? = null,
|
||||||
height: Int? = null,
|
height: Int? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendAnimation(
|
) = sendAnimation(
|
||||||
chatId, animation.fileId, animation.thumb ?.fileId, text, parseMode, duration, width, height, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
chatId, animation.fileId, animation.thumb ?.fileId, text, parseMode, duration, width, height, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -79,10 +82,11 @@ suspend fun TelegramBot.sendAnimation(
|
|||||||
width: Int? = null,
|
width: Int? = null,
|
||||||
height: Int? = null,
|
height: Int? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendAnimation(chat.id, animation, thumb, text, parseMode, duration, width, height, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendAnimation(chat.id, animation, thumb, text, parseMode, duration, width, height, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
@@ -97,10 +101,11 @@ suspend fun TelegramBot.sendAnimation(
|
|||||||
width: Int? = null,
|
width: Int? = null,
|
||||||
height: Int? = null,
|
height: Int? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendAnimation(chat.id, animation, text, parseMode, duration, width, height, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendAnimation(chat.id, animation, text, parseMode, duration, width, height, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -116,6 +121,7 @@ suspend fun TelegramBot.sendAnimation(
|
|||||||
width: Int? = null,
|
width: Int? = null,
|
||||||
height: Int? = null,
|
height: Int? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
@@ -129,6 +135,7 @@ suspend fun TelegramBot.sendAnimation(
|
|||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
allowSendingWithoutReply,
|
allowSendingWithoutReply,
|
||||||
replyMarkup
|
replyMarkup
|
||||||
@@ -147,11 +154,12 @@ suspend fun TelegramBot.sendAnimation(
|
|||||||
width: Int? = null,
|
width: Int? = null,
|
||||||
height: Int? = null,
|
height: Int? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendAnimation(
|
) = sendAnimation(
|
||||||
chatId, animation.fileId, animation.thumb ?.fileId, entities, duration, width, height, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
chatId, animation.fileId, animation.thumb ?.fileId, entities, duration, width, height, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -167,10 +175,11 @@ suspend fun TelegramBot.sendAnimation(
|
|||||||
width: Int? = null,
|
width: Int? = null,
|
||||||
height: Int? = null,
|
height: Int? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendAnimation(chat.id, animation, thumb, entities, duration, width, height, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendAnimation(chat.id, animation, thumb, entities, duration, width, height, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
@@ -184,7 +193,8 @@ suspend fun TelegramBot.sendAnimation(
|
|||||||
width: Int? = null,
|
width: Int? = null,
|
||||||
height: Int? = null,
|
height: Int? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendAnimation(chat.id, animation, entities, duration, width, height, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendAnimation(chat.id, animation, entities, duration, width, height, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ suspend fun TelegramBot.sendAudio(
|
|||||||
performer: String? = null,
|
performer: String? = null,
|
||||||
title: String? = null,
|
title: String? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
@@ -39,6 +40,7 @@ suspend fun TelegramBot.sendAudio(
|
|||||||
performer,
|
performer,
|
||||||
title,
|
title,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
allowSendingWithoutReply,
|
allowSendingWithoutReply,
|
||||||
replyMarkup
|
replyMarkup
|
||||||
@@ -59,10 +61,11 @@ suspend fun TelegramBot.sendAudio(
|
|||||||
performer: String? = null,
|
performer: String? = null,
|
||||||
title: String? = null,
|
title: String? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendAudio(chat.id, audio, thumb, text, parseMode, duration, performer, title, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendAudio(chat.id, audio, thumb, text, parseMode, duration, performer, title, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
@@ -75,10 +78,11 @@ suspend fun TelegramBot.sendAudio(
|
|||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
title: String? = audio.title,
|
title: String? = audio.title,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendAudio(chatId, audio.fileId, audio.thumb ?.fileId, text, parseMode, audio.duration, audio.performer, title, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendAudio(chatId, audio.fileId, audio.thumb ?.fileId, text, parseMode, audio.duration, audio.performer, title, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
@@ -91,10 +95,11 @@ suspend fun TelegramBot.sendAudio(
|
|||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
title: String? = audio.title,
|
title: String? = audio.title,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendAudio(chat.id, audio, text, parseMode, title, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendAudio(chat.id, audio, text, parseMode, title, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -110,6 +115,7 @@ suspend inline fun TelegramBot.sendAudio(
|
|||||||
performer: String? = null,
|
performer: String? = null,
|
||||||
title: String? = null,
|
title: String? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
@@ -123,6 +129,7 @@ suspend inline fun TelegramBot.sendAudio(
|
|||||||
performer,
|
performer,
|
||||||
title,
|
title,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
allowSendingWithoutReply,
|
allowSendingWithoutReply,
|
||||||
replyMarkup
|
replyMarkup
|
||||||
@@ -142,10 +149,11 @@ suspend inline fun TelegramBot.sendAudio(
|
|||||||
performer: String? = null,
|
performer: String? = null,
|
||||||
title: String? = null,
|
title: String? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendAudio(chat.id, audio, thumb, entities, duration, performer, title, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendAudio(chat.id, audio, thumb, entities, duration, performer, title, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
@@ -157,10 +165,11 @@ suspend inline fun TelegramBot.sendAudio(
|
|||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
title: String? = audio.title,
|
title: String? = audio.title,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendAudio(chatId, audio.fileId, audio.thumb ?.fileId, entities, audio.duration, audio.performer, title, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendAudio(chatId, audio.fileId, audio.thumb ?.fileId, entities, audio.duration, audio.performer, title, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
@@ -172,7 +181,8 @@ suspend inline fun TelegramBot.sendAudio(
|
|||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
title: String? = audio.title,
|
title: String? = audio.title,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendAudio(chat.id, audio, entities, title, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendAudio(chat.id, audio, entities, title, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ suspend fun TelegramBot.sendDocument(
|
|||||||
text: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null,
|
replyMarkup: KeyboardMarkup? = null,
|
||||||
@@ -34,6 +35,7 @@ suspend fun TelegramBot.sendDocument(
|
|||||||
text,
|
text,
|
||||||
parseMode,
|
parseMode,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
allowSendingWithoutReply,
|
allowSendingWithoutReply,
|
||||||
replyMarkup,
|
replyMarkup,
|
||||||
@@ -52,11 +54,12 @@ suspend fun TelegramBot.sendDocument(
|
|||||||
text: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null,
|
replyMarkup: KeyboardMarkup? = null,
|
||||||
disableContentTypeDetection: Boolean? = null
|
disableContentTypeDetection: Boolean? = null
|
||||||
) = sendDocument(chat.id, document, thumb, text, parseMode, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
|
) = sendDocument(chat.id, document, thumb, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
@@ -68,12 +71,13 @@ suspend fun TelegramBot.sendDocument(
|
|||||||
text: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null,
|
replyMarkup: KeyboardMarkup? = null,
|
||||||
disableContentTypeDetection: Boolean? = null
|
disableContentTypeDetection: Boolean? = null
|
||||||
) = sendDocument(
|
) = sendDocument(
|
||||||
chatId, document.fileId, document.thumb ?.fileId, text, parseMode, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection
|
chatId, document.fileId, document.thumb ?.fileId, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -86,11 +90,12 @@ suspend fun TelegramBot.sendDocument(
|
|||||||
text: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null,
|
replyMarkup: KeyboardMarkup? = null,
|
||||||
disableContentTypeDetection: Boolean? = null
|
disableContentTypeDetection: Boolean? = null
|
||||||
) = sendDocument(chat.id, document, text, parseMode, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
|
) = sendDocument(chat.id, document, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
@@ -102,6 +107,7 @@ suspend inline fun TelegramBot.sendDocument(
|
|||||||
thumb: InputFile? = null,
|
thumb: InputFile? = null,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null,
|
replyMarkup: KeyboardMarkup? = null,
|
||||||
@@ -113,6 +119,7 @@ suspend inline fun TelegramBot.sendDocument(
|
|||||||
thumb,
|
thumb,
|
||||||
entities,
|
entities,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
allowSendingWithoutReply,
|
allowSendingWithoutReply,
|
||||||
replyMarkup,
|
replyMarkup,
|
||||||
@@ -130,11 +137,12 @@ suspend inline fun TelegramBot.sendDocument(
|
|||||||
thumb: InputFile? = null,
|
thumb: InputFile? = null,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null,
|
replyMarkup: KeyboardMarkup? = null,
|
||||||
disableContentTypeDetection: Boolean? = null
|
disableContentTypeDetection: Boolean? = null
|
||||||
) = sendDocument(chat.id, document, thumb, entities, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
|
) = sendDocument(chat.id, document, thumb, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
@@ -145,12 +153,13 @@ suspend inline fun TelegramBot.sendDocument(
|
|||||||
document: DocumentFile,
|
document: DocumentFile,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null,
|
replyMarkup: KeyboardMarkup? = null,
|
||||||
disableContentTypeDetection: Boolean? = null
|
disableContentTypeDetection: Boolean? = null
|
||||||
) = sendDocument(
|
) = sendDocument(
|
||||||
chatId, document.fileId, document.thumb ?.fileId, entities, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection
|
chatId, document.fileId, document.thumb ?.fileId, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -162,8 +171,9 @@ suspend inline fun TelegramBot.sendDocument(
|
|||||||
document: DocumentFile,
|
document: DocumentFile,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null,
|
replyMarkup: KeyboardMarkup? = null,
|
||||||
disableContentTypeDetection: Boolean? = null
|
disableContentTypeDetection: Boolean? = null
|
||||||
) = sendDocument(chat.id, document, entities, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
|
) = sendDocument(chat.id, document, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
|
||||||
|
|||||||
@@ -7,7 +7,11 @@ import dev.inmo.tgbotapi.types.InputMedia.*
|
|||||||
import dev.inmo.tgbotapi.types.MessageIdentifier
|
import dev.inmo.tgbotapi.types.MessageIdentifier
|
||||||
import dev.inmo.tgbotapi.types.chat.abstracts.Chat
|
import dev.inmo.tgbotapi.types.chat.abstracts.Chat
|
||||||
import dev.inmo.tgbotapi.types.message.content.abstracts.MediaGroupContent
|
import dev.inmo.tgbotapi.types.message.content.abstracts.MediaGroupContent
|
||||||
|
import dev.inmo.tgbotapi.types.message.content.abstracts.VisualMediaGroupContent
|
||||||
|
import dev.inmo.tgbotapi.types.message.content.media.AudioContent
|
||||||
|
import dev.inmo.tgbotapi.types.message.content.media.DocumentContent
|
||||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||||
|
import kotlin.jvm.JvmName
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see SendMediaGroup
|
* @see SendMediaGroup
|
||||||
@@ -17,11 +21,12 @@ suspend fun TelegramBot.sendMediaGroup(
|
|||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
media: List<MediaGroupMemberInputMedia>,
|
media: List<MediaGroupMemberInputMedia>,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null
|
allowSendingWithoutReply: Boolean? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
SendMediaGroup<MediaGroupContent>(
|
SendMediaGroup<MediaGroupContent>(
|
||||||
chatId, media, disableNotification, replyToMessageId, allowSendingWithoutReply
|
chatId, media, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -33,10 +38,43 @@ suspend fun TelegramBot.sendMediaGroup(
|
|||||||
chat: Chat,
|
chat: Chat,
|
||||||
media: List<MediaGroupMemberInputMedia>,
|
media: List<MediaGroupMemberInputMedia>,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null
|
allowSendingWithoutReply: Boolean? = null
|
||||||
) = sendMediaGroup(
|
) = sendMediaGroup(
|
||||||
chat.id, media, disableNotification, replyToMessageId, allowSendingWithoutReply
|
chat.id, media, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see SendMediaGroup
|
||||||
|
*/
|
||||||
|
@RiskFeature(rawSendingMediaGroupsWarning)
|
||||||
|
@JvmName("sendMedaGroupByContent")
|
||||||
|
suspend fun TelegramBot.sendMediaGroup(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
media: List<MediaGroupContent>,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
allowSendingWithoutReply: Boolean? = null
|
||||||
|
) = sendMediaGroup(
|
||||||
|
chatId, media.map { it.toMediaGroupMemberInputMedia() }, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see SendMediaGroup
|
||||||
|
*/
|
||||||
|
@RiskFeature(rawSendingMediaGroupsWarning)
|
||||||
|
@JvmName("sendMedaGroupByContent")
|
||||||
|
suspend fun TelegramBot.sendMediaGroup(
|
||||||
|
chat: Chat,
|
||||||
|
media: List<MediaGroupContent>,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
allowSendingWithoutReply: Boolean? = null
|
||||||
|
) = sendMediaGroup(
|
||||||
|
chat.id, media, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -46,11 +84,12 @@ suspend fun TelegramBot.sendPlaylist(
|
|||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
media: List<AudioMediaGroupMemberInputMedia>,
|
media: List<AudioMediaGroupMemberInputMedia>,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null
|
allowSendingWithoutReply: Boolean? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
SendPlaylist(
|
SendPlaylist(
|
||||||
chatId, media, disableNotification, replyToMessageId, allowSendingWithoutReply
|
chatId, media, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -61,10 +100,41 @@ suspend fun TelegramBot.sendPlaylist(
|
|||||||
chat: Chat,
|
chat: Chat,
|
||||||
media: List<AudioMediaGroupMemberInputMedia>,
|
media: List<AudioMediaGroupMemberInputMedia>,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null
|
allowSendingWithoutReply: Boolean? = null
|
||||||
) = sendPlaylist(
|
) = sendPlaylist(
|
||||||
chat.id, media, disableNotification, replyToMessageId, allowSendingWithoutReply
|
chat.id, media, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see SendPlaylist
|
||||||
|
*/
|
||||||
|
@JvmName("sendPlaylistByContent")
|
||||||
|
suspend fun TelegramBot.sendPlaylist(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
media: List<AudioContent>,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
allowSendingWithoutReply: Boolean? = null
|
||||||
|
) = sendPlaylist(
|
||||||
|
chatId, media.map { it.toMediaGroupMemberInputMedia() }, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see SendPlaylist
|
||||||
|
*/
|
||||||
|
@JvmName("sendPlaylistByContent")
|
||||||
|
suspend fun TelegramBot.sendPlaylist(
|
||||||
|
chat: Chat,
|
||||||
|
media: List<AudioContent>,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
allowSendingWithoutReply: Boolean? = null
|
||||||
|
) = sendPlaylist(
|
||||||
|
chat.id, media, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -74,11 +144,12 @@ suspend fun TelegramBot.sendDocumentsGroup(
|
|||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
media: List<DocumentMediaGroupMemberInputMedia>,
|
media: List<DocumentMediaGroupMemberInputMedia>,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null
|
allowSendingWithoutReply: Boolean? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
SendDocumentsGroup(
|
SendDocumentsGroup(
|
||||||
chatId, media, disableNotification, replyToMessageId, allowSendingWithoutReply
|
chatId, media, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -89,10 +160,41 @@ suspend fun TelegramBot.sendDocumentsGroup(
|
|||||||
chat: Chat,
|
chat: Chat,
|
||||||
media: List<DocumentMediaGroupMemberInputMedia>,
|
media: List<DocumentMediaGroupMemberInputMedia>,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null
|
allowSendingWithoutReply: Boolean? = null
|
||||||
) = sendDocumentsGroup(
|
) = sendDocumentsGroup(
|
||||||
chat.id, media, disableNotification, replyToMessageId, allowSendingWithoutReply
|
chat.id, media, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see SendDocumentsGroup
|
||||||
|
*/
|
||||||
|
@JvmName("sendDocumentsByContent")
|
||||||
|
suspend fun TelegramBot.sendDocumentsGroup(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
media: List<DocumentContent>,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
allowSendingWithoutReply: Boolean? = null
|
||||||
|
) = sendDocumentsGroup(
|
||||||
|
chatId, media.map { it.toMediaGroupMemberInputMedia() }, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see SendDocumentsGroup
|
||||||
|
*/
|
||||||
|
@JvmName("sendDocumentsByContent")
|
||||||
|
suspend fun TelegramBot.sendDocumentsGroup(
|
||||||
|
chat: Chat,
|
||||||
|
media: List<DocumentContent>,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
allowSendingWithoutReply: Boolean? = null
|
||||||
|
) = sendDocumentsGroup(
|
||||||
|
chat.id, media, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -102,11 +204,12 @@ suspend fun TelegramBot.sendVisualMediaGroup(
|
|||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
media: List<VisualMediaGroupMemberInputMedia>,
|
media: List<VisualMediaGroupMemberInputMedia>,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null
|
allowSendingWithoutReply: Boolean? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
SendVisualMediaGroup(
|
SendVisualMediaGroup(
|
||||||
chatId, media, disableNotification, replyToMessageId, allowSendingWithoutReply
|
chatId, media, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -117,8 +220,39 @@ suspend fun TelegramBot.sendVisualMediaGroup(
|
|||||||
chat: Chat,
|
chat: Chat,
|
||||||
media: List<VisualMediaGroupMemberInputMedia>,
|
media: List<VisualMediaGroupMemberInputMedia>,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null
|
allowSendingWithoutReply: Boolean? = null
|
||||||
) = sendVisualMediaGroup(
|
) = sendVisualMediaGroup(
|
||||||
chat.id, media, disableNotification, replyToMessageId, allowSendingWithoutReply
|
chat.id, media, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see SendVisualMediaGroup
|
||||||
|
*/
|
||||||
|
@JvmName("sendVisualMediaGroupByContent")
|
||||||
|
suspend fun TelegramBot.sendVisualMediaGroup(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
media: List<VisualMediaGroupContent>,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
allowSendingWithoutReply: Boolean? = null
|
||||||
|
) = sendVisualMediaGroup(
|
||||||
|
chatId, media.map { it.toMediaGroupMemberInputMedia() }, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see SendVisualMediaGroup
|
||||||
|
*/
|
||||||
|
@JvmName("sendVisualMediaGroupByContent")
|
||||||
|
suspend fun TelegramBot.sendVisualMediaGroup(
|
||||||
|
chat: Chat,
|
||||||
|
media: List<VisualMediaGroupContent>,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
allowSendingWithoutReply: Boolean? = null
|
||||||
|
) = sendVisualMediaGroup(
|
||||||
|
chat.id, media, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ suspend fun TelegramBot.sendPhoto(
|
|||||||
text: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
@@ -32,6 +33,7 @@ suspend fun TelegramBot.sendPhoto(
|
|||||||
text,
|
text,
|
||||||
parseMode,
|
parseMode,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
allowSendingWithoutReply,
|
allowSendingWithoutReply,
|
||||||
replyMarkup
|
replyMarkup
|
||||||
@@ -48,10 +50,11 @@ suspend fun TelegramBot.sendPhoto(
|
|||||||
text: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendPhoto(chat.id, fileId, text, parseMode, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendPhoto(chat.id, fileId, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
@@ -63,10 +66,11 @@ suspend fun TelegramBot.sendPhoto(
|
|||||||
text: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendPhoto(chatId, photo.biggest() ?.fileId ?: error("Photo content must not be empty"), text, parseMode, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendPhoto(chatId, photo.biggest() ?.fileId ?: error("Photo content must not be empty"), text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
@@ -78,10 +82,11 @@ suspend fun TelegramBot.sendPhoto(
|
|||||||
text: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendPhoto(chat.id, photo, text, parseMode, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendPhoto(chat.id, photo, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -93,6 +98,7 @@ suspend inline fun TelegramBot.sendPhoto(
|
|||||||
fileId: InputFile,
|
fileId: InputFile,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
@@ -102,6 +108,7 @@ suspend inline fun TelegramBot.sendPhoto(
|
|||||||
fileId,
|
fileId,
|
||||||
entities,
|
entities,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
allowSendingWithoutReply,
|
allowSendingWithoutReply,
|
||||||
replyMarkup
|
replyMarkup
|
||||||
@@ -117,10 +124,11 @@ suspend inline fun TelegramBot.sendPhoto(
|
|||||||
fileId: InputFile,
|
fileId: InputFile,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendPhoto(chat.id, fileId, entities, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendPhoto(chat.id, fileId, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
@@ -131,10 +139,11 @@ suspend inline fun TelegramBot.sendPhoto(
|
|||||||
photo: Photo,
|
photo: Photo,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendPhoto(chatId, photo.biggest() ?.fileId ?: error("Photo content must not be empty"), entities, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendPhoto(chatId, photo.biggest() ?.fileId ?: error("Photo content must not be empty"), entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
@@ -145,7 +154,8 @@ suspend inline fun TelegramBot.sendPhoto(
|
|||||||
photo: Photo,
|
photo: Photo,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendPhoto(chat.id, photo, entities, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendPhoto(chat.id, photo, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import dev.inmo.tgbotapi.types.ChatIdentifier
|
|||||||
import dev.inmo.tgbotapi.types.MessageIdentifier
|
import dev.inmo.tgbotapi.types.MessageIdentifier
|
||||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||||
import dev.inmo.tgbotapi.types.chat.abstracts.Chat
|
import dev.inmo.tgbotapi.types.chat.abstracts.Chat
|
||||||
import dev.inmo.tgbotapi.types.files.Sticker
|
import dev.inmo.tgbotapi.types.files.sticker.Sticker
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
@@ -17,11 +17,12 @@ suspend fun TelegramBot.sendSticker(
|
|||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
sticker: InputFile,
|
sticker: InputFile,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
SendSticker(chatId, sticker, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
SendSticker(chatId, sticker, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -32,10 +33,11 @@ suspend fun TelegramBot.sendSticker(
|
|||||||
chat: Chat,
|
chat: Chat,
|
||||||
sticker: InputFile,
|
sticker: InputFile,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendSticker(chat.id, sticker, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendSticker(chat.id, sticker, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
@@ -45,10 +47,11 @@ suspend fun TelegramBot.sendSticker(
|
|||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
sticker: Sticker,
|
sticker: Sticker,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendSticker(chatId, sticker.fileId, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendSticker(chatId, sticker.fileId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
@@ -58,7 +61,8 @@ suspend fun TelegramBot.sendSticker(
|
|||||||
chat: Chat,
|
chat: Chat,
|
||||||
sticker: Sticker,
|
sticker: Sticker,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendSticker(chat, sticker.fileId, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendSticker(chat, sticker.fileId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ suspend fun TelegramBot.sendVideo(
|
|||||||
width: Int? = null,
|
width: Int? = null,
|
||||||
height: Int? = null,
|
height: Int? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
@@ -40,6 +41,7 @@ suspend fun TelegramBot.sendVideo(
|
|||||||
height,
|
height,
|
||||||
null,
|
null,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
allowSendingWithoutReply,
|
allowSendingWithoutReply,
|
||||||
replyMarkup
|
replyMarkup
|
||||||
@@ -56,10 +58,11 @@ suspend fun TelegramBot.sendVideo(
|
|||||||
text: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendVideo(chatId, video.fileId, video.thumb ?.fileId, text, parseMode, video.duration, video.width, video.height, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendVideo(chatId, video.fileId, video.thumb ?.fileId, text, parseMode, video.duration, video.width, video.height, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
@@ -75,10 +78,11 @@ suspend fun TelegramBot.sendVideo(
|
|||||||
width: Int? = null,
|
width: Int? = null,
|
||||||
height: Int? = null,
|
height: Int? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendVideo(chat.id, video, thumb, text, parseMode, duration, width, height, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendVideo(chat.id, video, thumb, text, parseMode, duration, width, height, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -91,10 +95,11 @@ suspend fun TelegramBot.sendVideo(
|
|||||||
text: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendVideo(chat.id, video, text, parseMode, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendVideo(chat.id, video, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
@@ -109,6 +114,7 @@ suspend inline fun TelegramBot.sendVideo(
|
|||||||
width: Int? = null,
|
width: Int? = null,
|
||||||
height: Int? = null,
|
height: Int? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
@@ -123,6 +129,7 @@ suspend inline fun TelegramBot.sendVideo(
|
|||||||
height,
|
height,
|
||||||
null,
|
null,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
allowSendingWithoutReply,
|
allowSendingWithoutReply,
|
||||||
replyMarkup
|
replyMarkup
|
||||||
@@ -138,10 +145,11 @@ suspend inline fun TelegramBot.sendVideo(
|
|||||||
video: VideoFile,
|
video: VideoFile,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendVideo(chatId, video.fileId, video.thumb ?.fileId, entities, video.duration, video.width, video.height, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendVideo(chatId, video.fileId, video.thumb ?.fileId, entities, video.duration, video.width, video.height, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
@@ -156,10 +164,11 @@ suspend inline fun TelegramBot.sendVideo(
|
|||||||
width: Int? = null,
|
width: Int? = null,
|
||||||
height: Int? = null,
|
height: Int? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendVideo(chat.id, video, thumb, entities, duration, width, height, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendVideo(chat.id, video, thumb, entities, duration, width, height, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -171,7 +180,8 @@ suspend inline fun TelegramBot.sendVideo(
|
|||||||
video: VideoFile,
|
video: VideoFile,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendVideo(chat.id, video, entities, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendVideo(chat.id, video, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ suspend fun TelegramBot.sendVideoNote(
|
|||||||
duration: Long? = null,
|
duration: Long? = null,
|
||||||
size: Int? = null,
|
size: Int? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
@@ -31,6 +32,7 @@ suspend fun TelegramBot.sendVideoNote(
|
|||||||
duration,
|
duration,
|
||||||
size,
|
size,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
allowSendingWithoutReply,
|
allowSendingWithoutReply,
|
||||||
replyMarkup
|
replyMarkup
|
||||||
@@ -45,11 +47,12 @@ suspend fun TelegramBot.sendVideoNote(
|
|||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
videoNote: VideoNoteFile,
|
videoNote: VideoNoteFile,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendVideoNote(
|
) = sendVideoNote(
|
||||||
chatId, videoNote.fileId, videoNote.thumb ?.fileId, videoNote.duration, videoNote.width, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
chatId, videoNote.fileId, videoNote.thumb ?.fileId, videoNote.duration, videoNote.width, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -63,10 +66,11 @@ suspend fun TelegramBot.sendVideoNote(
|
|||||||
duration: Long? = null,
|
duration: Long? = null,
|
||||||
size: Int? = null,
|
size: Int? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendVideoNote(chat.id, videoNote, thumb, duration, size, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendVideoNote(chat.id, videoNote, thumb, duration, size, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
@@ -76,7 +80,8 @@ suspend fun TelegramBot.sendVideoNote(
|
|||||||
chat: Chat,
|
chat: Chat,
|
||||||
videoNote: VideoNoteFile,
|
videoNote: VideoNoteFile,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendVideoNote(chat.id, videoNote, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendVideoNote(chat.id, videoNote, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ suspend fun TelegramBot.sendVoice(
|
|||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
duration: Long? = null,
|
duration: Long? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
@@ -34,6 +35,7 @@ suspend fun TelegramBot.sendVoice(
|
|||||||
parseMode,
|
parseMode,
|
||||||
duration,
|
duration,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
allowSendingWithoutReply,
|
allowSendingWithoutReply,
|
||||||
replyMarkup
|
replyMarkup
|
||||||
@@ -51,10 +53,11 @@ suspend fun TelegramBot.sendVoice(
|
|||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
duration: Long? = null,
|
duration: Long? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendVoice(chat.id, voice, text, parseMode, duration, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendVoice(chat.id, voice, text, parseMode, duration, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
@@ -66,11 +69,12 @@ suspend fun TelegramBot.sendVoice(
|
|||||||
text: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendVoice(
|
) = sendVoice(
|
||||||
chatId, voice.fileId, text, parseMode, voice.duration, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
chatId, voice.fileId, text, parseMode, voice.duration, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -83,10 +87,11 @@ suspend fun TelegramBot.sendVoice(
|
|||||||
text: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendVoice(chat.id, voice, text, parseMode, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendVoice(chat.id, voice, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -99,6 +104,7 @@ suspend inline fun TelegramBot.sendVoice(
|
|||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
duration: Long? = null,
|
duration: Long? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
@@ -109,6 +115,7 @@ suspend inline fun TelegramBot.sendVoice(
|
|||||||
entities,
|
entities,
|
||||||
duration,
|
duration,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
allowSendingWithoutReply,
|
allowSendingWithoutReply,
|
||||||
replyMarkup
|
replyMarkup
|
||||||
@@ -125,10 +132,11 @@ suspend inline fun TelegramBot.sendVoice(
|
|||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
duration: Long? = null,
|
duration: Long? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendVoice(chat.id, voice, entities, duration, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendVoice(chat.id, voice, entities, duration, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
@@ -139,11 +147,12 @@ suspend inline fun TelegramBot.sendVoice(
|
|||||||
voice: VoiceFile,
|
voice: VoiceFile,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendVoice(
|
) = sendVoice(
|
||||||
chatId, voice.fileId, entities, voice.duration, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
chatId, voice.fileId, entities, voice.duration, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
||||||
)
|
)
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
@@ -154,7 +163,8 @@ suspend inline fun TelegramBot.sendVoice(
|
|||||||
voice: VoiceFile,
|
voice: VoiceFile,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendVoice(chat.id, voice, entities, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendVoice(chat.id, voice, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|||||||
@@ -31,11 +31,12 @@ suspend fun TelegramBot.sendInvoice(
|
|||||||
shouldSendEmailToProvider: Boolean = false,
|
shouldSendEmailToProvider: Boolean = false,
|
||||||
priceDependOnShipAddress: Boolean = false,
|
priceDependOnShipAddress: Boolean = false,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
SendInvoice(chatId, title, description, payload, providerToken, currency, prices, maxTipAmount, suggestedTipAmounts ?.sorted(), startParameter, providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
SendInvoice(chatId, title, description, payload, providerToken, currency, prices, maxTipAmount, suggestedTipAmounts ?.sorted(), startParameter, providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -62,7 +63,8 @@ suspend fun TelegramBot.sendInvoice(
|
|||||||
shouldSendEmailToProvider: Boolean = false,
|
shouldSendEmailToProvider: Boolean = false,
|
||||||
priceDependOnShipAddress: Boolean = false,
|
priceDependOnShipAddress: Boolean = false,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = sendInvoice(user.id, title, description, payload, providerToken, currency, prices, maxTipAmount, suggestedTipAmounts, startParameter, providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendInvoice(user.id, title, description, payload, providerToken, currency, prices, maxTipAmount, suggestedTipAmounts, startParameter, providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|||||||
@@ -24,12 +24,13 @@ suspend fun TelegramBot.sendRegularPoll(
|
|||||||
allowMultipleAnswers: Boolean = false,
|
allowMultipleAnswers: Boolean = false,
|
||||||
closeInfo: ScheduledCloseInfo? = null,
|
closeInfo: ScheduledCloseInfo? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
SendRegularPoll(
|
SendRegularPoll(
|
||||||
chatId, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
chatId, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
/**
|
/**
|
||||||
@@ -46,10 +47,11 @@ suspend fun TelegramBot.sendRegularPoll(
|
|||||||
allowMultipleAnswers: Boolean = poll.allowMultipleAnswers,
|
allowMultipleAnswers: Boolean = poll.allowMultipleAnswers,
|
||||||
closeInfo: ScheduledCloseInfo? = null,
|
closeInfo: ScheduledCloseInfo? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendRegularPoll(chatId, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendRegularPoll(chatId, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
@@ -64,11 +66,12 @@ suspend fun TelegramBot.sendRegularPoll(
|
|||||||
allowMultipleAnswers: Boolean = false,
|
allowMultipleAnswers: Boolean = false,
|
||||||
closeInfo: ScheduledCloseInfo? = null,
|
closeInfo: ScheduledCloseInfo? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendRegularPoll(
|
) = sendRegularPoll(
|
||||||
chat.id, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
chat.id, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -85,11 +88,12 @@ suspend fun TelegramBot.sendRegularPoll(
|
|||||||
allowMultipleAnswers: Boolean = poll.allowMultipleAnswers,
|
allowMultipleAnswers: Boolean = poll.allowMultipleAnswers,
|
||||||
closeInfo: ScheduledCloseInfo? = null,
|
closeInfo: ScheduledCloseInfo? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendRegularPoll(
|
) = sendRegularPoll(
|
||||||
chat.id, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
chat.id, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -108,12 +112,13 @@ suspend fun TelegramBot.sendQuizPoll(
|
|||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
closeInfo: ScheduledCloseInfo? = null,
|
closeInfo: ScheduledCloseInfo? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
SendQuizPoll(
|
SendQuizPoll(
|
||||||
chatId, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
chatId, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -132,11 +137,12 @@ suspend fun TelegramBot.sendQuizPoll(
|
|||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
closeInfo: ScheduledCloseInfo? = null,
|
closeInfo: ScheduledCloseInfo? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendQuizPoll(
|
) = sendQuizPoll(
|
||||||
chat.id, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
chat.id, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -155,11 +161,12 @@ suspend fun TelegramBot.sendQuizPoll(
|
|||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
closeInfo: ScheduledCloseInfo? = null,
|
closeInfo: ScheduledCloseInfo? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendQuizPoll(
|
) = sendQuizPoll(
|
||||||
chatId, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
chatId, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -178,11 +185,12 @@ suspend fun TelegramBot.sendQuizPoll(
|
|||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
closeInfo: ScheduledCloseInfo? = null,
|
closeInfo: ScheduledCloseInfo? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendQuizPoll(
|
) = sendQuizPoll(
|
||||||
chat.id, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
chat.id, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -200,12 +208,13 @@ suspend inline fun TelegramBot.sendQuizPoll(
|
|||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
closeInfo: ScheduledCloseInfo? = null,
|
closeInfo: ScheduledCloseInfo? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
SendQuizPoll(
|
SendQuizPoll(
|
||||||
chatId, question, options, correctOptionId, isAnonymous, isClosed, entities, closeInfo, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
chatId, question, options, correctOptionId, isAnonymous, isClosed, entities, closeInfo, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -223,11 +232,12 @@ suspend inline fun TelegramBot.sendQuizPoll(
|
|||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
closeInfo: ScheduledCloseInfo? = null,
|
closeInfo: ScheduledCloseInfo? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendQuizPoll(
|
) = sendQuizPoll(
|
||||||
chat.id, question, options, correctOptionId, isAnonymous, isClosed, entities, closeInfo, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
chat.id, question, options, correctOptionId, isAnonymous, isClosed, entities, closeInfo, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -245,11 +255,12 @@ suspend inline fun TelegramBot.sendQuizPoll(
|
|||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
closeInfo: ScheduledCloseInfo? = null,
|
closeInfo: ScheduledCloseInfo? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendQuizPoll(
|
) = sendQuizPoll(
|
||||||
chatId, question, options, correctOptionId, isAnonymous, isClosed, entities, closeInfo, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
chatId, question, options, correctOptionId, isAnonymous, isClosed, entities, closeInfo, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -267,9 +278,10 @@ suspend inline fun TelegramBot.sendQuizPoll(
|
|||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
closeInfo: ScheduledCloseInfo? = null,
|
closeInfo: ScheduledCloseInfo? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendQuizPoll(
|
) = sendQuizPoll(
|
||||||
chat.id, question, options, correctOptionId, isAnonymous, isClosed, entities, closeInfo, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
chat.id, question, options, correctOptionId, isAnonymous, isClosed, entities, closeInfo, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -0,0 +1,90 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api.stickers
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||||
|
import dev.inmo.tgbotapi.requests.abstracts.MultipartFile
|
||||||
|
import dev.inmo.tgbotapi.requests.stickers.AddVideoStickerToSet
|
||||||
|
import dev.inmo.tgbotapi.types.CommonUser
|
||||||
|
import dev.inmo.tgbotapi.types.UserId
|
||||||
|
import dev.inmo.tgbotapi.types.stickers.MaskPosition
|
||||||
|
import dev.inmo.tgbotapi.types.stickers.StickerSet
|
||||||
|
|
||||||
|
suspend fun TelegramBot.addVideoStickerToSet(
|
||||||
|
userId: UserId,
|
||||||
|
stickerSetName: String,
|
||||||
|
sticker: FileId,
|
||||||
|
emojis: String,
|
||||||
|
maskPosition: MaskPosition? = null
|
||||||
|
) = execute(
|
||||||
|
AddVideoStickerToSet(userId, stickerSetName, sticker, emojis, maskPosition)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.addVideoStickerToSet(
|
||||||
|
userId: UserId,
|
||||||
|
stickerSetName: String,
|
||||||
|
sticker: MultipartFile,
|
||||||
|
emojis: String,
|
||||||
|
maskPosition: MaskPosition? = null
|
||||||
|
) = execute(
|
||||||
|
AddVideoStickerToSet(userId, stickerSetName, sticker, emojis, maskPosition)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.addVideoStickerToSet(
|
||||||
|
user: CommonUser,
|
||||||
|
stickerSetName: String,
|
||||||
|
sticker: FileId,
|
||||||
|
emojis: String,
|
||||||
|
maskPosition: MaskPosition? = null
|
||||||
|
) = addVideoStickerToSet(
|
||||||
|
user.id, stickerSetName, sticker, emojis, maskPosition
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.addVideoStickerToSet(
|
||||||
|
user: CommonUser,
|
||||||
|
stickerSetName: String,
|
||||||
|
sticker: MultipartFile,
|
||||||
|
emojis: String,
|
||||||
|
maskPosition: MaskPosition? = null
|
||||||
|
) = addVideoStickerToSet(
|
||||||
|
user.id, stickerSetName, sticker, emojis, maskPosition
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.addVideoStickerToSet(
|
||||||
|
userId: UserId,
|
||||||
|
stickerSet: StickerSet,
|
||||||
|
sticker: FileId,
|
||||||
|
emojis: String,
|
||||||
|
maskPosition: MaskPosition? = null
|
||||||
|
) = addVideoStickerToSet(
|
||||||
|
userId, stickerSet.name, sticker, emojis, maskPosition
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.addVideoStickerToSet(
|
||||||
|
userId: UserId,
|
||||||
|
stickerSet: StickerSet,
|
||||||
|
sticker: MultipartFile,
|
||||||
|
emojis: String,
|
||||||
|
maskPosition: MaskPosition? = null
|
||||||
|
) = addVideoStickerToSet(
|
||||||
|
userId, stickerSet.name, sticker, emojis, maskPosition
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.addVideoStickerToSet(
|
||||||
|
user: CommonUser,
|
||||||
|
stickerSet: StickerSet,
|
||||||
|
sticker: FileId,
|
||||||
|
emojis: String,
|
||||||
|
maskPosition: MaskPosition? = null
|
||||||
|
) = addVideoStickerToSet(
|
||||||
|
user.id, stickerSet.name, sticker, emojis, maskPosition
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.addVideoStickerToSet(
|
||||||
|
user: CommonUser,
|
||||||
|
stickerSet: StickerSet,
|
||||||
|
sticker: MultipartFile,
|
||||||
|
emojis: String,
|
||||||
|
maskPosition: MaskPosition? = null
|
||||||
|
) = addVideoStickerToSet(
|
||||||
|
user.id, stickerSet.name, sticker, emojis, maskPosition
|
||||||
|
)
|
||||||
@@ -11,44 +11,48 @@ import dev.inmo.tgbotapi.types.stickers.MaskPosition
|
|||||||
suspend fun TelegramBot.createNewAnimatedStickerSet(
|
suspend fun TelegramBot.createNewAnimatedStickerSet(
|
||||||
userId: UserId,
|
userId: UserId,
|
||||||
name: String,
|
name: String,
|
||||||
|
title: String,
|
||||||
sticker: FileId,
|
sticker: FileId,
|
||||||
emojis: String,
|
emojis: String,
|
||||||
containsMasks: Boolean? = null,
|
containsMasks: Boolean? = null,
|
||||||
maskPosition: MaskPosition? = null
|
maskPosition: MaskPosition? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
CreateNewAnimatedStickerSet(userId, name, sticker, emojis, containsMasks, maskPosition)
|
CreateNewAnimatedStickerSet(userId, name, title, sticker, emojis, containsMasks, maskPosition)
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun TelegramBot.createNewAnimatedStickerSet(
|
suspend fun TelegramBot.createNewAnimatedStickerSet(
|
||||||
userId: UserId,
|
userId: UserId,
|
||||||
name: String,
|
name: String,
|
||||||
|
title: String,
|
||||||
sticker: MultipartFile,
|
sticker: MultipartFile,
|
||||||
emojis: String,
|
emojis: String,
|
||||||
containsMasks: Boolean? = null,
|
containsMasks: Boolean? = null,
|
||||||
maskPosition: MaskPosition? = null
|
maskPosition: MaskPosition? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
CreateNewAnimatedStickerSet(userId, name, sticker, emojis, containsMasks, maskPosition)
|
CreateNewAnimatedStickerSet(userId, name, title, sticker, emojis, containsMasks, maskPosition)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
suspend fun TelegramBot.createNewAnimatedStickerSet(
|
suspend fun TelegramBot.createNewAnimatedStickerSet(
|
||||||
user: CommonUser,
|
user: CommonUser,
|
||||||
name: String,
|
name: String,
|
||||||
|
title: String,
|
||||||
sticker: FileId,
|
sticker: FileId,
|
||||||
emojis: String,
|
emojis: String,
|
||||||
containsMasks: Boolean? = null,
|
containsMasks: Boolean? = null,
|
||||||
maskPosition: MaskPosition? = null
|
maskPosition: MaskPosition? = null
|
||||||
) = createNewAnimatedStickerSet(
|
) = createNewAnimatedStickerSet(
|
||||||
user.id, name, sticker, emojis, containsMasks, maskPosition
|
user.id, name, title, sticker, emojis, containsMasks, maskPosition
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun TelegramBot.createNewAnimatedStickerSet(
|
suspend fun TelegramBot.createNewAnimatedStickerSet(
|
||||||
user: CommonUser,
|
user: CommonUser,
|
||||||
name: String,
|
name: String,
|
||||||
|
title: String,
|
||||||
sticker: MultipartFile,
|
sticker: MultipartFile,
|
||||||
emojis: String,
|
emojis: String,
|
||||||
containsMasks: Boolean? = null,
|
containsMasks: Boolean? = null,
|
||||||
maskPosition: MaskPosition? = null
|
maskPosition: MaskPosition? = null
|
||||||
) = createNewAnimatedStickerSet(
|
) = createNewAnimatedStickerSet(
|
||||||
user.id, name, sticker, emojis, containsMasks, maskPosition
|
user.id, name, title, sticker, emojis, containsMasks, maskPosition
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -11,44 +11,48 @@ import dev.inmo.tgbotapi.types.stickers.MaskPosition
|
|||||||
suspend fun TelegramBot.createNewStaticStickerSet(
|
suspend fun TelegramBot.createNewStaticStickerSet(
|
||||||
userId: UserId,
|
userId: UserId,
|
||||||
name: String,
|
name: String,
|
||||||
|
title: String,
|
||||||
sticker: FileId,
|
sticker: FileId,
|
||||||
emojis: String,
|
emojis: String,
|
||||||
containsMasks: Boolean? = null,
|
containsMasks: Boolean? = null,
|
||||||
maskPosition: MaskPosition? = null
|
maskPosition: MaskPosition? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
CreateNewStaticStickerSet(userId, name, sticker, emojis, containsMasks, maskPosition)
|
CreateNewStaticStickerSet(userId, name, title, sticker, emojis, containsMasks, maskPosition)
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun TelegramBot.createNewStaticStickerSet(
|
suspend fun TelegramBot.createNewStaticStickerSet(
|
||||||
userId: UserId,
|
userId: UserId,
|
||||||
name: String,
|
name: String,
|
||||||
|
title: String,
|
||||||
sticker: MultipartFile,
|
sticker: MultipartFile,
|
||||||
emojis: String,
|
emojis: String,
|
||||||
containsMasks: Boolean? = null,
|
containsMasks: Boolean? = null,
|
||||||
maskPosition: MaskPosition? = null
|
maskPosition: MaskPosition? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
CreateNewStaticStickerSet(userId, name, sticker, emojis, containsMasks, maskPosition)
|
CreateNewStaticStickerSet(userId, name, title, sticker, emojis, containsMasks, maskPosition)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
suspend fun TelegramBot.createNewStaticStickerSet(
|
suspend fun TelegramBot.createNewStaticStickerSet(
|
||||||
user: CommonUser,
|
user: CommonUser,
|
||||||
name: String,
|
name: String,
|
||||||
|
title: String,
|
||||||
sticker: FileId,
|
sticker: FileId,
|
||||||
emojis: String,
|
emojis: String,
|
||||||
containsMasks: Boolean? = null,
|
containsMasks: Boolean? = null,
|
||||||
maskPosition: MaskPosition? = null
|
maskPosition: MaskPosition? = null
|
||||||
) = createNewStaticStickerSet(
|
) = createNewStaticStickerSet(
|
||||||
user.id, name, sticker, emojis, containsMasks, maskPosition
|
user.id, name, title, sticker, emojis, containsMasks, maskPosition
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun TelegramBot.createNewStaticStickerSet(
|
suspend fun TelegramBot.createNewStaticStickerSet(
|
||||||
user: CommonUser,
|
user: CommonUser,
|
||||||
name: String,
|
name: String,
|
||||||
|
title: String,
|
||||||
sticker: MultipartFile,
|
sticker: MultipartFile,
|
||||||
emojis: String,
|
emojis: String,
|
||||||
containsMasks: Boolean? = null,
|
containsMasks: Boolean? = null,
|
||||||
maskPosition: MaskPosition? = null
|
maskPosition: MaskPosition? = null
|
||||||
) = createNewStaticStickerSet(
|
) = createNewStaticStickerSet(
|
||||||
user.id, name, sticker, emojis, containsMasks, maskPosition
|
user.id, name, title, sticker, emojis, containsMasks, maskPosition
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -0,0 +1,58 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api.stickers
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||||
|
import dev.inmo.tgbotapi.requests.abstracts.MultipartFile
|
||||||
|
import dev.inmo.tgbotapi.requests.stickers.CreateNewVideoStickerSet
|
||||||
|
import dev.inmo.tgbotapi.types.CommonUser
|
||||||
|
import dev.inmo.tgbotapi.types.UserId
|
||||||
|
import dev.inmo.tgbotapi.types.stickers.MaskPosition
|
||||||
|
|
||||||
|
suspend fun TelegramBot.createNewVideoStickerSet(
|
||||||
|
userId: UserId,
|
||||||
|
name: String,
|
||||||
|
title: String,
|
||||||
|
sticker: FileId,
|
||||||
|
emojis: String,
|
||||||
|
containsMasks: Boolean? = null,
|
||||||
|
maskPosition: MaskPosition? = null
|
||||||
|
) = execute(
|
||||||
|
CreateNewVideoStickerSet(userId, name, title, sticker, emojis, containsMasks, maskPosition)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.createNewVideoStickerSet(
|
||||||
|
userId: UserId,
|
||||||
|
name: String,
|
||||||
|
title: String,
|
||||||
|
sticker: MultipartFile,
|
||||||
|
emojis: String,
|
||||||
|
containsMasks: Boolean? = null,
|
||||||
|
maskPosition: MaskPosition? = null
|
||||||
|
) = execute(
|
||||||
|
CreateNewVideoStickerSet(userId, name, title, sticker, emojis, containsMasks, maskPosition)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
suspend fun TelegramBot.createNewVideoStickerSet(
|
||||||
|
user: CommonUser,
|
||||||
|
name: String,
|
||||||
|
title: String,
|
||||||
|
sticker: FileId,
|
||||||
|
emojis: String,
|
||||||
|
containsMasks: Boolean? = null,
|
||||||
|
maskPosition: MaskPosition? = null
|
||||||
|
) = createNewVideoStickerSet(
|
||||||
|
user.id, name, title, sticker, emojis, containsMasks, maskPosition
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.createNewVideoStickerSet(
|
||||||
|
user: CommonUser,
|
||||||
|
name: String,
|
||||||
|
title: String,
|
||||||
|
sticker: MultipartFile,
|
||||||
|
emojis: String,
|
||||||
|
containsMasks: Boolean? = null,
|
||||||
|
maskPosition: MaskPosition? = null
|
||||||
|
) = createNewVideoStickerSet(
|
||||||
|
user.id, name, title, sticker, emojis, containsMasks, maskPosition
|
||||||
|
)
|
||||||
@@ -3,7 +3,7 @@ package dev.inmo.tgbotapi.extensions.api.stickers
|
|||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||||
import dev.inmo.tgbotapi.requests.stickers.DeleteStickerFromSet
|
import dev.inmo.tgbotapi.requests.stickers.DeleteStickerFromSet
|
||||||
import dev.inmo.tgbotapi.types.files.Sticker
|
import dev.inmo.tgbotapi.types.files.sticker.Sticker
|
||||||
|
|
||||||
suspend fun TelegramBot.deleteStickerFromSet(
|
suspend fun TelegramBot.deleteStickerFromSet(
|
||||||
sticker: FileId
|
sticker: FileId
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package dev.inmo.tgbotapi.extensions.api.stickers
|
|||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||||
import dev.inmo.tgbotapi.requests.stickers.SetStickerPositionInSet
|
import dev.inmo.tgbotapi.requests.stickers.SetStickerPositionInSet
|
||||||
import dev.inmo.tgbotapi.types.files.Sticker
|
import dev.inmo.tgbotapi.types.files.sticker.Sticker
|
||||||
|
|
||||||
suspend fun TelegramBot.setStickerPositionInSet(
|
suspend fun TelegramBot.setStickerPositionInSet(
|
||||||
sticker: FileId,
|
sticker: FileId,
|
||||||
|
|||||||
@@ -26,7 +26,13 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
jvm()
|
jvm {
|
||||||
|
compilations.main {
|
||||||
|
kotlinOptions {
|
||||||
|
jvmTarget = "1.8"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
js(IR) {
|
js(IR) {
|
||||||
browser()
|
browser()
|
||||||
nodejs()
|
nodejs()
|
||||||
@@ -44,7 +50,6 @@ kotlin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
java {
|
java {
|
||||||
toolchain {
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||||
languageVersion = JavaLanguageVersion.of(8)
|
targetCompatibility = JavaVersion.VERSION_1_8
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
apply plugin: 'maven-publish'
|
apply plugin: 'maven-publish'
|
||||||
apply plugin: 'signing'
|
|
||||||
|
|
||||||
task javadocsJar(type: Jar) {
|
task javadocsJar(type: Jar) {
|
||||||
classifier = 'javadoc'
|
classifier = 'javadoc'
|
||||||
@@ -63,7 +62,18 @@ publishing {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
signing {
|
if (project.hasProperty("signing.gnupg.keyName")) {
|
||||||
useGpgCmd()
|
apply plugin: 'signing'
|
||||||
sign publishing.publications
|
|
||||||
|
signing {
|
||||||
|
useGpgCmd()
|
||||||
|
|
||||||
|
sign publishing.publications
|
||||||
|
}
|
||||||
|
|
||||||
|
task signAll {
|
||||||
|
tasks.withType(Sign).forEach {
|
||||||
|
dependsOn(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE"}],"mavenConfig":{"name":"Telegram Bot Behaviour Builder FSM Extensions","description":"FSM extension for dev.inmo:tgbotapi.extensions.behaviour_builder.fsm","url":"https://insanusmokrassar.github.io/TelegramBotAPI/tgbotapi.extensions.behaviour_builder","vcsUrl":"https://github.com/insanusmokrassar/TelegramBotAPI.git","includeGpgSigning":true,"developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}],"repositories":[{"name":"GithubPackages","url":"https://maven.pkg.github.com/InsanusMokrassar/TelegramBotAPI"},{"name":"sonatype","url":"https://oss.sonatype.org/service/local/staging/deploy/maven2/"}]}}
|
{"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE"}],"mavenConfig":{"name":"Telegram Bot Behaviour Builder FSM Extensions","description":"FSM extension for dev.inmo:tgbotapi.extensions.behaviour_builder.fsm","url":"https://insanusmokrassar.github.io/TelegramBotAPI/tgbotapi.extensions.behaviour_builder","vcsUrl":"https://github.com/insanusmokrassar/TelegramBotAPI.git","developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}],"repositories":[{"name":"GithubPackages","url":"https://maven.pkg.github.com/InsanusMokrassar/TelegramBotAPI"},{"name":"sonatype","url":"https://oss.sonatype.org/service/local/staging/deploy/maven2/"}],"gpgSigning":{"type":"dev.inmo.kmppscriptbuilder.core.models.GpgSigning.Optional"}}}
|
||||||
@@ -10,16 +10,6 @@ import kotlinx.coroutines.*
|
|||||||
import kotlinx.coroutines.channels.BufferOverflow
|
import kotlinx.coroutines.channels.BufferOverflow
|
||||||
import kotlinx.coroutines.flow.*
|
import kotlinx.coroutines.flow.*
|
||||||
|
|
||||||
private suspend fun <I : State> BehaviourContextWithFSM.launchStateHandling(
|
|
||||||
state: State,
|
|
||||||
contextUpdatesFlow: Flow<Update>,
|
|
||||||
handlers: List<BehaviourWithFSMStateHandlerHolder<out I>>
|
|
||||||
): State? {
|
|
||||||
return handlers.firstOrNull { it.checkHandleable(state) } ?.run {
|
|
||||||
handleState(contextUpdatesFlow, state)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface which combine [BehaviourContext] and [StatesMachine]. Subcontext of triggers and states contexts must have
|
* Interface which combine [BehaviourContext] and [StatesMachine]. Subcontext of triggers and states contexts must have
|
||||||
* one common flow of updates and must not lose updates between updates
|
* one common flow of updates and must not lose updates between updates
|
||||||
@@ -27,9 +17,19 @@ private suspend fun <I : State> BehaviourContextWithFSM.launchStateHandling(
|
|||||||
* @see DefaultBehaviourContextWithFSM
|
* @see DefaultBehaviourContextWithFSM
|
||||||
* @see buildBehaviourWithFSM
|
* @see buildBehaviourWithFSM
|
||||||
*/
|
*/
|
||||||
interface BehaviourContextWithFSM : BehaviourContext, StatesMachine {
|
interface BehaviourContextWithFSM<T : State> : BehaviourContext, StatesMachine<T> {
|
||||||
suspend fun start() = start(this)
|
suspend fun start() = start(this)
|
||||||
|
|
||||||
|
suspend fun launchStateHandling(
|
||||||
|
state: T,
|
||||||
|
contextUpdatesFlow: Flow<Update>,
|
||||||
|
handlers: List<BehaviourWithFSMStateHandlerHolder<*, T>>
|
||||||
|
): T? {
|
||||||
|
return handlers.firstOrNull { it.checkHandleable(state) } ?.run {
|
||||||
|
handleState(contextUpdatesFlow, state)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun copy(
|
override fun copy(
|
||||||
bot: TelegramBot,
|
bot: TelegramBot,
|
||||||
scope: CoroutineScope,
|
scope: CoroutineScope,
|
||||||
@@ -37,14 +37,14 @@ interface BehaviourContextWithFSM : BehaviourContext, StatesMachine {
|
|||||||
onBufferOverflow: BufferOverflow,
|
onBufferOverflow: BufferOverflow,
|
||||||
upstreamUpdatesFlow: Flow<Update>?,
|
upstreamUpdatesFlow: Flow<Update>?,
|
||||||
updatesFilter: BehaviourContextAndTypeReceiver<Boolean, Update>?
|
updatesFilter: BehaviourContextAndTypeReceiver<Boolean, Update>?
|
||||||
): BehaviourContextWithFSM
|
): BehaviourContextWithFSM<T>
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
operator fun invoke(
|
operator fun <T : State> invoke(
|
||||||
behaviourContext: BehaviourContext,
|
behaviourContext: BehaviourContext,
|
||||||
handlers: List<BehaviourWithFSMStateHandlerHolder<*>>,
|
handlers: List<BehaviourWithFSMStateHandlerHolder<*, T>>,
|
||||||
statesManager: StatesManager
|
statesManager: StatesManager<T>
|
||||||
) = DefaultBehaviourContextWithFSM(behaviourContext, statesManager, handlers)
|
) = DefaultBehaviourContextWithFSM<T>(behaviourContext, statesManager, handlers)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,23 +52,24 @@ interface BehaviourContextWithFSM : BehaviourContext, StatesMachine {
|
|||||||
* Default realization of [BehaviourContextWithFSM]. It uses [behaviourContext] as a base for this object as
|
* Default realization of [BehaviourContextWithFSM]. It uses [behaviourContext] as a base for this object as
|
||||||
* [BehaviourContext], but managing substates contexts updates for avoiding of updates lost between states
|
* [BehaviourContext], but managing substates contexts updates for avoiding of updates lost between states
|
||||||
*/
|
*/
|
||||||
class DefaultBehaviourContextWithFSM(
|
class DefaultBehaviourContextWithFSM<T : State>(
|
||||||
private val behaviourContext: BehaviourContext,
|
private val behaviourContext: BehaviourContext,
|
||||||
private val statesManager: StatesManager,
|
private val statesManager: StatesManager<T>,
|
||||||
private val handlers: List<BehaviourWithFSMStateHandlerHolder<*>>
|
private val handlers: List<BehaviourWithFSMStateHandlerHolder<*, T>>
|
||||||
) : BehaviourContext by behaviourContext, BehaviourContextWithFSM {
|
) : BehaviourContext by behaviourContext, BehaviourContextWithFSM<T> {
|
||||||
private val updatesFlows = mutableMapOf<Any, Flow<Update>>()
|
private val updatesFlows = mutableMapOf<Any, Flow<Update>>()
|
||||||
private fun getContextUpdatesFlow(context: Any) = updatesFlows.getOrPut(context) {
|
private fun getContextUpdatesFlow(context: Any) = updatesFlows.getOrPut(context) {
|
||||||
allUpdatesFlow.accumulatorFlow(scope)
|
allUpdatesFlow.accumulatorFlow(scope)
|
||||||
}
|
}
|
||||||
override suspend fun StatesMachine.handleState(state: State): State? = launchStateHandling(
|
|
||||||
|
override suspend fun StatesMachine<in T>.handleState(state: T): T? = launchStateHandling(
|
||||||
state,
|
state,
|
||||||
allUpdatesFlow,
|
allUpdatesFlow,
|
||||||
handlers
|
handlers
|
||||||
)
|
)
|
||||||
|
|
||||||
override fun start(scope: CoroutineScope): Job = scope.launchSafelyWithoutExceptions {
|
override fun start(scope: CoroutineScope): Job = scope.launchSafelyWithoutExceptions {
|
||||||
val statePerformer: suspend (State) -> Unit = { state: State ->
|
val statePerformer: suspend (T) -> Unit = { state: T ->
|
||||||
val newState = launchStateHandling(state, getContextUpdatesFlow(state.context), handlers)
|
val newState = launchStateHandling(state, getContextUpdatesFlow(state.context), handlers)
|
||||||
if (newState != null) {
|
if (newState != null) {
|
||||||
statesManager.update(state, newState)
|
statesManager.update(state, newState)
|
||||||
@@ -94,7 +95,7 @@ class DefaultBehaviourContextWithFSM(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun startChain(state: State) {
|
override suspend fun startChain(state: T) {
|
||||||
statesManager.startChain(state)
|
statesManager.startChain(state)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,7 +106,7 @@ class DefaultBehaviourContextWithFSM(
|
|||||||
onBufferOverflow: BufferOverflow,
|
onBufferOverflow: BufferOverflow,
|
||||||
upstreamUpdatesFlow: Flow<Update>?,
|
upstreamUpdatesFlow: Flow<Update>?,
|
||||||
updatesFilter: BehaviourContextAndTypeReceiver<Boolean, Update>?
|
updatesFilter: BehaviourContextAndTypeReceiver<Boolean, Update>?
|
||||||
): BehaviourContextWithFSM = BehaviourContextWithFSM(
|
): BehaviourContextWithFSM<T> = BehaviourContextWithFSM(
|
||||||
behaviourContext.copy(bot, scope, broadcastChannelsSize, onBufferOverflow, upstreamUpdatesFlow, updatesFilter),
|
behaviourContext.copy(bot, scope, broadcastChannelsSize, onBufferOverflow, upstreamUpdatesFlow, updatesFilter),
|
||||||
handlers,
|
handlers,
|
||||||
statesManager
|
statesManager
|
||||||
|
|||||||
@@ -14,14 +14,14 @@ import kotlinx.coroutines.*
|
|||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
import kotlin.reflect.KClass
|
import kotlin.reflect.KClass
|
||||||
|
|
||||||
class BehaviourContextWithFSMBuilder internal constructor(
|
class BehaviourContextWithFSMBuilder<T : State> internal constructor(
|
||||||
private val resultBehaviourContext: BehaviourContextWithFSM,
|
private val resultBehaviourContext: BehaviourContextWithFSM<T>,
|
||||||
private val handlers: MutableList<BehaviourWithFSMStateHandlerHolder<*>>
|
private val handlers: MutableList<BehaviourWithFSMStateHandlerHolder<*, T>>
|
||||||
) : BehaviourContextWithFSM by resultBehaviourContext {
|
) : BehaviourContextWithFSM<T> by resultBehaviourContext {
|
||||||
internal constructor(
|
internal constructor(
|
||||||
baseBehaviourContext: BehaviourContext,
|
baseBehaviourContext: BehaviourContext,
|
||||||
statesManager: StatesManager = DefaultStatesManager(InMemoryDefaultStatesManagerRepo()),
|
statesManager: StatesManager<T> = DefaultStatesManager(InMemoryDefaultStatesManagerRepo()),
|
||||||
handlers: MutableList<BehaviourWithFSMStateHandlerHolder<*>> = mutableListOf()
|
handlers: MutableList<BehaviourWithFSMStateHandlerHolder<*, T>> = mutableListOf()
|
||||||
) : this(DefaultBehaviourContextWithFSM(baseBehaviourContext, statesManager, handlers), handlers)
|
) : this(DefaultBehaviourContextWithFSM(baseBehaviourContext, statesManager, handlers), handlers)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -31,7 +31,7 @@ class BehaviourContextWithFSMBuilder internal constructor(
|
|||||||
* @see BehaviourWithFSMStateHandlerHolder
|
* @see BehaviourWithFSMStateHandlerHolder
|
||||||
* @see onStateOrSubstate
|
* @see onStateOrSubstate
|
||||||
*/
|
*/
|
||||||
fun <I : State> add(kClass: KClass<I>, handler: BehaviourWithFSMStateHandler<I>) {
|
fun <I : T> add(kClass: KClass<I>, handler: BehaviourWithFSMStateHandler<I, T>) {
|
||||||
handlers.add(BehaviourWithFSMStateHandlerHolder(kClass, false, handler))
|
handlers.add(BehaviourWithFSMStateHandlerHolder(kClass, false, handler))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ class BehaviourContextWithFSMBuilder internal constructor(
|
|||||||
* @see BehaviourWithFSMStateHandlerHolder
|
* @see BehaviourWithFSMStateHandlerHolder
|
||||||
* @see strictlyOn
|
* @see strictlyOn
|
||||||
*/
|
*/
|
||||||
fun <I : State> addStrict(kClass: KClass<I>, handler: BehaviourWithFSMStateHandler<I>) {
|
fun <I : T> addStrict(kClass: KClass<I>, handler: BehaviourWithFSMStateHandler<I, T>) {
|
||||||
handlers.add(BehaviourWithFSMStateHandlerHolder(kClass, true, handler))
|
handlers.add(BehaviourWithFSMStateHandlerHolder(kClass, true, handler))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,7 +56,7 @@ class BehaviourContextWithFSMBuilder internal constructor(
|
|||||||
* @see BehaviourContextWithFSMBuilder.add
|
* @see BehaviourContextWithFSMBuilder.add
|
||||||
*/
|
*/
|
||||||
@Suppress("MemberVisibilityCanBePrivate")
|
@Suppress("MemberVisibilityCanBePrivate")
|
||||||
inline fun <reified I : State> onStateOrSubstate(handler: BehaviourWithFSMStateHandler<I>) {
|
inline fun <reified I : T> onStateOrSubstate(handler: BehaviourWithFSMStateHandler<I, T>) {
|
||||||
add(I::class, handler)
|
add(I::class, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,7 +69,7 @@ class BehaviourContextWithFSMBuilder internal constructor(
|
|||||||
* @see BehaviourContextWithFSMBuilder.addStrict
|
* @see BehaviourContextWithFSMBuilder.addStrict
|
||||||
*/
|
*/
|
||||||
@Suppress("MemberVisibilityCanBePrivate")
|
@Suppress("MemberVisibilityCanBePrivate")
|
||||||
inline fun <reified I : State> strictlyOn(handler: BehaviourWithFSMStateHandler<I>) {
|
inline fun <reified I : T> strictlyOn(handler: BehaviourWithFSMStateHandler<I, T>) {
|
||||||
addStrict(I::class, handler)
|
addStrict(I::class, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,14 +89,14 @@ class BehaviourContextWithFSMBuilder internal constructor(
|
|||||||
* start any updates retrieving. See [buildBehaviourWithFSMAndStartLongPolling] or
|
* start any updates retrieving. See [buildBehaviourWithFSMAndStartLongPolling] or
|
||||||
* [telegramBotWithBehaviourAndFSMAndStartLongPolling] in case you wish to start [longPolling] automatically
|
* [telegramBotWithBehaviourAndFSMAndStartLongPolling] in case you wish to start [longPolling] automatically
|
||||||
*/
|
*/
|
||||||
suspend fun TelegramBot.buildBehaviourWithFSM(
|
suspend fun <T : State> TelegramBot.buildBehaviourWithFSM(
|
||||||
upstreamUpdatesFlow: Flow<Update>? = null,
|
upstreamUpdatesFlow: Flow<Update>? = null,
|
||||||
scope: CoroutineScope = defaultCoroutineScopeProvider(),
|
scope: CoroutineScope = defaultCoroutineScopeProvider(),
|
||||||
defaultExceptionsHandler: ExceptionHandler<Unit>? = null,
|
defaultExceptionsHandler: ExceptionHandler<Unit>? = null,
|
||||||
statesManager: StatesManager = DefaultStatesManager(InMemoryDefaultStatesManagerRepo()),
|
statesManager: StatesManager<T> = DefaultStatesManager(InMemoryDefaultStatesManagerRepo()),
|
||||||
presetHandlers: MutableList<BehaviourWithFSMStateHandlerHolder<*>> = mutableListOf(),
|
presetHandlers: MutableList<BehaviourWithFSMStateHandlerHolder<*, T>> = mutableListOf(),
|
||||||
block: CustomBehaviourContextReceiver<BehaviourContextWithFSMBuilder, Unit>
|
block: CustomBehaviourContextReceiver<BehaviourContextWithFSMBuilder<T>, Unit>
|
||||||
): BehaviourContextWithFSM = BehaviourContextWithFSMBuilder(
|
): BehaviourContextWithFSM<T> = BehaviourContextWithFSMBuilder(
|
||||||
DefaultBehaviourContext(
|
DefaultBehaviourContext(
|
||||||
this,
|
this,
|
||||||
defaultExceptionsHandler ?.let { scope + ContextSafelyExceptionHandler(it) } ?: scope,
|
defaultExceptionsHandler ?.let { scope + ContextSafelyExceptionHandler(it) } ?: scope,
|
||||||
@@ -111,14 +111,14 @@ suspend fun TelegramBot.buildBehaviourWithFSM(
|
|||||||
* using [longPolling]. For [longPolling] will be used result [BehaviourContextWithFSM] for both parameters
|
* using [longPolling]. For [longPolling] will be used result [BehaviourContextWithFSM] for both parameters
|
||||||
* flowsUpdatesFilter and scope
|
* flowsUpdatesFilter and scope
|
||||||
*/
|
*/
|
||||||
suspend fun TelegramBot.buildBehaviourWithFSMAndStartLongPolling(
|
suspend fun <T : State> TelegramBot.buildBehaviourWithFSMAndStartLongPolling(
|
||||||
upstreamUpdatesFlow: Flow<Update>? = null,
|
upstreamUpdatesFlow: Flow<Update>? = null,
|
||||||
scope: CoroutineScope = defaultCoroutineScopeProvider(),
|
scope: CoroutineScope = defaultCoroutineScopeProvider(),
|
||||||
defaultExceptionsHandler: ExceptionHandler<Unit>? = null,
|
defaultExceptionsHandler: ExceptionHandler<Unit>? = null,
|
||||||
statesManager: StatesManager = DefaultStatesManager(InMemoryDefaultStatesManagerRepo()),
|
statesManager: StatesManager<T> = DefaultStatesManager(InMemoryDefaultStatesManagerRepo()),
|
||||||
presetHandlers: MutableList<BehaviourWithFSMStateHandlerHolder<*>> = mutableListOf(),
|
presetHandlers: MutableList<BehaviourWithFSMStateHandlerHolder<*, T>> = mutableListOf(),
|
||||||
block: CustomBehaviourContextReceiver<BehaviourContextWithFSMBuilder, Unit>
|
block: CustomBehaviourContextReceiver<BehaviourContextWithFSMBuilder<T>, Unit>
|
||||||
): Pair<BehaviourContextWithFSM, Job> = buildBehaviourWithFSM(
|
): Pair<BehaviourContextWithFSM<T>, Job> = buildBehaviourWithFSM(
|
||||||
upstreamUpdatesFlow,
|
upstreamUpdatesFlow,
|
||||||
scope,
|
scope,
|
||||||
defaultExceptionsHandler,
|
defaultExceptionsHandler,
|
||||||
@@ -151,14 +151,14 @@ suspend fun TelegramBot.buildBehaviourWithFSMAndStartLongPolling(
|
|||||||
* @see BehaviourContextWithFSMBuilder.onStateOrSubstate
|
* @see BehaviourContextWithFSMBuilder.onStateOrSubstate
|
||||||
*/
|
*/
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
suspend fun TelegramBot.buildBehaviourWithFSM(
|
suspend fun <T : State> TelegramBot.buildBehaviourWithFSM(
|
||||||
flowUpdatesFilter: FlowsUpdatesFilter,
|
flowUpdatesFilter: FlowsUpdatesFilter,
|
||||||
scope: CoroutineScope = defaultCoroutineScopeProvider(),
|
scope: CoroutineScope = defaultCoroutineScopeProvider(),
|
||||||
defaultExceptionsHandler: ExceptionHandler<Unit>? = null,
|
defaultExceptionsHandler: ExceptionHandler<Unit>? = null,
|
||||||
statesManager: StatesManager = DefaultStatesManager(InMemoryDefaultStatesManagerRepo()),
|
statesManager: StatesManager<T> = DefaultStatesManager(InMemoryDefaultStatesManagerRepo()),
|
||||||
presetHandlers: MutableList<BehaviourWithFSMStateHandlerHolder<*>> = mutableListOf(),
|
presetHandlers: MutableList<BehaviourWithFSMStateHandlerHolder<*, T>> = mutableListOf(),
|
||||||
block: CustomBehaviourContextReceiver<BehaviourContextWithFSMBuilder, Unit>
|
block: CustomBehaviourContextReceiver<BehaviourContextWithFSMBuilder<T>, Unit>
|
||||||
): BehaviourContextWithFSM = BehaviourContextWithFSMBuilder(
|
): BehaviourContextWithFSM<T> = BehaviourContextWithFSMBuilder(
|
||||||
DefaultBehaviourContext(
|
DefaultBehaviourContext(
|
||||||
this,
|
this,
|
||||||
defaultExceptionsHandler ?.let { scope + ContextSafelyExceptionHandler(it) } ?: scope,
|
defaultExceptionsHandler ?.let { scope + ContextSafelyExceptionHandler(it) } ?: scope,
|
||||||
@@ -180,12 +180,12 @@ suspend fun TelegramBot.buildBehaviourWithFSM(
|
|||||||
* @see BehaviourContextWithFSMBuilder.onStateOrSubstate
|
* @see BehaviourContextWithFSMBuilder.onStateOrSubstate
|
||||||
*/
|
*/
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
suspend fun TelegramBot.buildBehaviourWithFSMAndStartLongPolling(
|
suspend fun <T : State> TelegramBot.buildBehaviourWithFSMAndStartLongPolling(
|
||||||
scope: CoroutineScope = defaultCoroutineScopeProvider(),
|
scope: CoroutineScope = defaultCoroutineScopeProvider(),
|
||||||
defaultExceptionsHandler: ExceptionHandler<Unit>? = null,
|
defaultExceptionsHandler: ExceptionHandler<Unit>? = null,
|
||||||
statesManager: StatesManager = DefaultStatesManager(InMemoryDefaultStatesManagerRepo()),
|
statesManager: StatesManager<T> = DefaultStatesManager(InMemoryDefaultStatesManagerRepo()),
|
||||||
presetHandlers: MutableList<BehaviourWithFSMStateHandlerHolder<*>> = mutableListOf(),
|
presetHandlers: MutableList<BehaviourWithFSMStateHandlerHolder<*, T>> = mutableListOf(),
|
||||||
block: CustomBehaviourContextReceiver<BehaviourContextWithFSMBuilder, Unit>
|
block: CustomBehaviourContextReceiver<BehaviourContextWithFSMBuilder<T>, Unit>
|
||||||
) = FlowsUpdatesFilter().let {
|
) = FlowsUpdatesFilter().let {
|
||||||
buildBehaviourWithFSM(
|
buildBehaviourWithFSM(
|
||||||
it,
|
it,
|
||||||
|
|||||||
@@ -2,6 +2,6 @@ package dev.inmo.tgbotapi.extensions.behaviour_builder
|
|||||||
|
|
||||||
import dev.inmo.micro_utils.fsm.common.*
|
import dev.inmo.micro_utils.fsm.common.*
|
||||||
|
|
||||||
fun interface BehaviourWithFSMStateHandler<T : State> {
|
fun interface BehaviourWithFSMStateHandler<I : O, O : State> {
|
||||||
suspend fun BehaviourContextWithFSM.handleState(state: T): State?
|
suspend fun BehaviourContextWithFSM<in O>.handleState(state: I): O?
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,10 +19,10 @@ import kotlin.reflect.KClass
|
|||||||
* @param delegateTo This handler will be called in case [checkHandleable] returns true with class caster incoming
|
* @param delegateTo This handler will be called in case [checkHandleable] returns true with class caster incoming
|
||||||
* [State] in [handleState]
|
* [State] in [handleState]
|
||||||
*/
|
*/
|
||||||
class BehaviourWithFSMStateHandlerHolder<I : State>(
|
class BehaviourWithFSMStateHandlerHolder<I : O, O : State>(
|
||||||
private val inputKlass: KClass<I>,
|
private val inputKlass: KClass<I>,
|
||||||
private val strict: Boolean = false,
|
private val strict: Boolean = false,
|
||||||
private val delegateTo: BehaviourWithFSMStateHandler<I>
|
private val delegateTo: BehaviourWithFSMStateHandler<I, O>
|
||||||
) {
|
) {
|
||||||
/**
|
/**
|
||||||
* Check ability of [delegateTo] to handle this [state]
|
* Check ability of [delegateTo] to handle this [state]
|
||||||
@@ -30,7 +30,7 @@ class BehaviourWithFSMStateHandlerHolder<I : State>(
|
|||||||
* @return When [state]::class exactly equals to [inputKlass] will always return true. Otherwise when [strict]
|
* @return When [state]::class exactly equals to [inputKlass] will always return true. Otherwise when [strict]
|
||||||
* mode is disabled, will be used [KClass.isInstance] of [inputKlass] for checking
|
* mode is disabled, will be used [KClass.isInstance] of [inputKlass] for checking
|
||||||
*/
|
*/
|
||||||
fun checkHandleable(state: State) = state::class == inputKlass || (!strict && inputKlass.isInstance(state))
|
fun checkHandleable(state: O): Boolean = state::class == inputKlass || (!strict && inputKlass.isInstance(state))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handling of state :)
|
* Handling of state :)
|
||||||
@@ -38,10 +38,10 @@ class BehaviourWithFSMStateHandlerHolder<I : State>(
|
|||||||
* @param contextUpdatesFlow This [Flow] will be used as source of updates. By contract, this [Flow] must be common
|
* @param contextUpdatesFlow This [Flow] will be used as source of updates. By contract, this [Flow] must be common
|
||||||
* for all [State]s of incoming [state] [State.context] and for the whole chain inside of [BehaviourContextWithFSM]
|
* for all [State]s of incoming [state] [State.context] and for the whole chain inside of [BehaviourContextWithFSM]
|
||||||
*/
|
*/
|
||||||
suspend fun BehaviourContextWithFSM.handleState(
|
suspend fun BehaviourContextWithFSM<in O>.handleState(
|
||||||
contextUpdatesFlow: Flow<Update>,
|
contextUpdatesFlow: Flow<Update>,
|
||||||
state: State
|
state: O
|
||||||
): State? {
|
): O? {
|
||||||
val subscope = scope.LinkedSupervisorScope()
|
val subscope = scope.LinkedSupervisorScope()
|
||||||
return with(copy(scope = subscope, upstreamUpdatesFlow = contextUpdatesFlow)) {
|
return with(copy(scope = subscope, upstreamUpdatesFlow = contextUpdatesFlow)) {
|
||||||
with(delegateTo) {
|
with(delegateTo) {
|
||||||
@@ -50,3 +50,8 @@ class BehaviourWithFSMStateHandlerHolder<I : State>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline fun <reified I : O, O : State> BehaviourWithFSMStateHandlerHolder(
|
||||||
|
strict: Boolean = false,
|
||||||
|
delegateTo: BehaviourWithFSMStateHandler<I, O>
|
||||||
|
) = BehaviourWithFSMStateHandlerHolder(I::class, strict, delegateTo)
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package dev.inmo.tgbotapi.extensions.behaviour_builder
|
package dev.inmo.tgbotapi.extensions.behaviour_builder
|
||||||
|
|
||||||
import dev.inmo.micro_utils.coroutines.ExceptionHandler
|
import dev.inmo.micro_utils.coroutines.ExceptionHandler
|
||||||
|
import dev.inmo.micro_utils.fsm.common.State
|
||||||
import dev.inmo.micro_utils.fsm.common.StatesManager
|
import dev.inmo.micro_utils.fsm.common.StatesManager
|
||||||
import dev.inmo.micro_utils.fsm.common.managers.DefaultStatesManager
|
import dev.inmo.micro_utils.fsm.common.managers.DefaultStatesManager
|
||||||
import dev.inmo.micro_utils.fsm.common.managers.InMemoryDefaultStatesManagerRepo
|
import dev.inmo.micro_utils.fsm.common.managers.InMemoryDefaultStatesManagerRepo
|
||||||
@@ -28,16 +29,16 @@ import kotlin.coroutines.coroutineContext
|
|||||||
* @see [buildBehaviourWithFSM]
|
* @see [buildBehaviourWithFSM]
|
||||||
* @see startGettingOfUpdatesByLongPolling
|
* @see startGettingOfUpdatesByLongPolling
|
||||||
*/
|
*/
|
||||||
suspend fun telegramBotWithBehaviourAndFSM(
|
suspend fun <T : State> telegramBotWithBehaviourAndFSM(
|
||||||
token: String,
|
token: String,
|
||||||
flowsUpdatesFilter: FlowsUpdatesFilter,
|
flowsUpdatesFilter: FlowsUpdatesFilter,
|
||||||
scope: CoroutineScope? = null,
|
scope: CoroutineScope? = null,
|
||||||
apiUrl: String = telegramBotAPIDefaultUrl,
|
apiUrl: String = telegramBotAPIDefaultUrl,
|
||||||
builder: KtorRequestsExecutorBuilder.() -> Unit = {},
|
builder: KtorRequestsExecutorBuilder.() -> Unit = {},
|
||||||
defaultExceptionsHandler: ExceptionHandler<Unit>? = null,
|
defaultExceptionsHandler: ExceptionHandler<Unit>? = null,
|
||||||
statesManager: StatesManager = DefaultStatesManager(InMemoryDefaultStatesManagerRepo()),
|
statesManager: StatesManager<T> = DefaultStatesManager(InMemoryDefaultStatesManagerRepo()),
|
||||||
presetHandlers: MutableList<BehaviourWithFSMStateHandlerHolder<*>> = mutableListOf(),
|
presetHandlers: MutableList<BehaviourWithFSMStateHandlerHolder<*, T>> = mutableListOf(),
|
||||||
block: CustomBehaviourContextReceiver<BehaviourContextWithFSMBuilder, Unit>
|
block: CustomBehaviourContextReceiver<BehaviourContextWithFSMBuilder<T>, Unit>
|
||||||
): TelegramBot = telegramBot(
|
): TelegramBot = telegramBot(
|
||||||
token,
|
token,
|
||||||
apiUrl,
|
apiUrl,
|
||||||
@@ -64,15 +65,15 @@ suspend fun telegramBotWithBehaviourAndFSM(
|
|||||||
* @see buildBehaviourWithFSMAndStartLongPolling
|
* @see buildBehaviourWithFSMAndStartLongPolling
|
||||||
* @see startGettingOfUpdatesByLongPolling
|
* @see startGettingOfUpdatesByLongPolling
|
||||||
*/
|
*/
|
||||||
suspend fun telegramBotWithBehaviourAndFSMAndStartLongPolling(
|
suspend fun <T : State> telegramBotWithBehaviourAndFSMAndStartLongPolling(
|
||||||
token: String,
|
token: String,
|
||||||
scope: CoroutineScope? = null,
|
scope: CoroutineScope? = null,
|
||||||
apiUrl: String = telegramBotAPIDefaultUrl,
|
apiUrl: String = telegramBotAPIDefaultUrl,
|
||||||
builder: KtorRequestsExecutorBuilder.() -> Unit = {},
|
builder: KtorRequestsExecutorBuilder.() -> Unit = {},
|
||||||
defaultExceptionsHandler: ExceptionHandler<Unit>? = null,
|
defaultExceptionsHandler: ExceptionHandler<Unit>? = null,
|
||||||
statesManager: StatesManager = DefaultStatesManager(InMemoryDefaultStatesManagerRepo()),
|
statesManager: StatesManager<T> = DefaultStatesManager(InMemoryDefaultStatesManagerRepo()),
|
||||||
presetHandlers: MutableList<BehaviourWithFSMStateHandlerHolder<*>> = mutableListOf(),
|
presetHandlers: MutableList<BehaviourWithFSMStateHandlerHolder<*, T>> = mutableListOf(),
|
||||||
block: CustomBehaviourContextReceiver<BehaviourContextWithFSMBuilder, Unit>
|
block: CustomBehaviourContextReceiver<BehaviourContextWithFSMBuilder<T>, Unit>
|
||||||
): Pair<TelegramBot, Job> {
|
): Pair<TelegramBot, Job> {
|
||||||
return telegramBot(
|
return telegramBot(
|
||||||
token,
|
token,
|
||||||
|
|||||||
@@ -26,7 +26,13 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
jvm()
|
jvm {
|
||||||
|
compilations.main {
|
||||||
|
kotlinOptions {
|
||||||
|
jvmTarget = "1.8"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
js(IR) {
|
js(IR) {
|
||||||
browser()
|
browser()
|
||||||
nodejs()
|
nodejs()
|
||||||
@@ -43,7 +49,6 @@ kotlin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
java {
|
java {
|
||||||
toolchain {
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||||
languageVersion = JavaLanguageVersion.of(8)
|
targetCompatibility = JavaVersion.VERSION_1_8
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
apply plugin: 'maven-publish'
|
apply plugin: 'maven-publish'
|
||||||
apply plugin: 'signing'
|
|
||||||
|
|
||||||
task javadocsJar(type: Jar) {
|
task javadocsJar(type: Jar) {
|
||||||
classifier = 'javadoc'
|
classifier = 'javadoc'
|
||||||
@@ -63,7 +62,18 @@ publishing {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
signing {
|
if (project.hasProperty("signing.gnupg.keyName")) {
|
||||||
useGpgCmd()
|
apply plugin: 'signing'
|
||||||
sign publishing.publications
|
|
||||||
|
signing {
|
||||||
|
useGpgCmd()
|
||||||
|
|
||||||
|
sign publishing.publications
|
||||||
|
}
|
||||||
|
|
||||||
|
task signAll {
|
||||||
|
tasks.withType(Sign).forEach {
|
||||||
|
dependsOn(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
1
tgbotapi.behaviour_builder/publish.kpsb
Normal file
1
tgbotapi.behaviour_builder/publish.kpsb
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE"}],"mavenConfig":{"name":"Telegram Bot API Steps Extensions","description":"This extensions project contains tools for simple interaction with chats","url":"https://insanusmokrassar.github.io/TelegramBotAPI/tgbotapi.extensions.steps","vcsUrl":"https://github.com/insanusmokrassar/TelegramBotAPI.git","developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}],"repositories":[{"name":"GithubPackages","url":"https://maven.pkg.github.com/InsanusMokrassar/TelegramBotAPI"},{"name":"sonatype","url":"https://oss.sonatype.org/service/local/staging/deploy/maven2/"}],"gpgSigning":{"type":"dev.inmo.kmppscriptbuilder.core.models.GpgSigning.Optional"}}}
|
||||||
@@ -27,7 +27,7 @@ expect var defaultCoroutineScopeProvider: () -> CoroutineScope
|
|||||||
*/
|
*/
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
suspend fun TelegramBot.buildBehaviour(
|
suspend fun TelegramBot.buildBehaviour(
|
||||||
flowUpdatesFilter: FlowsUpdatesFilter,
|
flowUpdatesFilter: FlowsUpdatesFilter = FlowsUpdatesFilter(),
|
||||||
scope: CoroutineScope = defaultCoroutineScopeProvider(),
|
scope: CoroutineScope = defaultCoroutineScopeProvider(),
|
||||||
defaultExceptionsHandler: ExceptionHandler<Unit>? = null,
|
defaultExceptionsHandler: ExceptionHandler<Unit>? = null,
|
||||||
block: BehaviourContextReceiver<Unit>
|
block: BehaviourContextReceiver<Unit>
|
||||||
@@ -70,11 +70,3 @@ suspend fun TelegramBot.buildBehaviourWithLongPolling(
|
|||||||
scope = scope
|
scope = scope
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreviewFeature
|
|
||||||
@Deprecated("Renamed to buildBehaviourWithLongPolling")
|
|
||||||
suspend fun TelegramBot.buildBehaviour(
|
|
||||||
scope: CoroutineScope = defaultCoroutineScopeProvider(),
|
|
||||||
defaultExceptionsHandler: ExceptionHandler<Unit>? = null,
|
|
||||||
block: BehaviourContextReceiver<Unit>
|
|
||||||
) = buildBehaviourWithLongPolling(scope, defaultExceptionsHandler, block)
|
|
||||||
|
|||||||
@@ -55,13 +55,6 @@ interface BehaviourContext : FlowsUpdatesFilter, TelegramBot, CoroutineScope {
|
|||||||
upstreamUpdatesFlow: Flow<Update>? = null,
|
upstreamUpdatesFlow: Flow<Update>? = null,
|
||||||
updatesFilter: BehaviourContextAndTypeReceiver<Boolean, Update>? = null
|
updatesFilter: BehaviourContextAndTypeReceiver<Boolean, Update>? = null
|
||||||
): BehaviourContext
|
): BehaviourContext
|
||||||
|
|
||||||
@Deprecated("This method is not recommended to use and will be removed in near release")
|
|
||||||
fun copy(
|
|
||||||
bot: TelegramBot,
|
|
||||||
scope: CoroutineScope = this.scope,
|
|
||||||
flowsUpdatesFilter: FlowsUpdatesFilter = this.flowsUpdatesFilter
|
|
||||||
): BehaviourContext = copy(upstreamUpdatesFlow = flowsUpdatesFilter.allUpdatesFlow)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class DefaultBehaviourContext(
|
class DefaultBehaviourContext(
|
||||||
@@ -113,30 +106,6 @@ inline fun <T> BehaviourContext(
|
|||||||
crossinline block: BehaviourContext.() -> T
|
crossinline block: BehaviourContext.() -> T
|
||||||
) = DefaultBehaviourContext(bot, scope, upstreamUpdatesFlow = flowsUpdatesFilter.allUpdatesFlow).run(block)
|
) = DefaultBehaviourContext(bot, scope, upstreamUpdatesFlow = flowsUpdatesFilter.allUpdatesFlow).run(block)
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates new one [BehaviourContext], adding subsequent [FlowsUpdatesFilter] in case [newFlowsUpdatesFilterSetUp] is provided and
|
|
||||||
* [CoroutineScope] as new [BehaviourContext.scope]. You must do all subscription/running of longPolling manually.
|
|
||||||
*
|
|
||||||
* @param newFlowsUpdatesFilterSetUp As a parameter receives [FlowsUpdatesFilter] from old [this] [BehaviourContext.flowsUpdatesFilter]
|
|
||||||
*/
|
|
||||||
@RiskFeature("It is recommended to use doInSubContextWithUpdatesFilter instead. " +
|
|
||||||
"This method is low level and should not be used in case you are not pretty sure you need it.")
|
|
||||||
@Deprecated("This method is useless and will not be used in future")
|
|
||||||
suspend fun <T, BC : BehaviourContext> BC.doInSubContextWithFlowsUpdatesFilterSetup(
|
|
||||||
newFlowsUpdatesFilterSetUp: CustomBehaviourContextAndTypeReceiver<BC, Unit, FlowsUpdatesFilter>?,
|
|
||||||
stopOnCompletion: Boolean = true,
|
|
||||||
behaviourContextReceiver: CustomBehaviourContextReceiver<BC, T>
|
|
||||||
): T = (copy(
|
|
||||||
scope = LinkedSupervisorScope(),
|
|
||||||
) as BC).run {
|
|
||||||
withContext(coroutineContext) {
|
|
||||||
newFlowsUpdatesFilterSetUp ?.let {
|
|
||||||
it.apply { invoke(this@run, this@doInSubContextWithFlowsUpdatesFilterSetup.flowsUpdatesFilter) }
|
|
||||||
}
|
|
||||||
behaviourContextReceiver().also { if (stopOnCompletion) stop() }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates new one [BehaviourContext], adding subsequent [FlowsUpdatesFilter] in case [updatesFilter] is provided and
|
* Creates new one [BehaviourContext], adding subsequent [FlowsUpdatesFilter] in case [updatesFilter] is provided and
|
||||||
* [CoroutineScope] as new [BehaviourContext.scope]
|
* [CoroutineScope] as new [BehaviourContext.scope]
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import kotlin.coroutines.coroutineContext
|
|||||||
*/
|
*/
|
||||||
suspend fun telegramBotWithBehaviour(
|
suspend fun telegramBotWithBehaviour(
|
||||||
token: String,
|
token: String,
|
||||||
flowsUpdatesFilter: FlowsUpdatesFilter,
|
flowsUpdatesFilter: FlowsUpdatesFilter = FlowsUpdatesFilter(),
|
||||||
scope: CoroutineScope? = null,
|
scope: CoroutineScope? = null,
|
||||||
apiUrl: String = telegramBotAPIDefaultUrl,
|
apiUrl: String = telegramBotAPIDefaultUrl,
|
||||||
builder: KtorRequestsExecutorBuilder.() -> Unit = {},
|
builder: KtorRequestsExecutorBuilder.() -> Unit = {},
|
||||||
@@ -77,13 +77,3 @@ suspend fun telegramBotWithBehaviourAndLongPolling(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated("Renamed to telegramBotWithBehaviourAndLongPolling")
|
|
||||||
suspend fun telegramBotWithBehaviour(
|
|
||||||
token: String,
|
|
||||||
scope: CoroutineScope? = null,
|
|
||||||
apiUrl: String = telegramBotAPIDefaultUrl,
|
|
||||||
builder: KtorRequestsExecutorBuilder.() -> Unit = {},
|
|
||||||
defaultExceptionsHandler: ExceptionHandler<Unit>? = null,
|
|
||||||
block: BehaviourContextReceiver<Unit>
|
|
||||||
) = telegramBotWithBehaviourAndLongPolling(token, scope, apiUrl, builder, defaultExceptionsHandler, block)
|
|
||||||
|
|||||||
@@ -0,0 +1,51 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.behaviour_builder.expectations
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext
|
||||||
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.SimpleFilter
|
||||||
|
import dev.inmo.tgbotapi.extensions.utils.*
|
||||||
|
import dev.inmo.tgbotapi.requests.abstracts.Request
|
||||||
|
import dev.inmo.tgbotapi.types.ChatJoinRequest
|
||||||
|
import dev.inmo.tgbotapi.types.payments.PreCheckoutQuery
|
||||||
|
import dev.inmo.tgbotapi.types.payments.ShippingQuery
|
||||||
|
import kotlinx.coroutines.flow.toList
|
||||||
|
|
||||||
|
typealias ChatJoinRequestsMapper = suspend ChatJoinRequest.() -> ChatJoinRequest?
|
||||||
|
|
||||||
|
private suspend fun <O> BehaviourContext.waitChatJoinRequests(
|
||||||
|
count: Int = 1,
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null },
|
||||||
|
filter: SimpleFilter<ChatJoinRequest>? = null,
|
||||||
|
mapper: suspend ChatJoinRequest.() -> O?
|
||||||
|
): List<O> = expectFlow(
|
||||||
|
initRequest,
|
||||||
|
count,
|
||||||
|
errorFactory
|
||||||
|
) {
|
||||||
|
val data = it.asChatJoinRequestUpdate() ?.data
|
||||||
|
if (data != null && (filter == null || filter(data))) {
|
||||||
|
data.mapper().let(::listOfNotNull)
|
||||||
|
} else {
|
||||||
|
emptyList()
|
||||||
|
}
|
||||||
|
}.toList().toList()
|
||||||
|
|
||||||
|
|
||||||
|
suspend fun BehaviourContext.waitChatJoinRequests(
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null },
|
||||||
|
count: Int = 1,
|
||||||
|
filter: SimpleFilter<ChatJoinRequest>? = null,
|
||||||
|
mapper: ChatJoinRequestsMapper? = null
|
||||||
|
) : List<ChatJoinRequest> = waitChatJoinRequests(
|
||||||
|
count,
|
||||||
|
initRequest,
|
||||||
|
errorFactory,
|
||||||
|
filter
|
||||||
|
) {
|
||||||
|
if (mapper == null) {
|
||||||
|
this
|
||||||
|
} else {
|
||||||
|
mapper(this)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -119,14 +119,6 @@ suspend fun BehaviourContext.waitEditedStaticLocation(
|
|||||||
filter: SimpleFilter<CommonMessage<StaticLocationContent>>? = null,
|
filter: SimpleFilter<CommonMessage<StaticLocationContent>>? = null,
|
||||||
mapper: CommonMessageToContentMapper<StaticLocationContent>? = null
|
mapper: CommonMessageToContentMapper<StaticLocationContent>? = null
|
||||||
) = waitEditedContent(count, initRequest, false, errorFactory, filter, mapper)
|
) = waitEditedContent(count, initRequest, false, errorFactory, filter, mapper)
|
||||||
@Deprecated("Potentially, this trigger will never be used. Use `waitPollUpdates` instead")
|
|
||||||
suspend fun BehaviourContext.waitEditedPoll(
|
|
||||||
initRequest: Request<*>? = null,
|
|
||||||
errorFactory: NullableRequestBuilder<*> = { null },
|
|
||||||
count: Int = 1,
|
|
||||||
filter: SimpleFilter<CommonMessage<PollContent>>? = null,
|
|
||||||
mapper: CommonMessageToContentMapper<PollContent>? = null
|
|
||||||
) = waitEditedContent(count, initRequest, false, errorFactory, filter, mapper)
|
|
||||||
suspend fun BehaviourContext.waitEditedText(
|
suspend fun BehaviourContext.waitEditedText(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null },
|
errorFactory: NullableRequestBuilder<*> = { null },
|
||||||
|
|||||||
@@ -234,3 +234,10 @@ suspend fun BehaviourContext.waitSuccessfulPaymentEvents(
|
|||||||
filter: SimpleFilter<ChatEventMessage<SuccessfulPaymentEvent>>? = null,
|
filter: SimpleFilter<ChatEventMessage<SuccessfulPaymentEvent>>? = null,
|
||||||
mapper: EventMessageToEventMapper<SuccessfulPaymentEvent>? = null
|
mapper: EventMessageToEventMapper<SuccessfulPaymentEvent>? = null
|
||||||
) = waitEvents(count, initRequest, errorFactory, filter, mapper)
|
) = waitEvents(count, initRequest, errorFactory, filter, mapper)
|
||||||
|
suspend fun BehaviourContext.waitUserLoggedInEvents(
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null },
|
||||||
|
count: Int = 1,
|
||||||
|
filter: SimpleFilter<ChatEventMessage<UserLoggedIn>>? = null,
|
||||||
|
mapper: EventMessageToEventMapper<UserLoggedIn>? = null
|
||||||
|
) = waitEvents(count, initRequest, errorFactory, filter, mapper)
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package dev.inmo.tgbotapi.extensions.behaviour_builder.filters
|
|||||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver
|
||||||
import dev.inmo.tgbotapi.extensions.utils.extensions.sourceChat
|
import dev.inmo.tgbotapi.extensions.utils.extensions.sourceChat
|
||||||
import dev.inmo.tgbotapi.types.CallbackQuery.CallbackQuery
|
import dev.inmo.tgbotapi.types.CallbackQuery.CallbackQuery
|
||||||
|
import dev.inmo.tgbotapi.types.ChatJoinRequest
|
||||||
import dev.inmo.tgbotapi.types.ChatMemberUpdated
|
import dev.inmo.tgbotapi.types.ChatMemberUpdated
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.query.InlineQuery
|
import dev.inmo.tgbotapi.types.InlineQueries.query.InlineQuery
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||||
@@ -54,3 +55,9 @@ val InlineQueryFilterByUser: BehaviourContextAndTwoTypesReceiver<Boolean, Inline
|
|||||||
val ChatMemberUpdatedFilterByChat: BehaviourContextAndTwoTypesReceiver<Boolean, ChatMemberUpdated, Update> = { updated, update ->
|
val ChatMemberUpdatedFilterByChat: BehaviourContextAndTwoTypesReceiver<Boolean, ChatMemberUpdated, Update> = { updated, update ->
|
||||||
update.sourceChat() ?.id == updated.chat.id
|
update.sourceChat() ?.id == updated.chat.id
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Allow only events from the same chat as base [ChatMemberUpdated]
|
||||||
|
*/
|
||||||
|
val ChatJoinRequestFilterByChat: BehaviourContextAndTwoTypesReceiver<Boolean, ChatJoinRequest, Update> = { updated, update ->
|
||||||
|
update.sourceChat() ?.id == updated.chat.id
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.*
|
||||||
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.filters.*
|
||||||
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.SimpleFilter
|
||||||
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.*
|
||||||
|
import dev.inmo.tgbotapi.extensions.utils.asChatJoinRequestUpdate
|
||||||
|
import dev.inmo.tgbotapi.extensions.utils.asShippingQueryUpdate
|
||||||
|
import dev.inmo.tgbotapi.types.ChatJoinRequest
|
||||||
|
import dev.inmo.tgbotapi.types.payments.ShippingQuery
|
||||||
|
import dev.inmo.tgbotapi.types.update.abstracts.Update
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Please, remember that your bot must have `can_invite_users` to receive these requests
|
||||||
|
*
|
||||||
|
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
|
||||||
|
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,
|
||||||
|
* this filter will be used if you will call [dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitContentMessage].
|
||||||
|
* Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own.
|
||||||
|
* Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times]
|
||||||
|
* to combinate several filters
|
||||||
|
* @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously
|
||||||
|
* in one "stream". Output of [markerFactory] will be used as a key for "stream"
|
||||||
|
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
|
||||||
|
* data
|
||||||
|
*/
|
||||||
|
suspend fun <BC : BehaviourContext> BC.onChatJoinRequest(
|
||||||
|
initialFilter: SimpleFilter<ChatJoinRequest>? = null,
|
||||||
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatJoinRequest, Update>? = ChatJoinRequestFilterByChat,
|
||||||
|
markerFactory: MarkerFactory<in ChatJoinRequest, Any> = ByChatChatJoinRequestMarkerFactory,
|
||||||
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatJoinRequest>
|
||||||
|
) = on(markerFactory, initialFilter, subcontextUpdatesFilter, scenarioReceiver) {
|
||||||
|
(it.asChatJoinRequestUpdate() ?.data) ?.let(::listOfNotNull)
|
||||||
|
}
|
||||||
@@ -166,19 +166,6 @@ suspend fun <BC : BehaviourContext> BC.onEditedLocation(
|
|||||||
scenarioReceiver
|
scenarioReceiver
|
||||||
)
|
)
|
||||||
|
|
||||||
@Deprecated("Potentially, this trigger will never be used. Use `onPollUpdated` instead")
|
|
||||||
suspend fun <BC : BehaviourContext> BC.onEditedPoll(
|
|
||||||
initialFilter: CommonMessageFilter<PollContent>? = CommonMessageFilterExcludeMediaGroups,
|
|
||||||
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<PollContent>, Update> = MessageFilterByChat,
|
|
||||||
markerFactory: MarkerFactory<in CommonMessage<PollContent>, Any> = ByChatMessageMarkerFactory,
|
|
||||||
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<PollContent>>
|
|
||||||
)= onEditedContent(
|
|
||||||
initialFilter,
|
|
||||||
subcontextUpdatesFilter,
|
|
||||||
markerFactory,
|
|
||||||
scenarioReceiver
|
|
||||||
)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
|
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
|
||||||
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,
|
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,
|
||||||
|
|||||||
@@ -464,3 +464,22 @@ suspend fun <BC : BehaviourContext> BC.onSuccessfulPayment(
|
|||||||
markerFactory: MarkerFactory<in ChatEventMessage<SuccessfulPaymentEvent>, Any> = ByChatMessageMarkerFactory,
|
markerFactory: MarkerFactory<in ChatEventMessage<SuccessfulPaymentEvent>, Any> = ByChatMessageMarkerFactory,
|
||||||
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatEventMessage<SuccessfulPaymentEvent>>
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatEventMessage<SuccessfulPaymentEvent>>
|
||||||
) = onEvent(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver)
|
) = onEvent(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
|
||||||
|
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,
|
||||||
|
* this filter will be used if you will call [dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitContentMessage].
|
||||||
|
* Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own.
|
||||||
|
* Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times]
|
||||||
|
* to combinate several filters
|
||||||
|
* @param markerFactory Will be used to identify different "stream". [scenarioReceiver] will be called synchronously
|
||||||
|
* in one "stream". Output of [markerFactory] will be used as a key for "stream"
|
||||||
|
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
|
||||||
|
* data
|
||||||
|
*/
|
||||||
|
suspend fun <BC : BehaviourContext> BC.onUserLoggedIn(
|
||||||
|
initialFilter: SimpleFilter<ChatEventMessage<UserLoggedIn>>? = null,
|
||||||
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatEventMessage<UserLoggedIn>, Update>? = MessageFilterByChat,
|
||||||
|
markerFactory: MarkerFactory<in ChatEventMessage<UserLoggedIn>, Any> = ByChatMessageMarkerFactory,
|
||||||
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatEventMessage<UserLoggedIn>>
|
||||||
|
) = onEvent(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver)
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories
|
package dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.types.CallbackQuery.CallbackQuery
|
import dev.inmo.tgbotapi.types.CallbackQuery.CallbackQuery
|
||||||
|
import dev.inmo.tgbotapi.types.ChatJoinRequest
|
||||||
import dev.inmo.tgbotapi.types.payments.PreCheckoutQuery
|
import dev.inmo.tgbotapi.types.payments.PreCheckoutQuery
|
||||||
import dev.inmo.tgbotapi.types.payments.ShippingQuery
|
import dev.inmo.tgbotapi.types.payments.ShippingQuery
|
||||||
|
|
||||||
@@ -8,6 +9,10 @@ object ByUserCallbackQueryMarkerFactory : MarkerFactory<CallbackQuery, Any> {
|
|||||||
override suspend fun invoke(data: CallbackQuery) = data.user
|
override suspend fun invoke(data: CallbackQuery) = data.user
|
||||||
}
|
}
|
||||||
|
|
||||||
|
object ByChatChatJoinRequestMarkerFactory : MarkerFactory<ChatJoinRequest, Any> {
|
||||||
|
override suspend fun invoke(data: ChatJoinRequest) = data.chat
|
||||||
|
}
|
||||||
|
|
||||||
object ByUserShippingQueryMarkerFactory : MarkerFactory<ShippingQuery, Any> {
|
object ByUserShippingQueryMarkerFactory : MarkerFactory<ShippingQuery, Any> {
|
||||||
override suspend fun invoke(data: ShippingQuery) = data.user
|
override suspend fun invoke(data: ShippingQuery) = data.user
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,37 +2,19 @@
|
|||||||
|
|
||||||
[](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi.core)
|
[](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi.core)
|
||||||
|
|
||||||
- [TelegramBotAPI Core](#telegrambotapi-core)
|
|
||||||
* [What is it?](#what-is-it-)
|
|
||||||
* [Compatibility](#compatibility)
|
|
||||||
* [How to implement library?](#how-to-implement-library-)
|
|
||||||
+ [Maven](#maven)
|
|
||||||
+ [Gradle](#gradle)
|
|
||||||
* [How to work with library?](#how-to-work-with-library-)
|
|
||||||
+ [Types](#types)
|
|
||||||
+ [Requests](#requests)
|
|
||||||
+ [RequestsExecutor](#requestsexecutor)
|
|
||||||
+ [Passport](#passport)
|
|
||||||
|
|
||||||
<small><i><a href='http://ecotrust-canada.github.io/markdown-toc/'>Table of contents generated with markdown-toc</a></i></small>
|
|
||||||
|
|
||||||
## What is it?
|
## What is it?
|
||||||
|
|
||||||
Library for Object-Oriented and type-safe work with Telegram Bot API. Most part of some specific solves or unuseful
|
Library for Object-Oriented and type-safe work with Telegram Bot API. Most part of some specific solves or unuseful
|
||||||
moments are describing by official [Telegram Bot API](https://core.telegram.org/bots/api).
|
moments are describing by official [Telegram Bot API](https://core.telegram.org/bots/api).
|
||||||
|
|
||||||
## Compatibility
|
|
||||||
|
|
||||||
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?
|
||||||
|
|
||||||
Common ways to implement this library are presented here. In some cases it will require additional steps
|
Common ways to implement this library are presented here. In some cases it will require additional steps
|
||||||
like inserting of additional libraries (like `kotlin stdlib`). In the examples will be used variable
|
like inserting of additional libraries (like `kotlin stdlib`). In the examples will be used variable
|
||||||
`telegrambotapi.version`, which must be set up by developer. Available versions are presented on
|
`telegrambotapi.version`, which must be set up by developer. Available versions are presented on
|
||||||
[bintray](https://bintray.com/insanusmokrassar/TelegramBotAPI/tgbotapi.core), next version is last published:
|
maven central, next version is last published:
|
||||||
|
|
||||||
[ ](https://bintray.com/insanusmokrassar/TelegramBotAPI/tgbotapi.core/_latestVersion)
|
[](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi.core)
|
||||||
|
|
||||||
Currently, last versions of library can be available from the Maven repository with errors (for the reason difficult in publishing
|
Currently, last versions of library can be available from the Maven repository with errors (for the reason difficult in publishing
|
||||||
of signed artifacts in Bintray). You can:
|
of signed artifacts in Bintray). You can:
|
||||||
|
|||||||
@@ -26,7 +26,13 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
jvm()
|
jvm {
|
||||||
|
compilations.main {
|
||||||
|
kotlinOptions {
|
||||||
|
jvmTarget = "1.8"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
js(IR) {
|
js(IR) {
|
||||||
browser()
|
browser()
|
||||||
nodejs()
|
nodejs()
|
||||||
@@ -94,7 +100,6 @@ kotlin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
java {
|
java {
|
||||||
toolchain {
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||||
languageVersion = JavaLanguageVersion.of(8)
|
targetCompatibility = JavaVersion.VERSION_1_8
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
{"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE"}],"mavenConfig":{"name":"Telegram Bot API Core","description":"Library for Object-Oriented and type-safe work with Telegram Bot API","url":"https://insanusmokrassar.github.io/TelegramBotAPI","vcsUrl":"https://github.com/insanusmokrassar/TelegramBotAPI.git","includeGpgSigning":true,"developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}],"repositories":[{"name":"GithubPackages","url":"https://maven.pkg.github.com/InsanusMokrassar/TelegramBotAPI"},{"name":"sonatype","url":"https://oss.sonatype.org/service/local/staging/deploy/maven2/"}]}}
|
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
apply plugin: 'maven-publish'
|
apply plugin: 'maven-publish'
|
||||||
apply plugin: 'signing'
|
|
||||||
|
|
||||||
task javadocsJar(type: Jar) {
|
task javadocsJar(type: Jar) {
|
||||||
classifier = 'javadoc'
|
classifier = 'javadoc'
|
||||||
@@ -63,7 +62,18 @@ publishing {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
signing {
|
if (project.hasProperty("signing.gnupg.keyName")) {
|
||||||
useGpgCmd()
|
apply plugin: 'signing'
|
||||||
sign publishing.publications
|
|
||||||
|
signing {
|
||||||
|
useGpgCmd()
|
||||||
|
|
||||||
|
sign publishing.publications
|
||||||
|
}
|
||||||
|
|
||||||
|
task signAll {
|
||||||
|
tasks.withType(Sign).forEach {
|
||||||
|
dependsOn(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
1
tgbotapi.core/publish.kpsb
Normal file
1
tgbotapi.core/publish.kpsb
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE"}],"mavenConfig":{"name":"Telegram Bot API Core","description":"Library for Object-Oriented and type-safe work with Telegram Bot API","url":"https://insanusmokrassar.github.io/TelegramBotAPI","vcsUrl":"https://github.com/insanusmokrassar/TelegramBotAPI.git","developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}],"repositories":[{"name":"GithubPackages","url":"https://maven.pkg.github.com/InsanusMokrassar/TelegramBotAPI"},{"name":"sonatype","url":"https://oss.sonatype.org/service/local/staging/deploy/maven2/"}],"gpgSigning":{"type":"dev.inmo.kmppscriptbuilder.core.models.GpgSigning.Optional"}}}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package dev.inmo.tgbotapi.CommonAbstracts.types
|
||||||
|
|
||||||
|
interface ProtectContent {
|
||||||
|
val protectContent: Boolean
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package dev.inmo.tgbotapi.bot.Ktor.base
|
package dev.inmo.tgbotapi.bot.Ktor.base
|
||||||
|
|
||||||
import dev.inmo.micro_utils.coroutines.safely
|
import dev.inmo.micro_utils.coroutines.safely
|
||||||
|
import dev.inmo.micro_utils.coroutines.safelyWithResult
|
||||||
import dev.inmo.tgbotapi.bot.Ktor.KtorCallFactory
|
import dev.inmo.tgbotapi.bot.Ktor.KtorCallFactory
|
||||||
import dev.inmo.tgbotapi.bot.exceptions.newRequestException
|
import dev.inmo.tgbotapi.bot.exceptions.newRequestException
|
||||||
import dev.inmo.tgbotapi.requests.GetUpdates
|
import dev.inmo.tgbotapi.requests.GetUpdates
|
||||||
@@ -57,7 +58,7 @@ abstract class AbstractRequestCallFactory : KtorCallFactory {
|
|||||||
val content = response.receive<String>()
|
val content = response.receive<String>()
|
||||||
val responseObject = jsonFormatter.decodeFromString(Response.serializer(), content)
|
val responseObject = jsonFormatter.decodeFromString(Response.serializer(), content)
|
||||||
|
|
||||||
return safely {
|
return safelyWithResult {
|
||||||
(responseObject.result?.let {
|
(responseObject.result?.let {
|
||||||
jsonFormatter.decodeFromJsonElement(request.resultDeserializer, it)
|
jsonFormatter.decodeFromJsonElement(request.resultDeserializer, it)
|
||||||
} ?: response.let {
|
} ?: response.let {
|
||||||
@@ -67,7 +68,7 @@ abstract class AbstractRequestCallFactory : KtorCallFactory {
|
|||||||
"Can't get result object from $content"
|
"Can't get result object from $content"
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
}
|
}.getOrThrow()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package dev.inmo.tgbotapi.requests
|
package dev.inmo.tgbotapi.requests
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.types.MessageAction
|
import dev.inmo.tgbotapi.CommonAbstracts.types.MessageAction
|
||||||
|
import dev.inmo.tgbotapi.CommonAbstracts.types.ProtectContent
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.PossiblyForwardedMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.PossiblyForwardedMessage
|
||||||
@@ -18,8 +19,10 @@ data class ForwardMessage(
|
|||||||
@SerialName(messageIdField)
|
@SerialName(messageIdField)
|
||||||
override val messageId: MessageIdentifier,
|
override val messageId: MessageIdentifier,
|
||||||
@SerialName(disableNotificationField)
|
@SerialName(disableNotificationField)
|
||||||
val disableNotification: Boolean = false
|
val disableNotification: Boolean = false,
|
||||||
): SimpleRequest<PossiblyForwardedMessage>, MessageAction {
|
@SerialName(protectContentField)
|
||||||
|
override val protectContent: Boolean = false
|
||||||
|
): SimpleRequest<PossiblyForwardedMessage>, MessageAction, ProtectContent {
|
||||||
override val chatId: ChatIdentifier
|
override val chatId: ChatIdentifier
|
||||||
get() = fromChatId
|
get() = fromChatId
|
||||||
|
|
||||||
|
|||||||
@@ -5,16 +5,27 @@ import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
|||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import kotlinx.serialization.DeserializationStrategy
|
import kotlinx.serialization.DeserializationStrategy
|
||||||
|
|
||||||
interface ChatInviteLinkRequest : SimpleRequest<CommonInviteLink> {
|
interface ChatInviteLinkRequest<R : SecondaryChatInviteLink> : SimpleRequest<R> {
|
||||||
val chatId: ChatIdentifier
|
val chatId: ChatIdentifier
|
||||||
|
|
||||||
override val resultDeserializer: DeserializationStrategy<CommonInviteLink>
|
|
||||||
get() = CommonInviteLink.serializer()
|
|
||||||
}
|
}
|
||||||
interface KnownChatInviteLinkRequest : ChatInviteLinkRequest {
|
|
||||||
|
interface KnownChatInviteLinkRequest<R : SecondaryChatInviteLink> : ChatInviteLinkRequest<R> {
|
||||||
val inviteLink: String
|
val inviteLink: String
|
||||||
}
|
}
|
||||||
interface EditChatInviteLinkRequest : ChatInviteLinkRequest {
|
|
||||||
val expireDate: DateTime?
|
interface LimitedMembersChatInviteLinkRequest : ChatInviteLinkRequest<ChatInviteLinkWithLimitedMembers> {
|
||||||
val membersLimit: MembersLimit?
|
val membersLimit: MembersLimit
|
||||||
|
|
||||||
|
override val resultDeserializer: DeserializationStrategy<ChatInviteLinkWithLimitedMembers>
|
||||||
|
get() = ChatInviteLinkWithLimitedMembers.serializer()
|
||||||
|
}
|
||||||
|
|
||||||
|
interface WithJoinRequestChatInviteLinkRequest : ChatInviteLinkRequest<ChatInviteLinkWithJoinRequest> {
|
||||||
|
override val resultDeserializer: DeserializationStrategy<ChatInviteLinkWithJoinRequest>
|
||||||
|
get() = ChatInviteLinkWithJoinRequest.serializer()
|
||||||
|
}
|
||||||
|
|
||||||
|
interface EditChatInviteLinkRequest<R : SecondaryChatInviteLink> : ChatInviteLinkRequest<R> {
|
||||||
|
val expireDate: DateTime?
|
||||||
|
val name: String?
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package dev.inmo.tgbotapi.requests.chat.abstracts
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.CommonAbstracts.types.ChatRequest
|
||||||
|
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||||
|
import dev.inmo.tgbotapi.types.ChatId
|
||||||
|
import dev.inmo.tgbotapi.types.UserId
|
||||||
|
|
||||||
|
interface ChatSenderRequest : ChatRequest, SimpleRequest<Boolean> {
|
||||||
|
val senderChatId: ChatId
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
package dev.inmo.tgbotapi.requests.chat.invite_links
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||||
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import kotlinx.serialization.*
|
||||||
|
import kotlinx.serialization.builtins.serializer
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represent a join request answer. See inheritors for more info
|
||||||
|
*/
|
||||||
|
sealed interface ChatJoinRequestAnswer : SimpleRequest<Boolean> {
|
||||||
|
val chatId: ChatIdentifier
|
||||||
|
val userId: UserId
|
||||||
|
|
||||||
|
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||||
|
get() = Boolean.serializer()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represent [approve](https://core.telegram.org/bots/api#approvechatjoinrequest) [ChatJoinRequestAnswer]. You may approve
|
||||||
|
* the requests retrieved in with [ChatJoinRequest] (in [dev.inmo.tgbotapi.types.update.ChatJoinRequestUpdate])
|
||||||
|
*/
|
||||||
|
@Serializable
|
||||||
|
data class ApproveChatJoinRequest(
|
||||||
|
@SerialName(chatIdField)
|
||||||
|
override val chatId: ChatIdentifier,
|
||||||
|
@SerialName(userIdField)
|
||||||
|
override val userId: UserId
|
||||||
|
) : ChatJoinRequestAnswer {
|
||||||
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
|
get() = serializer()
|
||||||
|
|
||||||
|
override fun method(): String = "approveChatJoinRequest"
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represent [decline](https://core.telegram.org/bots/api#declinechatjoinrequest) [ChatJoinRequestAnswer]. You may approve
|
||||||
|
* the requests retrieved in with [ChatJoinRequest] (in [dev.inmo.tgbotapi.types.update.ChatJoinRequestUpdate])
|
||||||
|
*/
|
||||||
|
@Serializable
|
||||||
|
data class DeclineChatJoinRequest(
|
||||||
|
@SerialName(chatIdField)
|
||||||
|
override val chatId: ChatIdentifier,
|
||||||
|
@SerialName(userIdField)
|
||||||
|
override val userId: UserId
|
||||||
|
) : ChatJoinRequestAnswer {
|
||||||
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
|
get() = serializer()
|
||||||
|
|
||||||
|
override fun method(): String = "declineChatJoinRequest"
|
||||||
|
}
|
||||||
@@ -1,31 +1,120 @@
|
|||||||
package dev.inmo.tgbotapi.requests.chat.invite_links
|
package dev.inmo.tgbotapi.requests.chat.invite_links
|
||||||
|
|
||||||
import com.soywiz.klock.DateTime
|
import com.soywiz.klock.DateTime
|
||||||
import dev.inmo.tgbotapi.requests.chat.abstracts.EditChatInviteLinkRequest
|
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||||
|
import dev.inmo.tgbotapi.requests.chat.abstracts.*
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
@Serializable
|
sealed interface CreateChatInviteLink<R : SecondaryChatInviteLink> : EditChatInviteLinkRequest<R> {
|
||||||
data class CreateChatInviteLink(
|
val expirationUnixTimeStamp: TelegramDate?
|
||||||
@SerialName(chatIdField)
|
|
||||||
override val chatId: ChatIdentifier,
|
|
||||||
@SerialName(expireDateField)
|
|
||||||
private val expirationUnixTimeStamp: TelegramDate? = null,
|
|
||||||
@SerialName(memberLimitField)
|
|
||||||
override val membersLimit: MembersLimit? = null
|
|
||||||
) : EditChatInviteLinkRequest {
|
|
||||||
override val expireDate: DateTime?
|
override val expireDate: DateTime?
|
||||||
get() = expirationUnixTimeStamp ?.asDate
|
get() = expirationUnixTimeStamp ?.asDate
|
||||||
override val requestSerializer: SerializationStrategy<*>
|
|
||||||
get() = serializer()
|
|
||||||
|
|
||||||
override fun method(): String = "createChatInviteLink"
|
override fun method(): String = "createChatInviteLink"
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun unlimited(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
name: String? = null,
|
||||||
|
expirationUnixTimeStamp: TelegramDate? = null,
|
||||||
|
) = CreateChatInviteLinkUnlimited(chatId, name, expirationUnixTimeStamp)
|
||||||
|
fun withLimitedMembers(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
membersLimit: MembersLimit,
|
||||||
|
name: String? = null,
|
||||||
|
expirationUnixTimeStamp: TelegramDate? = null,
|
||||||
|
) = CreateChatInviteLinkWithLimitedMembers(chatId, membersLimit, name, expirationUnixTimeStamp)
|
||||||
|
fun withJoinRequest(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
name: String? = null,
|
||||||
|
expirationUnixTimeStamp: TelegramDate? = null,
|
||||||
|
) = CreateChatInviteLinkWithJoinRequest(chatId, name, expirationUnixTimeStamp)
|
||||||
|
fun unlimited(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
expiration: DateTime,
|
||||||
|
name: String? = null,
|
||||||
|
) = unlimited(chatId, name, expiration.toTelegramDate())
|
||||||
|
fun withLimitedMembers(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
membersLimit: MembersLimit,
|
||||||
|
expiration: DateTime,
|
||||||
|
name: String? = null,
|
||||||
|
) = withLimitedMembers(chatId, membersLimit, name, expiration.toTelegramDate())
|
||||||
|
fun withJoinRequest(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
expiration: DateTime,
|
||||||
|
name: String? = null,
|
||||||
|
) = withJoinRequest(chatId, name, expiration.toTelegramDate())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun CreateChatInviteLink(
|
/**
|
||||||
chatId: ChatId,
|
* Represent [https://core.telegram.org/bots/api#createchatinvitelink] request WITHOUT `member_limit`
|
||||||
expireDate: DateTime,
|
* and `creates_join_request`
|
||||||
membersLimit: MembersLimit? = null
|
*
|
||||||
): CreateChatInviteLink = CreateChatInviteLink(
|
* @see CreateChatInviteLink.unlimited
|
||||||
chatId, expireDate.toTelegramDate(), membersLimit
|
* @see CreateChatInviteLinkWithLimitedMembers
|
||||||
)
|
* @see CreateChatInviteLinkWithJoinRequest
|
||||||
|
*/
|
||||||
|
@Serializable
|
||||||
|
data class CreateChatInviteLinkUnlimited(
|
||||||
|
@SerialName(chatIdField)
|
||||||
|
override val chatId: ChatIdentifier,
|
||||||
|
@SerialName(nameField)
|
||||||
|
override val name: String? = null,
|
||||||
|
@SerialName(expireDateField)
|
||||||
|
override val expirationUnixTimeStamp: TelegramDate? = null,
|
||||||
|
) : CreateChatInviteLink<ChatInviteLinkUnlimited> {
|
||||||
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
|
get() = serializer()
|
||||||
|
override val resultDeserializer: DeserializationStrategy<ChatInviteLinkUnlimited>
|
||||||
|
get() = ChatInviteLinkUnlimited.serializer()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represent [https://core.telegram.org/bots/api#createchatinvitelink] request WITH `member_limit`
|
||||||
|
* and WITHOUT `creates_join_request`
|
||||||
|
*
|
||||||
|
* @see CreateChatInviteLink.withLimitedMembers
|
||||||
|
* @see CreateChatInviteLinkUnlimited
|
||||||
|
* @see CreateChatInviteLinkWithJoinRequest
|
||||||
|
*/
|
||||||
|
@Serializable
|
||||||
|
data class CreateChatInviteLinkWithLimitedMembers(
|
||||||
|
@SerialName(chatIdField)
|
||||||
|
override val chatId: ChatIdentifier,
|
||||||
|
@SerialName(memberLimitField)
|
||||||
|
override val membersLimit: MembersLimit,
|
||||||
|
@SerialName(nameField)
|
||||||
|
override val name: String? = null,
|
||||||
|
@SerialName(expireDateField)
|
||||||
|
override val expirationUnixTimeStamp: TelegramDate? = null,
|
||||||
|
) : CreateChatInviteLink<ChatInviteLinkWithLimitedMembers>, LimitedMembersChatInviteLinkRequest {
|
||||||
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
|
get() = serializer()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represent [https://core.telegram.org/bots/api#createchatinvitelink] request WITHOUT `member_limit`
|
||||||
|
* and WITH `creates_join_request`
|
||||||
|
*
|
||||||
|
* @see CreateChatInviteLink.withJoinRequest
|
||||||
|
* @see CreateChatInviteLinkUnlimited
|
||||||
|
* @see CreateChatInviteLinkWithLimitedMembers
|
||||||
|
*/
|
||||||
|
@Serializable
|
||||||
|
data class CreateChatInviteLinkWithJoinRequest(
|
||||||
|
@SerialName(chatIdField)
|
||||||
|
override val chatId: ChatIdentifier,
|
||||||
|
@SerialName(nameField)
|
||||||
|
override val name: String? = null,
|
||||||
|
@SerialName(expireDateField)
|
||||||
|
override val expirationUnixTimeStamp: TelegramDate? = null,
|
||||||
|
) : CreateChatInviteLink<ChatInviteLinkWithJoinRequest>, WithJoinRequestChatInviteLinkRequest {
|
||||||
|
@Required
|
||||||
|
@SerialName(createsJoinRequestField)
|
||||||
|
private val createsJoinRequest: Boolean = true
|
||||||
|
|
||||||
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
|
get() = serializer()
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,35 +1,134 @@
|
|||||||
package dev.inmo.tgbotapi.requests.chat.invite_links
|
package dev.inmo.tgbotapi.requests.chat.invite_links
|
||||||
|
|
||||||
import com.soywiz.klock.DateTime
|
import com.soywiz.klock.DateTime
|
||||||
import dev.inmo.tgbotapi.requests.chat.abstracts.EditChatInviteLinkRequest
|
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||||
import dev.inmo.tgbotapi.requests.chat.abstracts.KnownChatInviteLinkRequest
|
import dev.inmo.tgbotapi.requests.chat.abstracts.*
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
|
sealed interface EditChatInviteLink<R : SecondaryChatInviteLink> : EditChatInviteLinkRequest<R>, KnownChatInviteLinkRequest<R> {
|
||||||
|
val expirationUnixTimeStamp: TelegramDate?
|
||||||
|
override val expireDate: DateTime?
|
||||||
|
get() = expirationUnixTimeStamp ?.asDate
|
||||||
|
override fun method(): String = "editChatInviteLink"
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun unlimited(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
inviteLink: String,
|
||||||
|
name: String? = null,
|
||||||
|
expirationUnixTimeStamp: TelegramDate? = null,
|
||||||
|
) = EditChatInviteLinkUnlimited(chatId, inviteLink, name, expirationUnixTimeStamp)
|
||||||
|
fun withLimitedMembers(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
inviteLink: String,
|
||||||
|
membersLimit: MembersLimit,
|
||||||
|
name: String? = null,
|
||||||
|
expirationUnixTimeStamp: TelegramDate? = null,
|
||||||
|
) = EditChatInviteLinkWithLimitedMembers(chatId, inviteLink, membersLimit, name, expirationUnixTimeStamp)
|
||||||
|
fun withJoinRequest(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
inviteLink: String,
|
||||||
|
name: String? = null,
|
||||||
|
expirationUnixTimeStamp: TelegramDate? = null,
|
||||||
|
) = EditChatInviteLinkWithJoinRequest(chatId, inviteLink, name, expirationUnixTimeStamp)
|
||||||
|
fun unlimited(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
inviteLink: String,
|
||||||
|
expiration: DateTime,
|
||||||
|
name: String? = null,
|
||||||
|
) = unlimited(chatId, inviteLink, name, expiration.toTelegramDate())
|
||||||
|
fun withLimitedMembers(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
inviteLink: String,
|
||||||
|
membersLimit: MembersLimit,
|
||||||
|
expiration: DateTime,
|
||||||
|
name: String? = null,
|
||||||
|
) = withLimitedMembers(chatId, inviteLink, membersLimit, name, expiration.toTelegramDate())
|
||||||
|
fun withJoinRequest(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
inviteLink: String,
|
||||||
|
expiration: DateTime,
|
||||||
|
name: String? = null,
|
||||||
|
) = withJoinRequest(chatId, inviteLink, name, expiration.toTelegramDate())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represent [https://core.telegram.org/bots/api#editchatinvitelink] request WITHOUT `member_limit`
|
||||||
|
* and `creates_join_request`
|
||||||
|
*
|
||||||
|
* @see EditChatInviteLink.unlimited
|
||||||
|
* @see EditChatInviteLinkWithLimitedMembers
|
||||||
|
* @see EditChatInviteLinkWithJoinRequest
|
||||||
|
*/
|
||||||
@Serializable
|
@Serializable
|
||||||
data class EditChatInviteLink(
|
data class EditChatInviteLinkUnlimited(
|
||||||
@SerialName(chatIdField)
|
@SerialName(chatIdField)
|
||||||
override val chatId: ChatIdentifier,
|
override val chatId: ChatIdentifier,
|
||||||
@SerialName(inviteLinkField)
|
@SerialName(inviteLinkField)
|
||||||
override val inviteLink: String,
|
override val inviteLink: String,
|
||||||
|
@SerialName(nameField)
|
||||||
|
override val name: String? = null,
|
||||||
@SerialName(expireDateField)
|
@SerialName(expireDateField)
|
||||||
private val expirationUnixTimeStamp: TelegramDate? = null,
|
override val expirationUnixTimeStamp: TelegramDate? = null,
|
||||||
@SerialName(memberLimitField)
|
) : EditChatInviteLink<ChatInviteLinkUnlimited> {
|
||||||
override val membersLimit: MembersLimit? = null
|
|
||||||
) : EditChatInviteLinkRequest, KnownChatInviteLinkRequest {
|
|
||||||
override val expireDate: DateTime?
|
|
||||||
get() = expirationUnixTimeStamp ?.asDate
|
|
||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
|
override val resultDeserializer: DeserializationStrategy<ChatInviteLinkUnlimited>
|
||||||
override fun method(): String = "editChatInviteLink"
|
get() = ChatInviteLinkUnlimited.serializer()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun EditChatInviteLink(
|
/**
|
||||||
chatId: ChatIdentifier,
|
* Represent [https://core.telegram.org/bots/api#editchatinvitelink] request WITH `member_limit`
|
||||||
inviteLink: String,
|
* and WITHOUT `creates_join_request`
|
||||||
expireDate: DateTime,
|
*
|
||||||
membersLimit: MembersLimit? = null
|
* @see EditChatInviteLink.withLimitedMembers
|
||||||
): EditChatInviteLink = EditChatInviteLink(
|
* @see EditChatInviteLinkUnlimited
|
||||||
chatId, inviteLink, expireDate.toTelegramDate(), membersLimit
|
* @see EditChatInviteLinkWithJoinRequest
|
||||||
)
|
*/
|
||||||
|
@Serializable
|
||||||
|
data class EditChatInviteLinkWithLimitedMembers(
|
||||||
|
@SerialName(chatIdField)
|
||||||
|
override val chatId: ChatIdentifier,
|
||||||
|
@SerialName(inviteLinkField)
|
||||||
|
override val inviteLink: String,
|
||||||
|
@SerialName(memberLimitField)
|
||||||
|
override val membersLimit: MembersLimit,
|
||||||
|
@SerialName(nameField)
|
||||||
|
override val name: String? = null,
|
||||||
|
@SerialName(expireDateField)
|
||||||
|
override val expirationUnixTimeStamp: TelegramDate? = null,
|
||||||
|
) : EditChatInviteLink<ChatInviteLinkWithLimitedMembers>,
|
||||||
|
LimitedMembersChatInviteLinkRequest {
|
||||||
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
|
get() = serializer()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represent [https://core.telegram.org/bots/api#editchatinvitelink] request WITHOUT `member_limit`
|
||||||
|
* and WITH `creates_join_request`
|
||||||
|
*
|
||||||
|
* @see EditChatInviteLink.withJoinRequest
|
||||||
|
* @see EditChatInviteLinkUnlimited
|
||||||
|
* @see EditChatInviteLinkWithLimitedMembers
|
||||||
|
*/
|
||||||
|
@Serializable
|
||||||
|
data class EditChatInviteLinkWithJoinRequest(
|
||||||
|
@SerialName(chatIdField)
|
||||||
|
override val chatId: ChatIdentifier,
|
||||||
|
@SerialName(inviteLinkField)
|
||||||
|
override val inviteLink: String,
|
||||||
|
@SerialName(nameField)
|
||||||
|
override val name: String? = null,
|
||||||
|
@SerialName(expireDateField)
|
||||||
|
override val expirationUnixTimeStamp: TelegramDate? = null,
|
||||||
|
) : EditChatInviteLink<ChatInviteLinkWithJoinRequest>,
|
||||||
|
WithJoinRequestChatInviteLinkRequest {
|
||||||
|
@Required
|
||||||
|
@SerialName(createsJoinRequestField)
|
||||||
|
private val createsJoinRequest: Boolean = true
|
||||||
|
|
||||||
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
|
get() = serializer()
|
||||||
|
}
|
||||||
|
|||||||
@@ -10,9 +10,11 @@ data class RevokeChatInviteLink(
|
|||||||
override val chatId: ChatIdentifier,
|
override val chatId: ChatIdentifier,
|
||||||
@SerialName(inviteLinkField)
|
@SerialName(inviteLinkField)
|
||||||
override val inviteLink: String
|
override val inviteLink: String
|
||||||
) : KnownChatInviteLinkRequest {
|
) : KnownChatInviteLinkRequest<SecondaryChatInviteLink> {
|
||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
|
override val resultDeserializer: DeserializationStrategy<SecondaryChatInviteLink>
|
||||||
|
get() = SecondaryChatInviteLink.serializer()
|
||||||
|
|
||||||
override fun method(): String = "revokeChatInviteLink"
|
override fun method(): String = "revokeChatInviteLink"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package dev.inmo.tgbotapi.requests.chat.members
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.requests.chat.abstracts.ChatSenderRequest
|
||||||
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import kotlinx.serialization.*
|
||||||
|
import kotlinx.serialization.builtins.serializer
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representation of [banChatSenderChat](https://core.telegram.org/bots/api#banchatsenderchat) request
|
||||||
|
*/
|
||||||
|
@Serializable
|
||||||
|
data class BanChatSenderChat(
|
||||||
|
@SerialName(chatIdField)
|
||||||
|
override val chatId: ChatIdentifier,
|
||||||
|
@SerialName(senderChatIdField)
|
||||||
|
override val senderChatId: ChatId
|
||||||
|
) : ChatSenderRequest {
|
||||||
|
override fun method(): String = "banChatSenderChat"
|
||||||
|
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||||
|
get() = Boolean.serializer()
|
||||||
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
|
get() = serializer()
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package dev.inmo.tgbotapi.requests.chat.members
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.requests.chat.abstracts.ChatSenderRequest
|
||||||
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import kotlinx.serialization.*
|
||||||
|
import kotlinx.serialization.builtins.serializer
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representation of [unbanChatSenderChat](https://core.telegram.org/bots/api#unbanchatsenderchat) request
|
||||||
|
*/
|
||||||
|
@Serializable
|
||||||
|
data class UnbanChatSenderChat(
|
||||||
|
@SerialName(chatIdField)
|
||||||
|
override val chatId: ChatIdentifier,
|
||||||
|
@SerialName(senderChatIdField)
|
||||||
|
override val senderChatId: ChatId
|
||||||
|
) : ChatSenderRequest {
|
||||||
|
override fun method(): String = "unbanChatSenderChat"
|
||||||
|
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||||
|
get() = Boolean.serializer()
|
||||||
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
|
get() = serializer()
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ package dev.inmo.tgbotapi.requests.send
|
|||||||
|
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.TextedOutput
|
import dev.inmo.tgbotapi.CommonAbstracts.TextedOutput
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.types.MessageAction
|
import dev.inmo.tgbotapi.CommonAbstracts.types.MessageAction
|
||||||
|
import dev.inmo.tgbotapi.CommonAbstracts.types.ProtectContent
|
||||||
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.*
|
||||||
@@ -20,10 +21,11 @@ fun CopyMessage(
|
|||||||
text: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = CopyMessage(fromChatId, toChatId, messageId, text, parseMode, null, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = CopyMessage(fromChatId, toChatId, messageId, text, parseMode, null, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
fun CopyMessage(
|
fun CopyMessage(
|
||||||
fromChatId: ChatIdentifier,
|
fromChatId: ChatIdentifier,
|
||||||
@@ -31,6 +33,7 @@ fun CopyMessage(
|
|||||||
messageId: MessageIdentifier,
|
messageId: MessageIdentifier,
|
||||||
entities: List<TextSource>,
|
entities: List<TextSource>,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
@@ -42,6 +45,7 @@ fun CopyMessage(
|
|||||||
null,
|
null,
|
||||||
entities.toRawMessageEntities(),
|
entities.toRawMessageEntities(),
|
||||||
disableNotification,
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
allowSendingWithoutReply,
|
allowSendingWithoutReply,
|
||||||
replyMarkup
|
replyMarkup
|
||||||
@@ -63,6 +67,8 @@ data class CopyMessage internal constructor(
|
|||||||
private val rawEntities: List<RawMessageEntity>? = null,
|
private val rawEntities: List<RawMessageEntity>? = null,
|
||||||
@SerialName(disableNotificationField)
|
@SerialName(disableNotificationField)
|
||||||
override val disableNotification: Boolean = false,
|
override val disableNotification: Boolean = false,
|
||||||
|
@SerialName(protectContentField)
|
||||||
|
override val protectContent: Boolean = false,
|
||||||
@SerialName(replyToMessageIdField)
|
@SerialName(replyToMessageIdField)
|
||||||
override val replyToMessageId: MessageIdentifier? = null,
|
override val replyToMessageId: MessageIdentifier? = null,
|
||||||
@SerialName(allowSendingWithoutReplyField)
|
@SerialName(allowSendingWithoutReplyField)
|
||||||
@@ -72,7 +78,8 @@ data class CopyMessage internal constructor(
|
|||||||
): SimpleRequest<MessageIdentifier>,
|
): SimpleRequest<MessageIdentifier>,
|
||||||
ReplyingMarkupSendMessageRequest<MessageIdentifier>,
|
ReplyingMarkupSendMessageRequest<MessageIdentifier>,
|
||||||
MessageAction,
|
MessageAction,
|
||||||
TextedOutput {
|
TextedOutput,
|
||||||
|
ProtectContent {
|
||||||
override val chatId: ChatIdentifier
|
override val chatId: ChatIdentifier
|
||||||
get() = fromChatId
|
get() = fromChatId
|
||||||
override val textSources: List<TextSource>? by lazy {
|
override val textSources: List<TextSource>? by lazy {
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ data class SendContact(
|
|||||||
val lastName: String? = null,
|
val lastName: String? = null,
|
||||||
@SerialName(disableNotificationField)
|
@SerialName(disableNotificationField)
|
||||||
override val disableNotification: Boolean = false,
|
override val disableNotification: Boolean = false,
|
||||||
|
@SerialName(protectContentField)
|
||||||
|
override val protectContent: Boolean = false,
|
||||||
@SerialName(replyToMessageIdField)
|
@SerialName(replyToMessageIdField)
|
||||||
override val replyToMessageId: MessageIdentifier? = null,
|
override val replyToMessageId: MessageIdentifier? = null,
|
||||||
@SerialName(allowSendingWithoutReplyField)
|
@SerialName(allowSendingWithoutReplyField)
|
||||||
@@ -37,6 +39,7 @@ data class SendContact(
|
|||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
contact: Contact,
|
contact: Contact,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
@@ -46,6 +49,7 @@ data class SendContact(
|
|||||||
contact.firstName,
|
contact.firstName,
|
||||||
contact.lastName,
|
contact.lastName,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
allowSendingWithoutReply,
|
allowSendingWithoutReply,
|
||||||
replyMarkup
|
replyMarkup
|
||||||
@@ -61,6 +65,7 @@ data class SendContact(
|
|||||||
fun Contact.toRequest(
|
fun Contact.toRequest(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
@@ -68,6 +73,7 @@ fun Contact.toRequest(
|
|||||||
chatId,
|
chatId,
|
||||||
this,
|
this,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
allowSendingWithoutReply,
|
allowSendingWithoutReply,
|
||||||
replyMarkup
|
replyMarkup
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ data class SendDice(
|
|||||||
val animationType: DiceAnimationType? = null,
|
val animationType: DiceAnimationType? = null,
|
||||||
@SerialName(disableNotificationField)
|
@SerialName(disableNotificationField)
|
||||||
override val disableNotification: Boolean = false,
|
override val disableNotification: Boolean = false,
|
||||||
|
@SerialName(protectContentField)
|
||||||
|
override val protectContent: Boolean = false,
|
||||||
@SerialName(replyToMessageIdField)
|
@SerialName(replyToMessageIdField)
|
||||||
override val replyToMessageId: MessageIdentifier? = null,
|
override val replyToMessageId: MessageIdentifier? = null,
|
||||||
@SerialName(allowSendingWithoutReplyField)
|
@SerialName(allowSendingWithoutReplyField)
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ fun SendLocation(
|
|||||||
latitude: Double,
|
latitude: Double,
|
||||||
longitude: Double,
|
longitude: Double,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
@@ -31,6 +32,7 @@ fun SendLocation(
|
|||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
allowSendingWithoutReply,
|
allowSendingWithoutReply,
|
||||||
replyMarkup
|
replyMarkup
|
||||||
@@ -41,10 +43,11 @@ fun SendStaticLocation(
|
|||||||
latitude: Double,
|
latitude: Double,
|
||||||
longitude: Double,
|
longitude: Double,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = SendLocation(chatId, latitude, longitude, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = SendLocation(chatId, latitude, longitude, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
fun SendLiveLocation(
|
fun SendLiveLocation(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
@@ -55,6 +58,7 @@ fun SendLiveLocation(
|
|||||||
heading: Degrees? = null,
|
heading: Degrees? = null,
|
||||||
proximityAlertRadius: Meters? = null,
|
proximityAlertRadius: Meters? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
@@ -67,6 +71,7 @@ fun SendLiveLocation(
|
|||||||
heading,
|
heading,
|
||||||
proximityAlertRadius,
|
proximityAlertRadius,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
allowSendingWithoutReply,
|
allowSendingWithoutReply,
|
||||||
replyMarkup
|
replyMarkup
|
||||||
@@ -90,6 +95,8 @@ data class SendLocation internal constructor(
|
|||||||
override val proximityAlertRadius: Meters? = null,
|
override val proximityAlertRadius: Meters? = null,
|
||||||
@SerialName(disableNotificationField)
|
@SerialName(disableNotificationField)
|
||||||
override val disableNotification: Boolean = false,
|
override val disableNotification: Boolean = false,
|
||||||
|
@SerialName(protectContentField)
|
||||||
|
override val protectContent: Boolean = false,
|
||||||
@SerialName(replyToMessageIdField)
|
@SerialName(replyToMessageIdField)
|
||||||
override val replyToMessageId: MessageIdentifier? = null,
|
override val replyToMessageId: MessageIdentifier? = null,
|
||||||
@SerialName(allowSendingWithoutReplyField)
|
@SerialName(allowSendingWithoutReplyField)
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ fun SendTextMessage(
|
|||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
disableWebPagePreview: Boolean? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
@@ -34,6 +35,7 @@ fun SendTextMessage(
|
|||||||
null,
|
null,
|
||||||
disableWebPagePreview,
|
disableWebPagePreview,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
allowSendingWithoutReply,
|
allowSendingWithoutReply,
|
||||||
replyMarkup
|
replyMarkup
|
||||||
@@ -44,6 +46,7 @@ fun SendTextMessage(
|
|||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableWebPagePreview: Boolean? = null,
|
disableWebPagePreview: Boolean? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
@@ -54,6 +57,7 @@ fun SendTextMessage(
|
|||||||
entities.toRawMessageEntities(),
|
entities.toRawMessageEntities(),
|
||||||
disableWebPagePreview,
|
disableWebPagePreview,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
allowSendingWithoutReply,
|
allowSendingWithoutReply,
|
||||||
replyMarkup
|
replyMarkup
|
||||||
@@ -73,6 +77,8 @@ data class SendTextMessage internal constructor(
|
|||||||
override val disableWebPagePreview: Boolean? = null,
|
override val disableWebPagePreview: Boolean? = null,
|
||||||
@SerialName(disableNotificationField)
|
@SerialName(disableNotificationField)
|
||||||
override val disableNotification: Boolean = false,
|
override val disableNotification: Boolean = false,
|
||||||
|
@SerialName(protectContentField)
|
||||||
|
override val protectContent: Boolean = false,
|
||||||
@SerialName(replyToMessageIdField)
|
@SerialName(replyToMessageIdField)
|
||||||
override val replyToMessageId: MessageIdentifier? = null,
|
override val replyToMessageId: MessageIdentifier? = null,
|
||||||
@SerialName(allowSendingWithoutReplyField)
|
@SerialName(allowSendingWithoutReplyField)
|
||||||
|
|||||||
@@ -34,6 +34,8 @@ data class SendVenue(
|
|||||||
val googlePlaceType: GooglePlaceType? = null,
|
val googlePlaceType: GooglePlaceType? = null,
|
||||||
@SerialName(disableNotificationField)
|
@SerialName(disableNotificationField)
|
||||||
override val disableNotification: Boolean = false,
|
override val disableNotification: Boolean = false,
|
||||||
|
@SerialName(protectContentField)
|
||||||
|
override val protectContent: Boolean = false,
|
||||||
@SerialName(replyToMessageIdField)
|
@SerialName(replyToMessageIdField)
|
||||||
override val replyToMessageId: MessageIdentifier? = null,
|
override val replyToMessageId: MessageIdentifier? = null,
|
||||||
@SerialName(allowSendingWithoutReplyField)
|
@SerialName(allowSendingWithoutReplyField)
|
||||||
@@ -49,6 +51,7 @@ data class SendVenue(
|
|||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
venue: Venue,
|
venue: Venue,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
@@ -63,6 +66,7 @@ data class SendVenue(
|
|||||||
googlePlaceId = venue.googlePlaceId,
|
googlePlaceId = venue.googlePlaceId,
|
||||||
googlePlaceType = venue.googlePlaceType,
|
googlePlaceType = venue.googlePlaceType,
|
||||||
disableNotification = disableNotification,
|
disableNotification = disableNotification,
|
||||||
|
protectContent = protectContent,
|
||||||
replyToMessageId = replyToMessageId,
|
replyToMessageId = replyToMessageId,
|
||||||
allowSendingWithoutReply = allowSendingWithoutReply,
|
allowSendingWithoutReply = allowSendingWithoutReply,
|
||||||
replyMarkup = replyMarkup
|
replyMarkup = replyMarkup
|
||||||
@@ -78,6 +82,7 @@ data class SendVenue(
|
|||||||
fun Venue.toRequest(
|
fun Venue.toRequest(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
@@ -85,6 +90,7 @@ fun Venue.toRequest(
|
|||||||
chatId,
|
chatId,
|
||||||
this,
|
this,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
allowSendingWithoutReply,
|
allowSendingWithoutReply,
|
||||||
replyMarkup
|
replyMarkup
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package dev.inmo.tgbotapi.requests.send.abstracts
|
package dev.inmo.tgbotapi.requests.send.abstracts
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.types.DisableNotification
|
import dev.inmo.tgbotapi.CommonAbstracts.types.*
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.types.ReplyMessageId
|
|
||||||
|
|
||||||
interface SendMessageRequest<T: Any> : SendChatMessageRequest<T>, ReplyMessageId, DisableNotification
|
interface SendMessageRequest<T: Any> : SendChatMessageRequest<T>, ReplyMessageId, DisableNotification, ProtectContent
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ data class SendGame (
|
|||||||
val gameShortName: String,
|
val gameShortName: String,
|
||||||
@SerialName(disableNotificationField)
|
@SerialName(disableNotificationField)
|
||||||
override val disableNotification: Boolean = false,
|
override val disableNotification: Boolean = false,
|
||||||
|
@SerialName(protectContentField)
|
||||||
|
override val protectContent: Boolean = false,
|
||||||
@SerialName(replyToMessageIdField)
|
@SerialName(replyToMessageIdField)
|
||||||
override val replyToMessageId: MessageIdentifier? = null,
|
override val replyToMessageId: MessageIdentifier? = null,
|
||||||
@SerialName(allowSendingWithoutReplyField)
|
@SerialName(allowSendingWithoutReplyField)
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ fun SendAnimation(
|
|||||||
width: Int? = null,
|
width: Int? = null,
|
||||||
height: Int? = null,
|
height: Int? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
@@ -47,6 +48,7 @@ fun SendAnimation(
|
|||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
allowSendingWithoutReply,
|
allowSendingWithoutReply,
|
||||||
replyMarkup
|
replyMarkup
|
||||||
@@ -71,6 +73,7 @@ fun SendAnimation(
|
|||||||
width: Int? = null,
|
width: Int? = null,
|
||||||
height: Int? = null,
|
height: Int? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
@@ -91,6 +94,7 @@ fun SendAnimation(
|
|||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
allowSendingWithoutReply,
|
allowSendingWithoutReply,
|
||||||
replyMarkup
|
replyMarkup
|
||||||
@@ -131,6 +135,8 @@ data class SendAnimationData internal constructor(
|
|||||||
override val height: Int? = null,
|
override val height: Int? = null,
|
||||||
@SerialName(disableNotificationField)
|
@SerialName(disableNotificationField)
|
||||||
override val disableNotification: Boolean = false,
|
override val disableNotification: Boolean = false,
|
||||||
|
@SerialName(protectContentField)
|
||||||
|
override val protectContent: Boolean = false,
|
||||||
@SerialName(replyToMessageIdField)
|
@SerialName(replyToMessageIdField)
|
||||||
override val replyToMessageId: MessageIdentifier? = null,
|
override val replyToMessageId: MessageIdentifier? = null,
|
||||||
@SerialName(allowSendingWithoutReplyField)
|
@SerialName(allowSendingWithoutReplyField)
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ fun SendAudio(
|
|||||||
performer: String? = null,
|
performer: String? = null,
|
||||||
title: String? = null,
|
title: String? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
@@ -48,6 +49,7 @@ fun SendAudio(
|
|||||||
performer,
|
performer,
|
||||||
title,
|
title,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
allowSendingWithoutReply,
|
allowSendingWithoutReply,
|
||||||
replyMarkup
|
replyMarkup
|
||||||
@@ -72,6 +74,7 @@ fun SendAudio(
|
|||||||
performer: String? = null,
|
performer: String? = null,
|
||||||
title: String? = null,
|
title: String? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
@@ -92,6 +95,7 @@ fun SendAudio(
|
|||||||
performer,
|
performer,
|
||||||
title,
|
title,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
allowSendingWithoutReply,
|
allowSendingWithoutReply,
|
||||||
replyMarkup
|
replyMarkup
|
||||||
@@ -132,6 +136,8 @@ data class SendAudioData internal constructor(
|
|||||||
override val title: String? = null,
|
override val title: String? = null,
|
||||||
@SerialName(disableNotificationField)
|
@SerialName(disableNotificationField)
|
||||||
override val disableNotification: Boolean = false,
|
override val disableNotification: Boolean = false,
|
||||||
|
@SerialName(protectContentField)
|
||||||
|
override val protectContent: Boolean = false,
|
||||||
@SerialName(replyToMessageIdField)
|
@SerialName(replyToMessageIdField)
|
||||||
override val replyToMessageId: MessageIdentifier? = null,
|
override val replyToMessageId: MessageIdentifier? = null,
|
||||||
@SerialName(allowSendingWithoutReplyField)
|
@SerialName(allowSendingWithoutReplyField)
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ fun SendDocument(
|
|||||||
text: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null,
|
replyMarkup: KeyboardMarkup? = null,
|
||||||
@@ -51,6 +52,7 @@ fun SendDocument(
|
|||||||
parseMode,
|
parseMode,
|
||||||
null,
|
null,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
allowSendingWithoutReply,
|
allowSendingWithoutReply,
|
||||||
replyMarkup,
|
replyMarkup,
|
||||||
@@ -82,6 +84,7 @@ fun SendDocument(
|
|||||||
thumb: InputFile? = null,
|
thumb: InputFile? = null,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null,
|
replyMarkup: KeyboardMarkup? = null,
|
||||||
@@ -100,6 +103,7 @@ fun SendDocument(
|
|||||||
null,
|
null,
|
||||||
entities.toRawMessageEntities(),
|
entities.toRawMessageEntities(),
|
||||||
disableNotification,
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
allowSendingWithoutReply,
|
allowSendingWithoutReply,
|
||||||
replyMarkup,
|
replyMarkup,
|
||||||
@@ -144,6 +148,8 @@ data class SendDocumentData internal constructor(
|
|||||||
private val rawEntities: List<RawMessageEntity>? = null,
|
private val rawEntities: List<RawMessageEntity>? = null,
|
||||||
@SerialName(disableNotificationField)
|
@SerialName(disableNotificationField)
|
||||||
override val disableNotification: Boolean = false,
|
override val disableNotification: Boolean = false,
|
||||||
|
@SerialName(protectContentField)
|
||||||
|
override val protectContent: Boolean = false,
|
||||||
@SerialName(replyToMessageIdField)
|
@SerialName(replyToMessageIdField)
|
||||||
override val replyToMessageId: MessageIdentifier? = null,
|
override val replyToMessageId: MessageIdentifier? = null,
|
||||||
@SerialName(allowSendingWithoutReplyField)
|
@SerialName(allowSendingWithoutReplyField)
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ fun <T : MediaGroupContent> SendMediaGroup(
|
|||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
media: List<MediaGroupMemberInputMedia>,
|
media: List<MediaGroupMemberInputMedia>,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null
|
allowSendingWithoutReply: Boolean? = null
|
||||||
): Request<List<MediaGroupMessage<T>>> {
|
): Request<List<MediaGroupMessage<T>>> {
|
||||||
@@ -47,6 +48,7 @@ fun <T : MediaGroupContent> SendMediaGroup(
|
|||||||
chatId,
|
chatId,
|
||||||
media,
|
media,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
allowSendingWithoutReply
|
allowSendingWithoutReply
|
||||||
)
|
)
|
||||||
@@ -71,9 +73,10 @@ inline fun SendPlaylist(
|
|||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
media: List<AudioMediaGroupMemberInputMedia>,
|
media: List<AudioMediaGroupMemberInputMedia>,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null
|
allowSendingWithoutReply: Boolean? = null
|
||||||
) = SendMediaGroup<AudioContent>(chatId, media, disableNotification, replyToMessageId, allowSendingWithoutReply)
|
) = SendMediaGroup<AudioContent>(chatId, media, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use this method to be sure that you are correctly sending documents media group
|
* Use this method to be sure that you are correctly sending documents media group
|
||||||
@@ -85,9 +88,10 @@ inline fun SendDocumentsGroup(
|
|||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
media: List<DocumentMediaGroupMemberInputMedia>,
|
media: List<DocumentMediaGroupMemberInputMedia>,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null
|
allowSendingWithoutReply: Boolean? = null
|
||||||
) = SendMediaGroup<DocumentContent>(chatId, media, disableNotification, replyToMessageId, allowSendingWithoutReply)
|
) = SendMediaGroup<DocumentContent>(chatId, media, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use this method to be sure that you are correctly sending visual media group
|
* Use this method to be sure that you are correctly sending visual media group
|
||||||
@@ -100,9 +104,10 @@ inline fun SendVisualMediaGroup(
|
|||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
media: List<VisualMediaGroupMemberInputMedia>,
|
media: List<VisualMediaGroupMemberInputMedia>,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null
|
allowSendingWithoutReply: Boolean? = null
|
||||||
) = SendMediaGroup<VisualMediaGroupContent>(chatId, media, disableNotification, replyToMessageId, allowSendingWithoutReply)
|
) = SendMediaGroup<VisualMediaGroupContent>(chatId, media, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply)
|
||||||
|
|
||||||
private val messagesListSerializer: KSerializer<List<MediaGroupMessage<MediaGroupContent>>>
|
private val messagesListSerializer: KSerializer<List<MediaGroupMessage<MediaGroupContent>>>
|
||||||
= ListSerializer(TelegramBotAPIMessageDeserializeOnlySerializerClass())
|
= ListSerializer(TelegramBotAPIMessageDeserializeOnlySerializerClass())
|
||||||
@@ -114,6 +119,8 @@ data class SendMediaGroupData internal constructor(
|
|||||||
val media: List<MediaGroupMemberInputMedia> = emptyList(),
|
val media: List<MediaGroupMemberInputMedia> = emptyList(),
|
||||||
@SerialName(disableNotificationField)
|
@SerialName(disableNotificationField)
|
||||||
override val disableNotification: Boolean = false,
|
override val disableNotification: Boolean = false,
|
||||||
|
@SerialName(protectContentField)
|
||||||
|
override val protectContent: Boolean = false,
|
||||||
@SerialName(replyToMessageIdField)
|
@SerialName(replyToMessageIdField)
|
||||||
override val replyToMessageId: MessageIdentifier? = null,
|
override val replyToMessageId: MessageIdentifier? = null,
|
||||||
@SerialName(allowSendingWithoutReplyField)
|
@SerialName(allowSendingWithoutReplyField)
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ fun SendPhoto(
|
|||||||
text: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
@@ -33,6 +34,7 @@ fun SendPhoto(
|
|||||||
parseMode,
|
parseMode,
|
||||||
null,
|
null,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
allowSendingWithoutReply,
|
allowSendingWithoutReply,
|
||||||
replyMarkup
|
replyMarkup
|
||||||
@@ -50,6 +52,7 @@ fun SendPhoto(
|
|||||||
photo: InputFile,
|
photo: InputFile,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
@@ -61,6 +64,7 @@ fun SendPhoto(
|
|||||||
null,
|
null,
|
||||||
entities.toRawMessageEntities(),
|
entities.toRawMessageEntities(),
|
||||||
disableNotification,
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
allowSendingWithoutReply,
|
allowSendingWithoutReply,
|
||||||
replyMarkup
|
replyMarkup
|
||||||
@@ -90,6 +94,8 @@ data class SendPhotoData internal constructor(
|
|||||||
private val rawEntities: List<RawMessageEntity>? = null,
|
private val rawEntities: List<RawMessageEntity>? = null,
|
||||||
@SerialName(disableNotificationField)
|
@SerialName(disableNotificationField)
|
||||||
override val disableNotification: Boolean = false,
|
override val disableNotification: Boolean = false,
|
||||||
|
@SerialName(protectContentField)
|
||||||
|
override val protectContent: Boolean = false,
|
||||||
@SerialName(replyToMessageIdField)
|
@SerialName(replyToMessageIdField)
|
||||||
override val replyToMessageId: MessageIdentifier? = null,
|
override val replyToMessageId: MessageIdentifier? = null,
|
||||||
@SerialName(allowSendingWithoutReplyField)
|
@SerialName(allowSendingWithoutReplyField)
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ fun SendSticker(
|
|||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
sticker: InputFile,
|
sticker: InputFile,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
@@ -23,6 +24,7 @@ fun SendSticker(
|
|||||||
chatId,
|
chatId,
|
||||||
sticker as? FileId,
|
sticker as? FileId,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
allowSendingWithoutReply,
|
allowSendingWithoutReply,
|
||||||
replyMarkup
|
replyMarkup
|
||||||
@@ -44,6 +46,8 @@ data class SendStickerByFileId internal constructor(
|
|||||||
val sticker: FileId? = null,
|
val sticker: FileId? = null,
|
||||||
@SerialName(disableNotificationField)
|
@SerialName(disableNotificationField)
|
||||||
override val disableNotification: Boolean = false,
|
override val disableNotification: Boolean = false,
|
||||||
|
@SerialName(protectContentField)
|
||||||
|
override val protectContent: Boolean = false,
|
||||||
@SerialName(replyToMessageIdField)
|
@SerialName(replyToMessageIdField)
|
||||||
override val replyToMessageId: MessageIdentifier? = null,
|
override val replyToMessageId: MessageIdentifier? = null,
|
||||||
@SerialName(allowSendingWithoutReplyField)
|
@SerialName(allowSendingWithoutReplyField)
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user