1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2026-06-10 17:47:20 +00:00

Compare commits

..

1 Commits

Author SHA1 Message Date
renovate[bot]
3a06809c70 chore(deps): update dependency gradle to v8.14.3 2025-08-10 12:07:29 +00:00
502 changed files with 6884 additions and 21773 deletions

View File

@@ -28,7 +28,7 @@ jobs:
env: env:
GITHUB_USER: ${{ github.actor }} GITHUB_USER: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to InmoNexus - name: Publish to Gitea
continue-on-error: true continue-on-error: true
run: ./gradlew publishAllPublicationsToInmoNexusRepository run: ./gradlew publishAllPublicationsToInmoNexusRepository
env: env:

1
.gitignore vendored
View File

@@ -1,5 +1,4 @@
.idea .idea
.vscode/
.kotlin .kotlin
out/* out/*
*.iml *.iml

View File

@@ -1,263 +1,5 @@
# TelegramBotAPI changelog # TelegramBotAPI changelog
## 33.1.0
* `Versions`:
* `Kotlin`: `2.3.10` -> `2.3.20`
* `Serialization`: `1.10.0` -> `1.11.0`
* `Ktor`: `3.4.1` -> `3.4.2`
* `MicroUtils`: `0.29.1` -> `0.29.2`
* `KSLog`: `1.6.0` -> `1.6.1`
## 33.0.0
**THIS UPDATE CONTAINS ADDING SUPPORT OF [Telegram Bots API 9.6](https://core.telegram.org/bots/api-changelog#april-3-2026)**
**THIS UPDATE CONTAINS BREAKING CHANGES**
* `Core`:
* **THIS IS BREAKING CHANGE** `MultipleAnswersPoll` removed; `RegularPoll` now directly implements `Poll`
* **THIS IS BREAKING CHANGE** `allowMultipleAnswers` renamed to `allowsMultipleAnswers` across poll types and requests
* **THIS IS BREAKING CHANGE** `QuizPoll.correctOptionId: Int?` changed to `correctOptionIds: List<Int>?`
* **THIS IS BREAKING CHANGE** `PollOption` is now a sealed interface with `PollOption.Simple` and `PollOption.LatelyAdded` subtypes; `SimplePollOption` removed
* **THIS IS BREAKING CHANGE** `PollAnswer.Anonymous.voterChat` type changed from `ChannelChat` to `PreviewPublicChat`
* **THIS IS BREAKING CHANGE** `requestChannelReplyButton` (group variant) renamed to `requestGroupReplyButton`
* Added `BotToken` value class
* Added `SavePreparedKeyboardButton` request with `PreparedKeyboardButton` and `PreparedKeyboardButtonId` types
* Added `GetManagedBotToken` and `ReplaceManagedBotToken` requests
* Added `KeyboardButtonRequestManagedBot` and `RequestManagedBotKeyboardButton`
* Added `ManagedBotCreated` chat event and `ManagedBotUpdated` type with `ManagedBotUpdate`
* Added `PollOptionPersistentId` value class
* Added `PollOptionAdded` and `PollOptionDeleted` chat events
* Added `pollOptionId` support in `ReplyParameters` (`reply_to_poll_option_id`)
* Added `canManageBots` to `ExtendedBot`
* Added `allowsRevoting`, `shuffleOptions`, `allowAddingOptions`, `hideResultsUntilCloses`, `description`/`descriptionTextSources` to poll types and send requests
* Added `chosenPersistentIds` to `PollAnswer`
* Added `UsernameAtLessSerializer`
* Extended `openPeriodPollSecondsLimit` from `5..600` to `5..2628000`
* Fixed quiz poll serialization type (was incorrectly using `regularPollType` in quiz branch)
* Fixed quiz poll explanation serialization (now correctly uses `explanation`/`explanationTextSources`)
* Fixed `SendQuizPoll` correct option index range validation (off-by-one)
* Several poll validation checks changed from throwing exceptions to logging warnings
* `API`:
* Added `savePreparedKeyboardButton` extensions
* Added `getManagedBotToken` and `replaceManagedBotToken` extensions
* Added optional `pollOptionId` parameter to `reply`/`replyWith*` extensions
* Updated `sendQuizPoll` extensions with `correctOptionIds`, `allowsMultipleAnswers`, `allowsRevoting`, `shuffleOptions`, `hideResultsUntilCloses`, `description` parameters
* Updated `sendRegularPoll` extensions with `allowsRevoting`, `shuffleOptions`, `allowAddingOptions`, `hideResultsUntilCloses`, `description` parameters
* `BehaviourBuilder`:
* Added `onManagedBotCreated` and `onManagedBotUpdated` triggers
* Added `onPollOptionAdded` and `onPollOptionDeleted` triggers
* Added `waitManagedBotCreatedEvents` and `waitManagedBotUpdated` expectations
* Added `waitPollOptionAddedEvents` and `waitPollOptionDeletedEvents` expectations
* Added `ManagedBotUpdatedFilterByUser` and `ByUserManagedBotUpdatedMarkerFactory`
* `Utils`:
* Added `managedBotCreationLink` formatting extensions
* Added `requestManagedBotButton` to `ReplyKeyboardBuilder`
* Added class casts for `ManagedBotUpdate`, `ManagedBotCreated`, `PollOptionAdded`, `PollOptionDeleted`
* Removed `MultipleAnswersPoll` class casts
* Updated raw poll accessors to match new model (`allowsMultipleAnswers`, `correctOptionIds`, `explanation`)
* Regenerated class casts extensions
* `WebApps`:
* Added `requestChat` support for `PreparedKeyboardButtonId`
* Fixed `iconCustomEmojiId` passing in `BottomButton`
## 32.0.0
**THIS UPDATE CONTAINS BREAKING CHANGES**
* `Version`:
* `Kotlin`: `2.2.21` -> `2.3.10`
* `Kotlin Serialization`: `1.9.0` -> `1.10.0`
* `Ktor`: `3.3.2` -> `3.4.1`
* `KSP`: `2.3.2` -> `2.3.6`
* `MicroUtils`: `0.26.9` -> `0.29.1`
* `KSLog`: `1.5.2` -> `1.6.0`
* `Core` + `API`:
* **BREAKING CHANGES: ALL METHODS THAT PREVIOUSLY RETURNED BOOLEAN NOW RETURNS UNIT**
* `Core`:
* **BREAKING CHANGE** `SetChatTitle` init do not throw error in case when `title.length` is outside of `chatTitleLength`
* **BREAKING CHANGE** `SetStickerEmojiList` init do not throw error in case when `emojis.size` is outside of `emojisInStickerLimit`
* **BREAKING CHANGE** `DeleteMessages` init do not throw error in case when title is `messageIds.size` of `deleteMessagesLimit`
* **BREAKING CHANGE** `ForwardMessages` init do not throw error in case when `messageIds.size` is outside of `forwardMessagesLimit`
* **BREAKING CHANGE** `CopyMessages` init do not throw error in case when `messageIds.size` is outside of `copyMessagesLimit`
* **BREAKING CHANGE** `SwitchInlineQueryChosenChat` init do not throw error in case when `messageIds.size` is outside of `copyMessagesLimit`
* **BREAKING CHANGE** `SetStickerKeywords` init do not throw error in case when there are errors in `keywords`
## 31.2.0
* `Core`:
* Potentially fix [#1027](https://github.com/InsanusMokrassar/ktgbotapi/issues/1027) - drop http request exceptions on getting updates
* `Core` + `API`:
* Add `supportsStreaming` in places it haven't been supported (fix of [#1026](https://github.com/InsanusMokrassar/ktgbotapi/issues/1026))
* **PARTIALLY BREAKING CHANGE** `supportStreaming` has been renamed to `supportsStreaming`
## 31.1.0
**THIS UPDATE CONTAINS ADDING SUPPORT OF [Telegram Bots API 9.5](https://core.telegram.org/bots/api-changelog#march-1-2026)**
* `Core`:
* Added `UserTag` value class and `senderTag` field to messages
* Added `SetChatMemberTag` request and `UserTag` support in `PromoteChatMember` and `ChatPermissions`
* Added `DateTimeTextSource` for `tg://time` links support
* Added `DateTimeFormatPart` and `TgDateTimeFormatBuilder` for building date-time format strings
* Added `UnitFromBooleanSerializer`
* `API`:
* Added `setChatMemberTag` extensions
* `Utils`:
* Added `dateTime` and `dateTimeln` extensions to `EntitiesBuilder`
* Added `dateTimeMarkdown`, `dateTimeMarkdownV2`, and `dateTimeHTML` string formatting extensions
* Regenerated class casts extensions
* `WebApps`:
* Added `iconCustomEmojiId` support to `BottomButton` and `BottomButtonParams`
## 31.0.1
* `Core`:
* In `StarTransaction` property `nanostarAmount` become nullable
## 31.0.0
**THIS UPDATE CONTAINS ADDING SUPPORT OF [Telegram Bots API 9.3](https://core.telegram.org/bots/api-changelog#december-31-2025)**
**THIS UPDATE CONTAINS ADDING SUPPORT OF [Telegram Bots API 9.4](https://core.telegram.org/bots/api-changelog#february-9-2026)**
**THIS UPDATE CONTAINS BREAKING CHANGES**
* `Version`:
* `MicroUtils`: `0.26.8` -> `0.26.9`
* `Core`:
* **THIS IS BREAKING CHANGE** All media files with sizes changed type of `fileSize` field from `Long` to `FileSize` (value class)
* **THIS IS BREAKING CHANGE** Class `GiftSentOrReceived` have been renamed to `GiftSentOrReceivedEvent` to clarify naming
* **THIS IS BREAKING CHANGE** New interface `OwnedGift` have been created
* **THIS IS BREAKING CHANGE** `OwnedGifts` have changed its generic type to `OwnedGift`
* **THIS IS BREAKING CHANGE** For `CheclistTask` have been made several changes:
* `ChecklistTask.Done` -> `ChecklistTask.Completed`
* `ChecklistTask.Undone` -> `ChecklistTask.Uncompleted`
* Added several inheritors of `ChecklistTask.Completed` - for completed by chat, by user or just completed tasks
* **THIS IS BREAKING CHANGE** `PrivateChat.id` type changed from `UserId` to `IdChatIdentifier`
* **THIS IS BREAKING CHANGE** `ForumChat` no longer extends `SupergroupChat`; new `SupergroupForumChat` interface created for supergroup forums
* **THIS IS BREAKING CHANGE** Added `PrivateForumChat` and `PrivateUserChat` interfaces to support private forums
* Added support of private forums (`ExtendedPrivateForumChatImpl`, `PrivateForumContentMessage`, `PrivateForumEventMessage`)
* Added `ChatOwnerChanged` and `ChatOwnerLeft` chat events
* Added `SetMyProfilePhoto` and `RemoveMyProfilePhoto` requests
* Added `GetUserProfileAudios` request and `UserProfileAudios` type
* Added `GetChatGifts` and `GetUserGifts` requests
* Added `RepostStory` request
* Added `SendMessageDraft` request with `DraftId` and `DraftIdAllocator`
* Added `KeyboardButtonStyle` support and `iconCustomEmojiId` field to keyboard buttons
* Added `style` and `iconCustomEmojiId` fields to `InlineKeyboardButton`
* Added `VideoCodec` and `VideoQuality` types
* Added `Rarity`, `GiftBackground`, `UniqueGiftName`, and `UniqueGiftColors` types for gifts
* Added new fields to `Gift.Regular`: `personalTotalCount`, `personalRemainingCount`, `isPremium`, `hasColors`, `background`, `uniqueGiftVariantCount`
* Added `isBurned` field support in `GiftSentOrReceivedEvent`
* Added `UserRating` type and `rating` field to `ExtendedPrivateChat`
* Added `Level` and `Rating` value classes
* Added `uniqueGiftColors` field to extended chats (channel, group, private)
* Added `paidMessageStarCount` field to `ExtendedGroupChat` and `ExtendedPrivateChat`
* Added `firstProfileAudio` field to `ExtendedPrivateChat`
* Added `purchased_paid_media` to updates list
* Added `effectId` support in `CopyMessage` and `ForwardMessage`
* Added `WithOptionalPaidMessageStarCount` interface
* Fixed serialization of `SimpleKeyboardButton`
* Fixed support of `paidMessageStarCount`
* `API`:
* Added extensions for `SetMyProfilePhoto`, `RemoveMyProfilePhoto`, `GetUserProfileAudios`
* Added extensions for `GetChatGifts` and `GetUserGifts`
* Added extensions for `RepostStory`
* Added extensions for `SendMessageDraft`
* Added `effectId` parameter to `copyMessage` and `forwardMessage` extensions
* Added `GetBusinessAccountGifts` extensions improvements
* `BehaviourBuilder`:
* Updated event triggers for new chat events (`ChatOwnerChanged`, `ChatOwnerLeft`, private forum events)
* Updated expectations for new event types
* `Utils`:
* Regenerated class casts extensions
* Updated `InlineKeyboardBuilder` and `ReplyKeyboardBuilder` with `style` and `iconCustomEmojiId` support
## 30.0.2
* `Version`:
* `Kotlin`: `2.2.20` -> `2.2.21`
* `Ktor`: `3.3.1` -> `3.3.2`
* `KSP`: `2.2.20-2.0.4` -> `2.3.2`
* `MicroUtils`: `0.26.6` -> `0.26.8`
* `KSLog`: `1.5.1` -> `1.5.2`
* `Core`:
* Allow to use `SetWebhook` with `maxAllowedConnections` up to `100000` (fix of [#1019](https://github.com/InsanusMokrassar/ktgbotapi/issues/1019))
* `KSP`:
* Fixed annotation property access for KSP2 compatibility using `withNoSuchElementWorkaround`
* Removed `ksp.useKSP2=false` workaround from `gradle.properties` (KSP2 is now properly supported)
* `Utils`:
* Regenerated class casts extensions
* Allow to use custom `GetUpdates` in `longPollingFlow`
## 30.0.1
* `Core`:
* Potential fix of [#989](https://github.com/InsanusMokrassar/ktgbotapi/issues/989) by:
* In long polling have been added check for causing by unresolved address exception
* Add `TelegramBotPipelinesHandler.onRequestExceptionInLimiter` which will be triggered in ANY exception during
request execution
## 30.0.0
**THIS UPDATE MAY CONTAINS BREAKING CHANGES**
* `Version`:
* `Kotlin`: `2.2.10` -> `2.2.20`
* `Ktor`: `3.2.3` -> `3.3.1`
* `MicroUtils`: `0.26.3` -> `0.26.6`
* `KSLog`: `1.5.0` -> `1.5.1`
* `BehaviourBuilder`:
* `DefaultCustomBehaviourContextAndTypeReceiver` now extends `suspend (BC, U) -> R` instead of `CustomBehaviourContextAndTypeReceiver<BC, R, U>` (no changes in api in fact)
## 29.0.1
* `Core`:
* Fix of [#917](https://github.com/InsanusMokrassar/ktgbotapi/issues/917): all `OrderInfo` fields now have defaults nulls
## 29.0.0
**THIS UPDATE CONTAINS ADDING SUPPORT OF [Telegram Bots API 9.2](https://core.telegram.org/bots/api-changelog#august-15-2025)**
**THIS UPDATE CONTAINS BREAKING CHANGES**
* `Core`:
* Add function `firstOfOrNull(vararg suspend () -> T): T?`
* Change logic of `firstOf` - now it works based on merged flows and __do not require__ `CoroutineScope` as receiver
## 28.0.3
* `Core`:
* Add passing of default engines in `HttpClient` constructors
## 28.0.2
* `Core`:
* [#1001](https://github.com/InsanusMokrassar/ktgbotapi/issues/1001) - `[Bug] Invalid detection of isCausedByCancellation()`
* [#1002](https://github.com/InsanusMokrassar/ktgbotapi/issues/1002) - `Unable to handle UnauthorizedException with buildBehaviourWithLongPolling`
## 28.0.1
* `Version`:
* `Kotlin`: `2.2.0` -> `2.2.10`
* `MicroUtils`: `0.26.2` -> `0.26.3`
* `Ktor`: `3.2.2` -> `3.2.3`
* `Core`:
* Let all `OptionallyMessageThreadRequest` inheritors to use `@EncodeDefault` annotation to fix default value passing
## 28.0.0
**THIS UPDATE CONTAINS BREAKING CHANGES**
* `Core`:
* Add `firstOf` extension
* `BehaviourBuilder`:
* All builders for behaviours got boolean `useDefaultSubcontextInitialAction`
* Add opportunity to pass `BehaviourContextData` in `DefaultBehaviourContext` constructor and `copy` method
* By default, commands to other bots will be ignored in triggers and waiters
## 27.1.2 ## 27.1.2
* `Core`: * `Core`:

View File

@@ -1,4 +1,4 @@
# TelegramBotAPI [![Maven Central Version](https://img.shields.io/maven-central/v/dev.inmo/tgbotapi)](https://central.sonatype.com/artifact/dev.inmo/tgbotapi) [![Supported version](https://img.shields.io/badge/Telegram%20Bot%20API-9.6-blue)](https://core.telegram.org/bots/api-changelog#april-3-2026) # TelegramBotAPI [![Maven Central Version](https://img.shields.io/maven-central/v/dev.inmo/tgbotapi)](https://central.sonatype.com/artifact/dev.inmo/tgbotapi) [![Supported version](https://img.shields.io/badge/Telegram%20Bot%20API-9.1-blue)](https://core.telegram.org/bots/api-changelog#july-3-2025)
| Docs | [![KDocs](https://img.shields.io/static/v1?label=Dokka&message=KDocs&color=blue&logo=kotlin)](https://tgbotapi.inmo.dev/index.html) [![Mini tutorial](https://img.shields.io/static/v1?label=Mk&message=Docs&color=blue&logo=mkdocs)](https://docs.inmo.dev/tgbotapi/index.html) | | Docs | [![KDocs](https://img.shields.io/static/v1?label=Dokka&message=KDocs&color=blue&logo=kotlin)](https://tgbotapi.inmo.dev/index.html) [![Mini tutorial](https://img.shields.io/static/v1?label=Mk&message=Docs&color=blue&logo=mkdocs)](https://docs.inmo.dev/tgbotapi/index.html) |
|:----------------------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:| |:----------------------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|

View File

@@ -28,7 +28,7 @@ if ((project.hasProperty('SONATYPE_USER') || System.getenv('SONATYPE_USER') != n
username = project.hasProperty('SONATYPE_USER') ? project.property('SONATYPE_USER') : System.getenv('SONATYPE_USER') username = project.hasProperty('SONATYPE_USER') ? project.property('SONATYPE_USER') : System.getenv('SONATYPE_USER')
password = project.hasProperty('SONATYPE_PASSWORD') ? project.property('SONATYPE_PASSWORD') : System.getenv('SONATYPE_PASSWORD') password = project.hasProperty('SONATYPE_PASSWORD') ? project.property('SONATYPE_PASSWORD') : System.getenv('SONATYPE_PASSWORD')
validationTimeout = Duration.ofSeconds(0) validationTimeout = Duration.ofSeconds(0)
publishingType = System.getenv('PUBLISHING_TYPE') != "" ? System.getenv('PUBLISHING_TYPE') : "USER_MANAGED" publishingType = "USER_MANAGED"
} }
publishAllProjectsProbablyBreakingProjectIsolation() publishAllProjectsProbablyBreakingProjectIsolation()

View File

@@ -5,5 +5,8 @@ kotlin.js.generate.externals=true
kotlin.incremental=true kotlin.incremental=true
kotlin.incremental.js=true kotlin.incremental.js=true
# https://github.com/google/ksp/issues/2491
ksp.useKSP2=false
library_group=dev.inmo library_group=dev.inmo
library_version=33.1.0 library_version=27.1.2

View File

@@ -1,28 +1,28 @@
[versions] [versions]
kotlin = "2.3.20" kotlin = "2.2.0"
kotlin-serialization = "1.11.0" kotlin-serialization = "1.9.0"
kotlin-coroutines = "1.10.2" kotlin-coroutines = "1.10.2"
javax-activation = "1.1.1" javax-activation = "1.1.1"
korlibs = "5.4.0" korlibs = "5.4.0"
uuid = "0.8.4" uuid = "0.8.4"
ktor = "3.4.2" ktor = "3.2.2"
ksp = "2.3.6" ksp = "2.2.0-2.0.2"
kotlin-poet = "2.3.0" kotlin-poet = "2.2.0"
microutils = "0.29.2" microutils = "0.26.2"
kslog = "1.6.1" kslog = "1.5.0"
versions = "0.53.0" versions = "0.52.0"
github-release-plugin = "2.5.2" github-release-plugin = "2.5.2"
dokka = "2.0.0" dokka = "2.0.0"
validator = "0.18.1" validator = "0.18.1"
nmcp = "1.4.4" nmcp = "1.0.2"
[libraries] [libraries]
@@ -37,8 +37,6 @@ kotlin-test-js = { module = "org.jetbrains.kotlin:kotlin-test-js", version.ref =
ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" } ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" }
ktor-client-cio = { module = "io.ktor:ktor-client-cio", version.ref = "ktor" } ktor-client-cio = { module = "io.ktor:ktor-client-cio", version.ref = "ktor" }
ktor-client-java = { module = "io.ktor:ktor-client-java", version.ref = "ktor" }
ktor-client-js = { module = "io.ktor:ktor-client-js", version.ref = "ktor" }
ktor-client-curl = { module = "io.ktor:ktor-client-curl", version.ref = "ktor" } ktor-client-curl = { module = "io.ktor:ktor-client-curl", version.ref = "ktor" }
ktor-client-winhttp = { module = "io.ktor:ktor-client-winhttp", version.ref = "ktor" } ktor-client-winhttp = { module = "io.ktor:ktor-client-winhttp", version.ref = "ktor" }
ktor-server = { module = "io.ktor:ktor-server", version.ref = "ktor" } ktor-server = { module = "io.ktor:ktor-server", version.ref = "ktor" }

Binary file not shown.

View File

@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip

317
gradlew vendored
View File

@@ -1,78 +1,129 @@
#!/usr/bin/env sh #!/bin/sh
#
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
############################################################################## ##############################################################################
## #
## Gradle start up script for UN*X # Gradle start up script for POSIX generated by Gradle.
## #
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
############################################################################## ##############################################################################
# Attempt to set APP_HOME # Attempt to set APP_HOME
# Resolve links: $0 may be a link # Resolve links: $0 may be a link
PRG="$0" app_path=$0
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do # Need this for daisy-chained symlinks.
ls=`ls -ld "$PRG"` while
link=`expr "$ls" : '.*-> \(.*\)$'` APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
if expr "$link" : '/.*' > /dev/null; then [ -h "$app_path" ]
PRG="$link" do
else ls=$( ls -ld "$app_path" )
PRG=`dirname "$PRG"`"/$link" link=${ls#*' -> '}
fi case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle" # This is normally unused
APP_BASE_NAME=`basename "$0"` # shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
DEFAULT_JVM_OPTS="" APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum" MAX_FD=maximum
warn ( ) { warn () {
echo "$*" echo "$*"
} } >&2
die ( ) { die () {
echo echo
echo "$*" echo "$*"
echo echo
exit 1 exit 1
} } >&2
# OS specific support (must be 'true' or 'false'). # OS specific support (must be 'true' or 'false').
cygwin=false cygwin=false
msys=false msys=false
darwin=false darwin=false
nonstop=false nonstop=false
case "`uname`" in case "$( uname )" in #(
CYGWIN* ) CYGWIN* ) cygwin=true ;; #(
cygwin=true Darwin* ) darwin=true ;; #(
;; MSYS* | MINGW* ) msys=true ;; #(
Darwin* ) NONSTOP* ) nonstop=true ;;
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar CLASSPATH="\\\"\\\""
# Determine the Java command to use to start the JVM. # Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables # IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java" JAVACMD=$JAVA_HOME/jre/sh/java
else else
JAVACMD="$JAVA_HOME/bin/java" JAVACMD=$JAVA_HOME/bin/java
fi fi
if [ ! -x "$JAVACMD" ] ; then if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
@@ -81,92 +132,120 @@ Please set the JAVA_HOME variable in your environment to match the
location of your Java installation." location of your Java installation."
fi fi
else else
JAVACMD="java" JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the Please set the JAVA_HOME variable in your environment to match the
location of your Java installation." location of your Java installation."
fi
fi fi
# Increase the maximum file descriptors if we can. # Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
MAX_FD_LIMIT=`ulimit -H -n` case $MAX_FD in #(
if [ $? -eq 0 ] ; then max*)
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
MAX_FD="$MAX_FD_LIMIT" # shellcheck disable=SC2039,SC3045
fi MAX_FD=$( ulimit -H -n ) ||
ulimit -n $MAX_FD warn "Could not query maximum file descriptor limit"
if [ $? -ne 0 ] ; then esac
warn "Could not set maximum file descriptor limit: $MAX_FD" case $MAX_FD in #(
fi '' | soft) :;; #(
else *)
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
fi # shellcheck disable=SC2039,SC3045
fi ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac esac
fi fi
# Escape application args # Collect all arguments for the java command, stacking in reverse order:
save ( ) { # * args from the command line
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done # * the main class name
echo " " # * -classpath
} # * -D...appname settings
APP_ARGS=$(save "$@") # * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# Collect all arguments for the java command, following the shell quoting and substitution rules # For Cygwin or MSYS, switch paths to Windows format before running java
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong JAVACMD=$( cygpath --unix "$JAVACMD" )
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")" # Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@" exec "$JAVACMD" "$@"

80
gradlew.bat vendored
View File

@@ -1,4 +1,22 @@
@if "%DEBUG%" == "" @echo off @rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off
@rem ########################################################################## @rem ##########################################################################
@rem @rem
@rem Gradle startup script for Windows @rem Gradle startup script for Windows
@@ -9,25 +27,29 @@
if "%OS%"=="Windows_NT" setlocal if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0 set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=. if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0 set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME% set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS= set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe @rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1 %JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init if %ERRORLEVEL% equ 0 goto execute
echo. echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. echo location of your Java installation. 1>&2
goto fail goto fail
@@ -35,48 +57,36 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=% set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init if exist "%JAVA_EXE%" goto execute
echo. echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. echo location of your Java installation. 1>&2
goto fail goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute :execute
@rem Setup the command line @rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar set CLASSPATH=
@rem Execute Gradle @rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
:end :end
@rem End local scope for the variables with windows NT shell @rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd if %ERRORLEVEL% equ 0 goto mainEnd
:fail :fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code! rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 set EXIT_CODE=%ERRORLEVEL%
exit /b 1 if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd :mainEnd
if "%OS%"=="Windows_NT" endlocal if "%OS%"=="Windows_NT" endlocal

File diff suppressed because it is too large Load Diff

View File

@@ -3,7 +3,6 @@ package dev.inmo.tgbotapi.extensions.api
import dev.inmo.tgbotapi.bot.ktor.telegramBot import dev.inmo.tgbotapi.bot.ktor.telegramBot
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.utils.TelegramAPIUrlsKeeper import dev.inmo.tgbotapi.utils.TelegramAPIUrlsKeeper
import dev.inmo.tgbotapi.utils.defaultKtorEngine
import dev.inmo.tgbotapi.utils.telegramBotAPIDefaultUrl import dev.inmo.tgbotapi.utils.telegramBotAPIDefaultUrl
import io.ktor.client.HttpClient import io.ktor.client.HttpClient
import io.ktor.client.HttpClientConfig import io.ktor.client.HttpClientConfig
@@ -14,7 +13,7 @@ import io.ktor.client.engine.*
*/ */
public fun telegramBot( public fun telegramBot(
urlsKeeper: TelegramAPIUrlsKeeper, urlsKeeper: TelegramAPIUrlsKeeper,
client: HttpClient = HttpClient(defaultKtorEngine) client: HttpClient = HttpClient()
): TelegramBot = telegramBot(urlsKeeper) { ): TelegramBot = telegramBot(urlsKeeper) {
this.client = client this.client = client
} }
@@ -69,7 +68,7 @@ public fun telegramBot(
apiUrl: String = telegramBotAPIDefaultUrl, apiUrl: String = telegramBotAPIDefaultUrl,
testServer: Boolean = false, testServer: Boolean = false,
fileLinkUrlMapper: TelegramAPIUrlsKeeper.(String) -> String = { "${fileBaseUrl}/$it" }, fileLinkUrlMapper: TelegramAPIUrlsKeeper.(String) -> String = { "${fileBaseUrl}/$it" },
client: HttpClient = HttpClient(defaultKtorEngine) client: HttpClient = HttpClient()
): TelegramBot = telegramBot(TelegramAPIUrlsKeeper(token, testServer, apiUrl, fileLinkUrlMapper), client) ): TelegramBot = telegramBot(TelegramAPIUrlsKeeper(token, testServer, apiUrl, fileLinkUrlMapper), client)
@Suppress("NOTHING_TO_INLINE") @Suppress("NOTHING_TO_INLINE")

View File

@@ -3,4 +3,4 @@ package dev.inmo.tgbotapi.extensions.api
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.local.Close import dev.inmo.tgbotapi.requests.local.Close
public suspend inline fun TelegramBot.executeClose(): Unit = execute(Close) public suspend inline fun TelegramBot.executeClose(): Boolean = execute(Close)

View File

@@ -12,42 +12,42 @@ import dev.inmo.tgbotapi.types.message.content.MediaGroupCollectionContent
public suspend fun TelegramBot.deleteMessage( public suspend fun TelegramBot.deleteMessage(
chatId: ChatIdentifier, chatId: ChatIdentifier,
messageId: MessageId messageId: MessageId
): Unit = execute( ): Boolean = execute(
DeleteMessage(chatId, messageId) DeleteMessage(chatId, messageId)
) )
public suspend fun TelegramBot.deleteMessage( public suspend fun TelegramBot.deleteMessage(
chat: Chat, chat: Chat,
messageId: MessageId messageId: MessageId
): Unit = deleteMessage(chat.id, messageId) ): Boolean = deleteMessage(chat.id, messageId)
public suspend fun TelegramBot.deleteMessage( public suspend fun TelegramBot.deleteMessage(
message: AccessibleMessage message: AccessibleMessage
): Unit { ): Boolean {
val mediaGroupContent = ((message as? ContentMessage<*>) ?.content as? MediaGroupCollectionContent<*>) val mediaGroupContent = ((message as? ContentMessage<*>) ?.content as? MediaGroupCollectionContent<*>)
if (mediaGroupContent == null) { if (mediaGroupContent == null) {
deleteMessage(message.chat, message.messageId) return deleteMessage(message.chat, message.messageId)
} else { } else {
mediaGroupContent.group.forEach { return mediaGroupContent.group.map {
deleteMessage(it.sourceMessage) deleteMessage(it.sourceMessage)
} }.all { it }
} }
} }
public suspend fun TelegramBot.delete( public suspend fun TelegramBot.delete(
chatId: ChatIdentifier, chatId: ChatIdentifier,
messageId: MessageId messageId: MessageId
): Unit = deleteMessage(chatId, messageId) ): Boolean = deleteMessage(chatId, messageId)
public suspend fun TelegramBot.delete( public suspend fun TelegramBot.delete(
chat: Chat, chat: Chat,
messageId: MessageId messageId: MessageId
): Unit = deleteMessage(chat, messageId) ): Boolean = deleteMessage(chat, messageId)
public suspend fun TelegramBot.delete( public suspend fun TelegramBot.delete(
message: AccessibleMessage message: AccessibleMessage
): Unit = deleteMessage(message) ): Boolean = deleteMessage(message)
public suspend fun AccessibleMessage.delete( public suspend fun AccessibleMessage.delete(
requestsExecutor: TelegramBot requestsExecutor: TelegramBot
): Unit = requestsExecutor.deleteMessage(this) ): Boolean = requestsExecutor.deleteMessage(this)

View File

@@ -10,52 +10,52 @@ import kotlin.jvm.JvmName
public suspend fun TelegramBot.deleteMessages( public suspend fun TelegramBot.deleteMessages(
chatId: ChatIdentifier, chatId: ChatIdentifier,
messageIds: List<MessageId> messageIds: List<MessageId>
): Unit = messageIds.chunked(deleteMessagesLimit.last).forEach { ): Boolean = messageIds.chunked(deleteMessagesLimit.last).map {
execute( execute(
DeleteMessages( DeleteMessages(
chatId = chatId, chatId = chatId,
messageIds = it messageIds = it
) )
) )
} }.all { it }
public suspend fun TelegramBot.deleteMessages( public suspend fun TelegramBot.deleteMessages(
chatId: ChatIdentifier, chatId: ChatIdentifier,
messageIds: Array<MessageId> messageIds: Array<MessageId>
): Unit = deleteMessages( ): Boolean = deleteMessages(
chatId = chatId, chatId = chatId,
messageIds = messageIds.toList() messageIds = messageIds.toList()
) )
public suspend fun TelegramBot.deleteMessages( public suspend fun TelegramBot.deleteMessages(
messagesMetas: List<Message.MetaInfo> messagesMetas: List<Message.MetaInfo>
): Unit = messagesMetas.groupBy { it.chatId }.forEach { (chatId, messages) -> ): Boolean = messagesMetas.groupBy { it.chatId }.map { (chatId, messages) ->
deleteMessages( deleteMessages(
chatId = chatId, chatId = chatId,
messageIds = messages.map { it.messageId } messageIds = messages.map { it.messageId }
) )
} }.all { it }
@JvmName("deleteMessagesWithMessages") @JvmName("deleteMessagesWithMessages")
public suspend fun TelegramBot.deleteMessages( public suspend fun TelegramBot.deleteMessages(
messages: List<AccessibleMessage> messages: List<AccessibleMessage>
): Unit = deleteMessages(messages.map { it.metaInfo }) ): Boolean = deleteMessages(messages.map { it.metaInfo })
public suspend fun TelegramBot.delete( public suspend fun TelegramBot.delete(
chatId: ChatIdentifier, chatId: ChatIdentifier,
messageIds: List<MessageId> messageIds: List<MessageId>
): Unit = deleteMessages(chatId = chatId, messageIds = messageIds) ): Boolean = deleteMessages(chatId = chatId, messageIds = messageIds)
public suspend fun TelegramBot.delete( public suspend fun TelegramBot.delete(
chatId: ChatIdentifier, chatId: ChatIdentifier,
messageIds: Array<MessageId> messageIds: Array<MessageId>
): Unit = deleteMessages(chatId = chatId, messageIds = messageIds) ): Boolean = deleteMessages(chatId = chatId, messageIds = messageIds)
public suspend fun TelegramBot.delete( public suspend fun TelegramBot.delete(
messagesMetas: List<Message.MetaInfo> messagesMetas: List<Message.MetaInfo>
): Unit = deleteMessages(messagesMetas) ): Boolean = deleteMessages(messagesMetas)
@JvmName("deleteWithMessages") @JvmName("deleteWithMessages")
public suspend fun TelegramBot.delete( public suspend fun TelegramBot.delete(
messages: List<AccessibleMessage> messages: List<AccessibleMessage>
): Unit = deleteMessages(messages) ): Boolean = deleteMessages(messages)

View File

@@ -3,15 +3,12 @@ package dev.inmo.tgbotapi.extensions.api
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.ForwardMessage import dev.inmo.tgbotapi.requests.ForwardMessage
import dev.inmo.tgbotapi.types.ChatIdentifier import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.DirectMessageThreadId
import dev.inmo.tgbotapi.types.EffectId
import dev.inmo.tgbotapi.types.MessageId import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.MessageThreadId import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.Seconds import dev.inmo.tgbotapi.types.Seconds
import dev.inmo.tgbotapi.types.chat.Chat import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
import dev.inmo.tgbotapi.types.message.abstracts.PossiblyForwardedMessage import dev.inmo.tgbotapi.types.message.abstracts.PossiblyForwardedMessage
import dev.inmo.tgbotapi.types.directMessageThreadId
import dev.inmo.tgbotapi.types.threadId import dev.inmo.tgbotapi.types.threadId
public suspend fun TelegramBot.forwardMessage( public suspend fun TelegramBot.forwardMessage(
@@ -19,23 +16,11 @@ public suspend fun TelegramBot.forwardMessage(
toChatId: ChatIdentifier, toChatId: ChatIdentifier,
messageId: MessageId, messageId: MessageId,
threadId: MessageThreadId? = toChatId.threadId, threadId: MessageThreadId? = toChatId.threadId,
directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId,
startTimestamp: Seconds? = null, startTimestamp: Seconds? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false
effectId: EffectId? = null
): PossiblyForwardedMessage = execute( ): PossiblyForwardedMessage = execute(
ForwardMessage( ForwardMessage(fromChatId, toChatId, messageId, threadId, startTimestamp, disableNotification, protectContent)
fromChatId = fromChatId,
toChatId = toChatId,
messageId = messageId,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
startTimestamp = startTimestamp,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId
)
) )
public suspend fun TelegramBot.forwardMessage( public suspend fun TelegramBot.forwardMessage(
@@ -43,105 +28,45 @@ public suspend fun TelegramBot.forwardMessage(
toChatId: ChatIdentifier, toChatId: ChatIdentifier,
messageId: MessageId, messageId: MessageId,
threadId: MessageThreadId? = toChatId.threadId, threadId: MessageThreadId? = toChatId.threadId,
directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId,
startTimestamp: Seconds? = null, startTimestamp: Seconds? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false
effectId: EffectId? = null ): PossiblyForwardedMessage = forwardMessage(fromChat.id, toChatId, messageId, threadId, startTimestamp, disableNotification, protectContent)
): PossiblyForwardedMessage = forwardMessage(
fromChatId = fromChat.id,
toChatId = toChatId,
messageId = messageId,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
startTimestamp = startTimestamp,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId
)
public suspend fun TelegramBot.forwardMessage( public suspend fun TelegramBot.forwardMessage(
fromChatId: ChatIdentifier, fromChatId: ChatIdentifier,
toChat: Chat, toChat: Chat,
messageId: MessageId, messageId: MessageId,
threadId: MessageThreadId? = toChat.id.threadId, threadId: MessageThreadId? = toChat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = toChat.id.directMessageThreadId,
startTimestamp: Seconds? = null, startTimestamp: Seconds? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false
effectId: EffectId? = null ): PossiblyForwardedMessage = forwardMessage(fromChatId, toChat.id, messageId, threadId, startTimestamp, disableNotification, protectContent)
): PossiblyForwardedMessage = forwardMessage(
fromChatId = fromChatId,
toChatId = toChat.id,
messageId = messageId,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
startTimestamp = startTimestamp,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId
)
public suspend fun TelegramBot.forwardMessage( public suspend fun TelegramBot.forwardMessage(
fromChat: Chat, fromChat: Chat,
toChat: Chat, toChat: Chat,
messageId: MessageId, messageId: MessageId,
threadId: MessageThreadId? = toChat.id.threadId, threadId: MessageThreadId? = toChat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = toChat.id.directMessageThreadId,
startTimestamp: Seconds? = null, startTimestamp: Seconds? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false
effectId: EffectId? = null ): PossiblyForwardedMessage = forwardMessage(fromChat.id, toChat.id, messageId, threadId, startTimestamp, disableNotification, protectContent)
): PossiblyForwardedMessage = forwardMessage(
fromChatId = fromChat.id,
toChatId = toChat.id,
messageId = messageId,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
startTimestamp = startTimestamp,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId
)
public suspend fun TelegramBot.forwardMessage( public suspend fun TelegramBot.forwardMessage(
toChatId: ChatIdentifier, toChatId: ChatIdentifier,
message: AccessibleMessage, message: AccessibleMessage,
threadId: MessageThreadId? = toChatId.threadId, threadId: MessageThreadId? = toChatId.threadId,
directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId,
startTimestamp: Seconds? = null, startTimestamp: Seconds? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false
effectId: EffectId? = null ): PossiblyForwardedMessage = forwardMessage(message.chat, toChatId, message.messageId, threadId, startTimestamp, disableNotification, protectContent)
): PossiblyForwardedMessage = forwardMessage(
fromChat = message.chat,
toChatId = toChatId,
messageId = message.messageId,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
startTimestamp = startTimestamp,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId
)
public suspend fun TelegramBot.forwardMessage( public suspend fun TelegramBot.forwardMessage(
toChat: Chat, toChat: Chat,
message: AccessibleMessage, message: AccessibleMessage,
threadId: MessageThreadId? = toChat.id.threadId, threadId: MessageThreadId? = toChat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = toChat.id.directMessageThreadId,
startTimestamp: Seconds? = null, startTimestamp: Seconds? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false
effectId: EffectId? = null ): PossiblyForwardedMessage = forwardMessage(message.chat, toChat, message.messageId, threadId, startTimestamp, disableNotification, protectContent)
): PossiblyForwardedMessage = forwardMessage(
fromChat = message.chat,
toChat = toChat,
messageId = message.messageId,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
startTimestamp = startTimestamp,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId
)

View File

@@ -13,7 +13,6 @@ public suspend fun TelegramBot.forwardMessages(
fromChatId: ChatIdentifier, fromChatId: ChatIdentifier,
messageIds: List<MessageId>, messageIds: List<MessageId>,
threadId: MessageThreadId? = toChatId.threadId, threadId: MessageThreadId? = toChatId.threadId,
directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
removeCaption: Boolean = false removeCaption: Boolean = false
@@ -24,7 +23,6 @@ public suspend fun TelegramBot.forwardMessages(
fromChatId = fromChatId, fromChatId = fromChatId,
messageIds = it, messageIds = it,
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
removeCaption = removeCaption removeCaption = removeCaption
@@ -37,7 +35,6 @@ public suspend fun TelegramBot.forwardMessages(
fromChatId: ChatIdentifier, fromChatId: ChatIdentifier,
messageIds: Array<MessageId>, messageIds: Array<MessageId>,
threadId: MessageThreadId? = toChatId.threadId, threadId: MessageThreadId? = toChatId.threadId,
directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
removeCaption: Boolean = false removeCaption: Boolean = false
@@ -46,7 +43,6 @@ public suspend fun TelegramBot.forwardMessages(
fromChatId = fromChatId, fromChatId = fromChatId,
messageIds = messageIds.toList(), messageIds = messageIds.toList(),
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
removeCaption = removeCaption removeCaption = removeCaption
@@ -56,7 +52,6 @@ public suspend fun TelegramBot.forwardMessages(
toChatId: ChatIdentifier, toChatId: ChatIdentifier,
messagesMetas: List<Message.MetaInfo>, messagesMetas: List<Message.MetaInfo>,
threadId: MessageThreadId? = toChatId.threadId, threadId: MessageThreadId? = toChatId.threadId,
directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
removeCaption: Boolean = false removeCaption: Boolean = false
@@ -66,7 +61,6 @@ public suspend fun TelegramBot.forwardMessages(
fromChatId = chatId, fromChatId = chatId,
messageIds = messages.map { it.messageId }, messageIds = messages.map { it.messageId },
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
removeCaption = removeCaption removeCaption = removeCaption
@@ -78,7 +72,6 @@ public suspend fun TelegramBot.forwardMessages(
toChatId: ChatIdentifier, toChatId: ChatIdentifier,
messages: List<AccessibleMessage>, messages: List<AccessibleMessage>,
threadId: MessageThreadId? = toChatId.threadId, threadId: MessageThreadId? = toChatId.threadId,
directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
removeCaption: Boolean = false removeCaption: Boolean = false
@@ -86,7 +79,6 @@ public suspend fun TelegramBot.forwardMessages(
toChatId = toChatId, toChatId = toChatId,
messagesMetas = messages.map { it.metaInfo }, messagesMetas = messages.map { it.metaInfo },
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
removeCaption = removeCaption removeCaption = removeCaption
@@ -97,7 +89,6 @@ public suspend fun TelegramBot.forward(
fromChatId: ChatIdentifier, fromChatId: ChatIdentifier,
messageIds: List<MessageId>, messageIds: List<MessageId>,
threadId: MessageThreadId? = toChatId.threadId, threadId: MessageThreadId? = toChatId.threadId,
directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
removeCaption: Boolean = false removeCaption: Boolean = false
@@ -106,7 +97,6 @@ public suspend fun TelegramBot.forward(
fromChatId = fromChatId, fromChatId = fromChatId,
messageIds = messageIds, messageIds = messageIds,
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
removeCaption = removeCaption removeCaption = removeCaption
@@ -117,7 +107,6 @@ public suspend fun TelegramBot.forward(
fromChatId: ChatIdentifier, fromChatId: ChatIdentifier,
messageIds: Array<MessageId>, messageIds: Array<MessageId>,
threadId: MessageThreadId? = toChatId.threadId, threadId: MessageThreadId? = toChatId.threadId,
directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
removeCaption: Boolean = false removeCaption: Boolean = false
@@ -126,7 +115,6 @@ public suspend fun TelegramBot.forward(
fromChatId = fromChatId, fromChatId = fromChatId,
messageIds = messageIds, messageIds = messageIds,
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
removeCaption = removeCaption removeCaption = removeCaption
@@ -136,7 +124,6 @@ public suspend fun TelegramBot.forward(
toChatId: ChatIdentifier, toChatId: ChatIdentifier,
messagesMetas: List<Message.MetaInfo>, messagesMetas: List<Message.MetaInfo>,
threadId: MessageThreadId? = toChatId.threadId, threadId: MessageThreadId? = toChatId.threadId,
directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
removeCaption: Boolean = false removeCaption: Boolean = false
@@ -144,7 +131,6 @@ public suspend fun TelegramBot.forward(
toChatId = toChatId, toChatId = toChatId,
messagesMetas = messagesMetas, messagesMetas = messagesMetas,
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
removeCaption = removeCaption removeCaption = removeCaption
@@ -155,7 +141,6 @@ public suspend fun TelegramBot.forward(
toChatId: ChatIdentifier, toChatId: ChatIdentifier,
messages: List<AccessibleMessage>, messages: List<AccessibleMessage>,
threadId: MessageThreadId? = toChatId.threadId, threadId: MessageThreadId? = toChatId.threadId,
directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
removeCaption: Boolean = false removeCaption: Boolean = false
@@ -163,7 +148,6 @@ public suspend fun TelegramBot.forward(
toChatId = toChatId, toChatId = toChatId,
messages = messages, messages = messages,
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
removeCaption = removeCaption removeCaption = removeCaption

View File

@@ -15,7 +15,6 @@ import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.location.LiveLocation import dev.inmo.tgbotapi.types.location.LiveLocation
import dev.inmo.tgbotapi.types.location.Location import dev.inmo.tgbotapi.types.location.Location
import dev.inmo.tgbotapi.types.message.SuggestedPostParameters
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.content.LiveLocationContent import dev.inmo.tgbotapi.types.message.content.LiveLocationContent
import dev.inmo.tgbotapi.types.message.content.LocationContent import dev.inmo.tgbotapi.types.message.content.LocationContent
@@ -51,13 +50,11 @@ public suspend fun TelegramBot.handleLiveLocation(
locationsFlow: Flow<EditLiveLocationInfo>, locationsFlow: Flow<EditLiveLocationInfo>,
liveTimeMillis: Long = defaultLivePeriodDelayMillis, liveTimeMillis: Long = defaultLivePeriodDelayMillis,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null, effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
sentMessageFlow: FlowCollector<ContentMessage<LiveLocationContent>>? = null sentMessageFlow: FlowCollector<ContentMessage<LiveLocationContent>>? = null
) { ) {
@@ -79,27 +76,25 @@ public suspend fun TelegramBot.handleLiveLocation(
if (capturedLiveLocationMessage == null) { if (capturedLiveLocationMessage == null) {
updateMessageJob ?.start() updateMessageJob ?.start()
currentLiveLocationMessage = send( currentLiveLocationMessage = send(
chatId = chatId, chatId,
latitude = it.latitude, it.latitude,
longitude = it.longitude, it.longitude,
livePeriod = if (liveTimeMillis == indefiniteLivePeriodDelayMillis) { if (liveTimeMillis == indefiniteLivePeriodDelayMillis) {
LiveLocation.INDEFINITE_LIVE_PERIOD LiveLocation.INDEFINITE_LIVE_PERIOD
} else { } else {
ceil(liveTimeMillis.toDouble() / 1000).toInt() ceil(liveTimeMillis.toDouble() / 1000).toInt()
}, },
horizontalAccuracy = it.horizontalAccuracy, it.horizontalAccuracy,
heading = it.heading, it.heading,
proximityAlertRadius = it.proximityAlertRadius, it.proximityAlertRadius,
threadId = threadId, threadId,
directMessageThreadId = directMessageThreadId, businessConnectionId,
businessConnectionId = businessConnectionId, disableNotification,
disableNotification = disableNotification, protectContent,
protectContent = protectContent, allowPaidBroadcast,
allowPaidBroadcast = allowPaidBroadcast, effectId,
effectId = effectId, replyParameters,
suggestedPostParameters = suggestedPostParameters, it.replyMarkup
replyParameters = replyParameters,
replyMarkup = it.replyMarkup
).also { ).also {
sentMessageFlow ?.emit(it) sentMessageFlow ?.emit(it)
} }
@@ -130,13 +125,11 @@ public suspend fun TelegramBot.handleLiveLocation(
locationsFlow: Flow<Location>, locationsFlow: Flow<Location>,
liveTimeMillis: Long = defaultLivePeriodDelayMillis, liveTimeMillis: Long = defaultLivePeriodDelayMillis,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null, effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
sentMessageFlow: FlowCollector<ContentMessage<LiveLocationContent>>? = null sentMessageFlow: FlowCollector<ContentMessage<LiveLocationContent>>? = null
) { ) {
@@ -154,13 +147,11 @@ public suspend fun TelegramBot.handleLiveLocation(
}, },
liveTimeMillis = liveTimeMillis, liveTimeMillis = liveTimeMillis,
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId, effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters, replyParameters = replyParameters,
sentMessageFlow = sentMessageFlow sentMessageFlow = sentMessageFlow
) )
@@ -177,13 +168,11 @@ public suspend fun TelegramBot.handleLiveLocation(
locationsFlow: Flow<Pair<Double, Double>>, locationsFlow: Flow<Pair<Double, Double>>,
liveTimeMillis: Long = defaultLivePeriodDelayMillis, liveTimeMillis: Long = defaultLivePeriodDelayMillis,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null, effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
sentMessageFlow: FlowCollector<ContentMessage<LiveLocationContent>>? = null sentMessageFlow: FlowCollector<ContentMessage<LiveLocationContent>>? = null
) { ) {
@@ -197,13 +186,11 @@ public suspend fun TelegramBot.handleLiveLocation(
}, },
liveTimeMillis = liveTimeMillis, liveTimeMillis = liveTimeMillis,
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId, effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters, replyParameters = replyParameters,
sentMessageFlow = sentMessageFlow sentMessageFlow = sentMessageFlow
) )

View File

@@ -1,5 +1,3 @@
@file:Suppress("KDocUnresolvedReference")
package dev.inmo.tgbotapi.extensions.api package dev.inmo.tgbotapi.extensions.api
import korlibs.time.DateTime import korlibs.time.DateTime
@@ -13,13 +11,11 @@ import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup 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.chat.Chat import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.message.SuggestedPostParameters
import dev.inmo.tgbotapi.types.location.LiveLocation import dev.inmo.tgbotapi.types.location.LiveLocation
import dev.inmo.tgbotapi.types.location.StaticLocation import dev.inmo.tgbotapi.types.location.StaticLocation
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
import dev.inmo.tgbotapi.types.message.content.LocationContent import dev.inmo.tgbotapi.types.message.content.LocationContent
import dev.inmo.tgbotapi.utils.extensions.directMessageThreadIdOrNull
import dev.inmo.tgbotapi.utils.extensions.threadIdOrNull import dev.inmo.tgbotapi.utils.extensions.threadIdOrNull
import io.ktor.utils.io.core.Closeable import io.ktor.utils.io.core.Closeable
import korlibs.time.millisecondsLong import korlibs.time.millisecondsLong
@@ -100,13 +96,11 @@ public suspend fun TelegramBot.startLiveLocation(
initHeading: Degrees? = null, initHeading: Degrees? = null,
initProximityAlertRadius: Meters? = null, initProximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null, effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): LiveLocationProvider { ): LiveLocationProvider {
@@ -121,13 +115,11 @@ public suspend fun TelegramBot.startLiveLocation(
heading = initHeading, heading = initHeading,
proximityAlertRadius = initProximityAlertRadius, proximityAlertRadius = initProximityAlertRadius,
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId, effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters, replyParameters = replyParameters,
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
@@ -155,13 +147,11 @@ public suspend fun TelegramBot.startLiveLocation(
initHeading: Degrees? = null, initHeading: Degrees? = null,
initProximityAlertRadius: Meters? = null, initProximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null, effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): LiveLocationProvider = startLiveLocation( ): LiveLocationProvider = startLiveLocation(
@@ -174,13 +164,11 @@ public suspend fun TelegramBot.startLiveLocation(
initHeading = initHeading, initHeading = initHeading,
initProximityAlertRadius = initProximityAlertRadius, initProximityAlertRadius = initProximityAlertRadius,
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId, effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters, replyParameters = replyParameters,
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
@@ -198,13 +186,11 @@ public suspend fun TelegramBot.startLiveLocation(
initHeading: Degrees? = null, initHeading: Degrees? = null,
initProximityAlertRadius: Meters? = null, initProximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null, effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): LiveLocationProvider = startLiveLocation( ): LiveLocationProvider = startLiveLocation(
@@ -217,13 +203,11 @@ public suspend fun TelegramBot.startLiveLocation(
initHeading = initHeading, initHeading = initHeading,
initProximityAlertRadius = initProximityAlertRadius, initProximityAlertRadius = initProximityAlertRadius,
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId, effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters, replyParameters = replyParameters,
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
@@ -241,13 +225,11 @@ public suspend fun TelegramBot.startLiveLocation(
initHeading: Degrees? = null, initHeading: Degrees? = null,
initProximityAlertRadius: Meters? = null, initProximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null, effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): LiveLocationProvider = startLiveLocation( ): LiveLocationProvider = startLiveLocation(
@@ -260,13 +242,11 @@ public suspend fun TelegramBot.startLiveLocation(
initHeading = initHeading, initHeading = initHeading,
initProximityAlertRadius = initProximityAlertRadius, initProximityAlertRadius = initProximityAlertRadius,
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId, effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters, replyParameters = replyParameters,
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
@@ -285,13 +265,11 @@ public suspend inline fun TelegramBot.replyWithLiveLocation(
initHeading: Degrees? = null, initHeading: Degrees? = null,
initProximityAlertRadius: Meters? = null, initProximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = to.threadIdOrNull, threadId: MessageThreadId? = to.threadIdOrNull,
directMessageThreadId: DirectMessageThreadId? = to.directMessageThreadIdOrNull,
businessConnectionId: BusinessConnectionId? = to.businessConnectionId, businessConnectionId: BusinessConnectionId? = to.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null, effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): LiveLocationProvider = startLiveLocation( ): LiveLocationProvider = startLiveLocation(
@@ -304,13 +282,11 @@ public suspend inline fun TelegramBot.replyWithLiveLocation(
initHeading = initHeading, initHeading = initHeading,
initProximityAlertRadius = initProximityAlertRadius, initProximityAlertRadius = initProximityAlertRadius,
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId, effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = ReplyParameters(to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply), replyParameters = ReplyParameters(to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply),
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
@@ -328,13 +304,11 @@ public suspend inline fun TelegramBot.replyWithLiveLocation(
initHeading: Degrees? = null, initHeading: Degrees? = null,
initProximityAlertRadius: Meters? = null, initProximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = to.threadIdOrNull, threadId: MessageThreadId? = to.threadIdOrNull,
directMessageThreadId: DirectMessageThreadId? = to.directMessageThreadIdOrNull,
businessConnectionId: BusinessConnectionId? = to.businessConnectionId, businessConnectionId: BusinessConnectionId? = to.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null, effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): LiveLocationProvider = startLiveLocation( ): LiveLocationProvider = startLiveLocation(
@@ -346,13 +320,11 @@ public suspend inline fun TelegramBot.replyWithLiveLocation(
initHeading = initHeading, initHeading = initHeading,
initProximityAlertRadius = initProximityAlertRadius, initProximityAlertRadius = initProximityAlertRadius,
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId, effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = ReplyParameters(to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply), replyParameters = ReplyParameters(to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply),
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )

View File

@@ -3,4 +3,4 @@ package dev.inmo.tgbotapi.extensions.api
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.local.LogOut import dev.inmo.tgbotapi.requests.local.LogOut
public suspend inline fun TelegramBot.logOut(): Unit = execute(LogOut) public suspend inline fun TelegramBot.logOut(): Boolean = execute(LogOut)

View File

@@ -1,21 +0,0 @@
package dev.inmo.tgbotapi.extensions.api
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.SavePreparedKeyboardButton
import dev.inmo.tgbotapi.types.ChatId
import dev.inmo.tgbotapi.types.buttons.KeyboardButton
import dev.inmo.tgbotapi.types.buttons.PreparedKeyboardButton
import dev.inmo.tgbotapi.types.chat.User
import dev.inmo.tgbotapi.types.toChatId
public suspend fun TelegramBot.savePreparedKeyboardButton(
userId: ChatId,
button: KeyboardButton
): PreparedKeyboardButton = execute(
SavePreparedKeyboardButton(userId = userId, button = button)
)
public suspend fun TelegramBot.savePreparedKeyboardButton(
user: User,
button: KeyboardButton
): PreparedKeyboardButton = savePreparedKeyboardButton(userId = user.id.toChatId(), button = button)

View File

@@ -11,7 +11,7 @@ public suspend fun TelegramBot.answerCallbackQuery(
showAlert: Boolean? = null, showAlert: Boolean? = null,
url: String? = null, url: String? = null,
cachedTimeSeconds: Int? = null cachedTimeSeconds: Int? = null
): Unit = execute(AnswerCallbackQuery(callbackQueryId, text, showAlert, url, cachedTimeSeconds)) ): Boolean = execute(AnswerCallbackQuery(callbackQueryId, text, showAlert, url, cachedTimeSeconds))
public suspend fun TelegramBot.answerCallbackQuery( public suspend fun TelegramBot.answerCallbackQuery(
callbackQuery: CallbackQuery, callbackQuery: CallbackQuery,
@@ -19,7 +19,7 @@ public suspend fun TelegramBot.answerCallbackQuery(
showAlert: Boolean? = null, showAlert: Boolean? = null,
url: String? = null, url: String? = null,
cachedTimeSeconds: Int? = null cachedTimeSeconds: Int? = null
): Unit = answerCallbackQuery(callbackQuery.id, text, showAlert, url, cachedTimeSeconds) ): Boolean = answerCallbackQuery(callbackQuery.id, text, showAlert, url, cachedTimeSeconds)
public suspend fun TelegramBot.answer( public suspend fun TelegramBot.answer(
callbackQuery: CallbackQuery, callbackQuery: CallbackQuery,
@@ -27,4 +27,4 @@ public suspend fun TelegramBot.answer(
showAlert: Boolean? = null, showAlert: Boolean? = null,
url: String? = null, url: String? = null,
cachedTimeSeconds: Int? = null cachedTimeSeconds: Int? = null
): Unit = answerCallbackQuery(callbackQuery.id, text, showAlert, url, cachedTimeSeconds) ): Boolean = answerCallbackQuery(callbackQuery.id, text, showAlert, url, cachedTimeSeconds)

View File

@@ -14,7 +14,7 @@ public suspend fun TelegramBot.answerInlineQuery(
isPersonal: Boolean? = null, isPersonal: Boolean? = null,
nextOffset: String? = null, nextOffset: String? = null,
button: InlineQueryResultsButton? = null button: InlineQueryResultsButton? = null
): Unit = execute( ): Boolean = execute(
AnswerInlineQuery(inlineQueryID, results, cachedTime, isPersonal, nextOffset, button) AnswerInlineQuery(inlineQueryID, results, cachedTime, isPersonal, nextOffset, button)
) )
@@ -25,7 +25,7 @@ public suspend fun TelegramBot.answerInlineQuery(
isPersonal: Boolean? = null, isPersonal: Boolean? = null,
nextOffset: String? = null, nextOffset: String? = null,
button: InlineQueryResultsButton? = null button: InlineQueryResultsButton? = null
): Unit = answerInlineQuery(inlineQuery.id, results, cachedTime, isPersonal, nextOffset, button) ): Boolean = answerInlineQuery(inlineQuery.id, results, cachedTime, isPersonal, nextOffset, button)
public suspend fun TelegramBot.answer( public suspend fun TelegramBot.answer(
inlineQuery: InlineQuery, inlineQuery: InlineQuery,
@@ -34,7 +34,7 @@ public suspend fun TelegramBot.answer(
isPersonal: Boolean? = null, isPersonal: Boolean? = null,
nextOffset: String? = null, nextOffset: String? = null,
button: InlineQueryResultsButton? = null button: InlineQueryResultsButton? = null
): Unit = answerInlineQuery(inlineQuery.id, results, cachedTime, isPersonal, nextOffset, button) ): Boolean = answerInlineQuery(inlineQuery.id, results, cachedTime, isPersonal, nextOffset, button)
public suspend fun TelegramBot.answerInlineQuery( public suspend fun TelegramBot.answerInlineQuery(
inlineQueryID: InlineQueryId, inlineQueryID: InlineQueryId,
@@ -44,7 +44,7 @@ public suspend fun TelegramBot.answerInlineQuery(
nextOffset: String? = null, nextOffset: String? = null,
switchPmText: String?, switchPmText: String?,
switchPmParameter: String? switchPmParameter: String?
): Unit = execute( ): Boolean = execute(
AnswerInlineQuery(inlineQueryID, results, cachedTime, isPersonal, nextOffset, switchPmText, switchPmParameter) AnswerInlineQuery(inlineQueryID, results, cachedTime, isPersonal, nextOffset, switchPmText, switchPmParameter)
) )
@@ -56,7 +56,7 @@ public suspend fun TelegramBot.answerInlineQuery(
nextOffset: String? = null, nextOffset: String? = null,
switchPmText: String?, switchPmText: String?,
switchPmParameter: String? switchPmParameter: String?
): Unit = answerInlineQuery(inlineQuery.id, results, cachedTime, isPersonal, nextOffset, switchPmText, switchPmParameter) ): Boolean = answerInlineQuery(inlineQuery.id, results, cachedTime, isPersonal, nextOffset, switchPmText, switchPmParameter)
public suspend fun TelegramBot.answer( public suspend fun TelegramBot.answer(
inlineQuery: InlineQuery, inlineQuery: InlineQuery,
@@ -66,4 +66,4 @@ public suspend fun TelegramBot.answer(
nextOffset: String? = null, nextOffset: String? = null,
switchPmText: String?, switchPmText: String?,
switchPmParameter: String? switchPmParameter: String?
): Unit = answerInlineQuery(inlineQuery.id, results, cachedTime, isPersonal, nextOffset, switchPmText, switchPmParameter) ): Boolean = answerInlineQuery(inlineQuery.id, results, cachedTime, isPersonal, nextOffset, switchPmText, switchPmParameter)

View File

@@ -8,16 +8,16 @@ import dev.inmo.tgbotapi.types.payments.PreCheckoutQuery
public suspend fun TelegramBot.answerPreCheckoutQueryOk( public suspend fun TelegramBot.answerPreCheckoutQueryOk(
id: PreCheckoutQueryId id: PreCheckoutQueryId
): Unit = execute(AnswerPreCheckoutQueryOk(id)) ): Boolean = execute(AnswerPreCheckoutQueryOk(id))
public suspend fun TelegramBot.answerPreCheckoutQueryOk( public suspend fun TelegramBot.answerPreCheckoutQueryOk(
preCheckoutQuery: PreCheckoutQuery preCheckoutQuery: PreCheckoutQuery
): Unit = answerPreCheckoutQueryOk(preCheckoutQuery.id) ): Boolean = answerPreCheckoutQueryOk(preCheckoutQuery.id)
public suspend fun TelegramBot.answerPreCheckoutQueryError( public suspend fun TelegramBot.answerPreCheckoutQueryError(
id: PreCheckoutQueryId, id: PreCheckoutQueryId,
error: String error: String
): Unit = execute(AnswerPreCheckoutQueryError(id, error)) ): Boolean = execute(AnswerPreCheckoutQueryError(id, error))
public suspend fun TelegramBot.answerPreCheckoutQueryError( public suspend fun TelegramBot.answerPreCheckoutQueryError(
preCheckoutQuery: PreCheckoutQuery, preCheckoutQuery: PreCheckoutQuery,
error: String error: String
): Unit = answerPreCheckoutQueryError(preCheckoutQuery.id, error) ): Boolean = answerPreCheckoutQueryError(preCheckoutQuery.id, error)

View File

@@ -10,19 +10,19 @@ import dev.inmo.tgbotapi.types.payments.ShippingQuery
public suspend fun TelegramBot.answerShippingQueryOk( public suspend fun TelegramBot.answerShippingQueryOk(
id: ShippingQueryId, id: ShippingQueryId,
shippingOptions: List<ShippingOption> shippingOptions: List<ShippingOption>
): Unit = execute(AnswerShippingQueryOk(id, shippingOptions)) ): Boolean = execute(AnswerShippingQueryOk(id, shippingOptions))
public suspend fun TelegramBot.answerShippingQueryOk( public suspend fun TelegramBot.answerShippingQueryOk(
shippingQuery: ShippingQuery, shippingQuery: ShippingQuery,
shippingOptions: List<ShippingOption> shippingOptions: List<ShippingOption>
): Unit = answerShippingQueryOk(shippingQuery.id, shippingOptions) ): Boolean = answerShippingQueryOk(shippingQuery.id, shippingOptions)
public suspend fun TelegramBot.answerShippingQueryError( public suspend fun TelegramBot.answerShippingQueryError(
id: ShippingQueryId, id: ShippingQueryId,
error: String error: String
): Unit = execute(AnswerShippingQueryError(id, error)) ): Boolean = execute(AnswerShippingQueryError(id, error))
public suspend fun TelegramBot.answerShippingQueryError( public suspend fun TelegramBot.answerShippingQueryError(
shippingQuery: ShippingQuery, shippingQuery: ShippingQuery,
error: String error: String
): Unit = answerShippingQueryError(shippingQuery.id, error) ): Boolean = answerShippingQueryError(shippingQuery.id, error)

View File

@@ -5,8 +5,8 @@ import dev.inmo.tgbotapi.requests.bot.ClearMyDefaultAdministratorRights
public suspend fun TelegramBot.clearMyDefaultAdministratorRights( public suspend fun TelegramBot.clearMyDefaultAdministratorRights(
forChannels: Boolean? = null forChannels: Boolean? = null
): Unit = execute(ClearMyDefaultAdministratorRights(forChannels)) ): Boolean = execute(ClearMyDefaultAdministratorRights(forChannels))
public suspend fun TelegramBot.clearMyDefaultAdministratorRightsForChannels(): Unit = clearMyDefaultAdministratorRights(forChannels = true) public suspend fun TelegramBot.clearMyDefaultAdministratorRightsForChannels(): Boolean = clearMyDefaultAdministratorRights(forChannels = true)
public suspend fun TelegramBot.clearMyDefaultAdministratorRightsForGroupsAndSupergroups(): Unit = clearMyDefaultAdministratorRights(forChannels = false) public suspend fun TelegramBot.clearMyDefaultAdministratorRightsForGroupsAndSupergroups(): Boolean = clearMyDefaultAdministratorRights(forChannels = false)

View File

@@ -9,9 +9,9 @@ import dev.inmo.tgbotapi.types.commands.BotCommandScopeDefault
public suspend fun TelegramBot.deleteMyCommands( public suspend fun TelegramBot.deleteMyCommands(
scope: BotCommandScope = BotCommandScopeDefault, scope: BotCommandScope = BotCommandScopeDefault,
languageCode: IetfLang? languageCode: IetfLang?
): Unit = execute(DeleteMyCommands(scope, languageCode)) ): Boolean = execute(DeleteMyCommands(scope, languageCode))
public suspend fun TelegramBot.deleteMyCommands( public suspend fun TelegramBot.deleteMyCommands(
scope: BotCommandScope = BotCommandScopeDefault, scope: BotCommandScope = BotCommandScopeDefault,
languageCode: String? = null languageCode: String? = null
): Unit = deleteMyCommands(scope, languageCode ?.let(::IetfLang)) ): Boolean = deleteMyCommands(scope, languageCode ?.let(::IetfLang))

View File

@@ -1,6 +0,0 @@
package dev.inmo.tgbotapi.extensions.api.bot
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.bot.RemoveMyProfilePhoto
public suspend fun TelegramBot.removeMyProfilePhoto(): Unit = execute(RemoveMyProfilePhoto)

View File

@@ -11,22 +11,22 @@ public suspend fun TelegramBot.setMyCommands(
commands: List<BotCommand>, commands: List<BotCommand>,
scope: BotCommandScope = BotCommandScopeDefault, scope: BotCommandScope = BotCommandScopeDefault,
languageCode: IetfLang? languageCode: IetfLang?
): Unit = execute(SetMyCommands(commands, scope, languageCode)) ): Boolean = execute(SetMyCommands(commands, scope, languageCode))
public suspend fun TelegramBot.setMyCommands( public suspend fun TelegramBot.setMyCommands(
vararg commands: BotCommand, vararg commands: BotCommand,
scope: BotCommandScope = BotCommandScopeDefault, scope: BotCommandScope = BotCommandScopeDefault,
languageCode: IetfLang? languageCode: IetfLang?
): Unit = setMyCommands(commands.toList(), scope, languageCode) ): Boolean = setMyCommands(commands.toList(), scope, languageCode)
public suspend fun TelegramBot.setMyCommands( public suspend fun TelegramBot.setMyCommands(
commands: List<BotCommand>, commands: List<BotCommand>,
scope: BotCommandScope = BotCommandScopeDefault, scope: BotCommandScope = BotCommandScopeDefault,
languageCode: String? = null languageCode: String? = null
): Unit = setMyCommands(commands, scope, languageCode ?.let(::IetfLang)) ): Boolean = setMyCommands(commands, scope, languageCode ?.let(::IetfLang))
public suspend fun TelegramBot.setMyCommands( public suspend fun TelegramBot.setMyCommands(
vararg commands: BotCommand, vararg commands: BotCommand,
scope: BotCommandScope = BotCommandScopeDefault, scope: BotCommandScope = BotCommandScopeDefault,
languageCode: String? = null languageCode: String? = null
): Unit = setMyCommands(commands.toList(), scope, languageCode) ): Boolean = setMyCommands(commands.toList(), scope, languageCode)

View File

@@ -7,12 +7,12 @@ import dev.inmo.tgbotapi.types.chat.member.ChatCommonAdministratorRights
public suspend fun TelegramBot.setMyDefaultAdministratorRights( public suspend fun TelegramBot.setMyDefaultAdministratorRights(
rights: ChatCommonAdministratorRights, rights: ChatCommonAdministratorRights,
forChannels: Boolean? = null forChannels: Boolean? = null
): Unit = execute(SetMyDefaultAdministratorRights(rights, forChannels)) ): Boolean = execute(SetMyDefaultAdministratorRights(rights, forChannels))
public suspend fun TelegramBot.setMyDefaultAdministratorRightsForChannels( public suspend fun TelegramBot.setMyDefaultAdministratorRightsForChannels(
rights: ChatCommonAdministratorRights rights: ChatCommonAdministratorRights
): Unit = setMyDefaultAdministratorRights(rights, forChannels = true) ): Boolean = setMyDefaultAdministratorRights(rights, forChannels = true)
public suspend fun TelegramBot.setMyDefaultAdministratorRightsForGroupsAndSupergroups( public suspend fun TelegramBot.setMyDefaultAdministratorRightsForGroupsAndSupergroups(
rights: ChatCommonAdministratorRights rights: ChatCommonAdministratorRights
): Unit = setMyDefaultAdministratorRights(rights, forChannels = false) ): Boolean = setMyDefaultAdministratorRights(rights, forChannels = false)

View File

@@ -11,9 +11,9 @@ import dev.inmo.tgbotapi.types.commands.BotCommandScopeDefault
public suspend fun TelegramBot.setMyDescription( public suspend fun TelegramBot.setMyDescription(
description: String? = null, description: String? = null,
languageCode: IetfLang? = null languageCode: IetfLang? = null
): Unit = execute(SetMyDescription(description, languageCode)) ): Boolean = execute(SetMyDescription(description, languageCode))
public suspend fun TelegramBot.setMyDescription( public suspend fun TelegramBot.setMyDescription(
description: String?, description: String?,
languageCode: String? languageCode: String?
): Unit = setMyDescription(description, languageCode ?.let(::IetfLang)) ): Boolean = setMyDescription(description, languageCode ?.let(::IetfLang))

View File

@@ -11,9 +11,9 @@ import dev.inmo.tgbotapi.types.commands.BotCommandScopeDefault
public suspend fun TelegramBot.setMyName( public suspend fun TelegramBot.setMyName(
name: String? = null, name: String? = null,
languageCode: IetfLang? = null languageCode: IetfLang? = null
): Unit = execute(SetMyName(name, languageCode)) ): Boolean = execute(SetMyName(name, languageCode))
public suspend fun TelegramBot.setMyName( public suspend fun TelegramBot.setMyName(
name: String?, name: String?,
languageCode: String? languageCode: String?
): Unit = setMyName(name, languageCode ?.let(::IetfLang)) ): Boolean = setMyName(name, languageCode ?.let(::IetfLang))

View File

@@ -1,9 +0,0 @@
package dev.inmo.tgbotapi.extensions.api.bot
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.bot.SetMyProfilePhoto
import dev.inmo.tgbotapi.requests.business_connection.InputProfilePhoto
public suspend fun TelegramBot.setMyProfilePhoto(
photo: InputProfilePhoto
): Unit = execute(SetMyProfilePhoto(photo))

View File

@@ -7,9 +7,9 @@ import dev.inmo.tgbotapi.requests.bot.SetMyShortDescription
public suspend fun TelegramBot.setMyShortDescription( public suspend fun TelegramBot.setMyShortDescription(
shortDescription: String? = null, shortDescription: String? = null,
languageCode: IetfLang? = null languageCode: IetfLang? = null
): Unit = execute(SetMyShortDescription(shortDescription, languageCode)) ): Boolean = execute(SetMyShortDescription(shortDescription, languageCode))
public suspend fun TelegramBot.setMyShortDescription( public suspend fun TelegramBot.setMyShortDescription(
shortDescription: String?, shortDescription: String?,
languageCode: String? languageCode: String?
): Unit = setMyShortDescription(shortDescription, languageCode ?.let(::IetfLang)) ): Boolean = setMyShortDescription(shortDescription, languageCode ?.let(::IetfLang))

View File

@@ -11,14 +11,14 @@ import dev.inmo.tgbotapi.types.gifts.Gift
public suspend fun TelegramBot.convertGiftToStars( public suspend fun TelegramBot.convertGiftToStars(
businessConnectionId: BusinessConnectionId, businessConnectionId: BusinessConnectionId,
ownedGiftId: GiftId ownedGiftId: GiftId
): Unit = execute( ): Boolean = execute(
ConvertGiftToStars(businessConnectionId, ownedGiftId) ConvertGiftToStars(businessConnectionId, ownedGiftId)
) )
public suspend fun TelegramBot.convertGiftToStars( public suspend fun TelegramBot.convertGiftToStars(
businessConnectionId: BusinessConnectionId, businessConnectionId: BusinessConnectionId,
gift: Gift.Regular gift: Gift.Regular
): Unit = convertGiftToStars( ): Boolean = convertGiftToStars(
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
ownedGiftId = with(gift) {id} ownedGiftId = with(gift) {id}
) )

View File

@@ -15,6 +15,6 @@ public suspend fun TelegramBot.deleteBusinessMessages(
businessConnectionId: BusinessConnectionId, businessConnectionId: BusinessConnectionId,
@GenerationVariant(List::class, "messages.map { it.messageId }", "messages", AccessibleMessage::class) @GenerationVariant(List::class, "messages.map { it.messageId }", "messages", AccessibleMessage::class)
messageIds: List<MessageId> messageIds: List<MessageId>
): Unit = execute( ): Boolean = execute(
DeleteBusinessMessages(businessConnectionId, messageIds) DeleteBusinessMessages(businessConnectionId, messageIds)
) )

View File

@@ -10,7 +10,7 @@ import kotlin.Boolean
import kotlin.collections.List import kotlin.collections.List
public suspend fun TelegramBot.deleteBusinessMessages(businessConnectionId: BusinessConnectionId, public suspend fun TelegramBot.deleteBusinessMessages(businessConnectionId: BusinessConnectionId,
messages: List<AccessibleMessage>): Unit = deleteBusinessMessages( messages: List<AccessibleMessage>): Boolean = deleteBusinessMessages(
businessConnectionId = businessConnectionId, messageIds = with(messages) {messages.map { businessConnectionId = businessConnectionId, messageIds = with(messages) {messages.map {
it.messageId }} it.messageId }}
) )

View File

@@ -4,8 +4,7 @@ import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.business_connection.GetBusinessAccountGifts import dev.inmo.tgbotapi.requests.business_connection.GetBusinessAccountGifts
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.OwnedGifts import dev.inmo.tgbotapi.types.OwnedGifts
import dev.inmo.tgbotapi.types.gifts.GiftSentOrReceivedEvent import dev.inmo.tgbotapi.types.gifts.GiftSentOrReceived
import dev.inmo.tgbotapi.types.gifts.OwnedGift
import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.flow
import kotlin.runCatching import kotlin.runCatching
@@ -15,23 +14,19 @@ public suspend fun TelegramBot.getBusinessAccountGifts(
excludeUnsaved: Boolean = false, excludeUnsaved: Boolean = false,
excludeSaved: Boolean = false, excludeSaved: Boolean = false,
excludeUnlimited: Boolean = false, excludeUnlimited: Boolean = false,
excludeLimitedUpgradable: Boolean = false, excludeLimited: Boolean = false,
excludeLimitedNonUpgradable: Boolean = false,
excludeUnique: Boolean = false, excludeUnique: Boolean = false,
excludeFromBlockchain: Boolean = false,
sortByPrice: Boolean = false, sortByPrice: Boolean = false,
offset: String? = null, offset: String? = null,
limit: Int? = null limit: Int? = null
): OwnedGifts<OwnedGift.OwnedByBusinessAccount> = execute( ): OwnedGifts<GiftSentOrReceived.ReceivedInBusinessAccount> = execute(
GetBusinessAccountGifts( GetBusinessAccountGifts(
businessConnectionId, businessConnectionId,
excludeUnsaved, excludeUnsaved,
excludeSaved, excludeSaved,
excludeUnlimited, excludeUnlimited,
excludeLimitedUpgradable, excludeLimited,
excludeLimitedNonUpgradable,
excludeUnique, excludeUnique,
excludeFromBlockchain,
sortByPrice, sortByPrice,
offset, offset,
limit limit
@@ -48,10 +43,8 @@ public suspend fun TelegramBot.getBusinessAccountGifts(
* @param excludeUnsaved Whether to exclude unsaved gifts * @param excludeUnsaved Whether to exclude unsaved gifts
* @param excludeSaved Whether to exclude saved gifts * @param excludeSaved Whether to exclude saved gifts
* @param excludeUnlimited Whether to exclude unlimited gifts * @param excludeUnlimited Whether to exclude unlimited gifts
* @param excludeLimitedUpgradable Whether to exclude limited upgradable gifts * @param excludeLimited Whether to exclude limited gifts
* @param excludeLimitedNonUpgradable Whether to exclude limited non-upgradable gifts
* @param excludeUnique Whether to exclude unique gifts * @param excludeUnique Whether to exclude unique gifts
* @param excludeFromBlockchain Whether to exclude gifts from blockchain
* @param sortByPrice Whether to sort gifts by price * @param sortByPrice Whether to sort gifts by price
* @param initialOffset The initial offset to start fetching from. If null, starts from the beginning * @param initialOffset The initial offset to start fetching from. If null, starts from the beginning
* @param limit The maximum number of gifts to fetch per request * @param limit The maximum number of gifts to fetch per request
@@ -64,15 +57,13 @@ public fun TelegramBot.getBusinessAccountGiftsFlow(
excludeUnsaved: Boolean = false, excludeUnsaved: Boolean = false,
excludeSaved: Boolean = false, excludeSaved: Boolean = false,
excludeUnlimited: Boolean = false, excludeUnlimited: Boolean = false,
excludeLimitedUpgradable: Boolean = false, excludeLimited: Boolean = false,
excludeLimitedNonUpgradable: Boolean = false,
excludeUnique: Boolean = false, excludeUnique: Boolean = false,
excludeFromBlockchain: Boolean = false,
sortByPrice: Boolean = false, sortByPrice: Boolean = false,
initialOffset: String? = null, initialOffset: String? = null,
limit: Int? = null, limit: Int? = null,
onErrorContinueChecker: suspend (Throwable?) -> Boolean = { false } onErrorContinueChecker: suspend (Throwable?) -> Boolean = { false }
): Flow<OwnedGifts<OwnedGift.OwnedByBusinessAccount>> = flow { ): Flow<OwnedGifts<GiftSentOrReceived.ReceivedInBusinessAccount>> = flow {
var currentOffset = initialOffset var currentOffset = initialOffset
do { do {
val response = runCatching { val response = runCatching {
@@ -81,10 +72,8 @@ public fun TelegramBot.getBusinessAccountGiftsFlow(
excludeUnsaved, excludeUnsaved,
excludeSaved, excludeSaved,
excludeUnlimited, excludeUnlimited,
excludeLimitedUpgradable, excludeLimited,
excludeLimitedNonUpgradable,
excludeUnique, excludeUnique,
excludeFromBlockchain,
sortByPrice, sortByPrice,
currentOffset, currentOffset,
limit limit

View File

@@ -17,11 +17,11 @@ public suspend fun TelegramBot.readBusinessMessage(
@GenerationVariant(Chat::class, "chat.id.toChatId()", "chat") @GenerationVariant(Chat::class, "chat.id.toChatId()", "chat")
chatId: ChatId, chatId: ChatId,
messageId: MessageId messageId: MessageId
): Unit = execute( ): Boolean = execute(
ReadBusinessMessage(businessConnectionId, chatId, messageId) ReadBusinessMessage(businessConnectionId, chatId, messageId)
) )
public suspend fun TelegramBot.readBusinessMessage( public suspend fun TelegramBot.readBusinessMessage(
businessConnectionId: BusinessConnectionId, businessConnectionId: BusinessConnectionId,
message: AccessibleMessage message: AccessibleMessage
): Unit = readBusinessMessage(businessConnectionId, message.chat.id.toChatId(), message.messageId) ): Boolean = readBusinessMessage(businessConnectionId, message.chat.id.toChatId(), message.messageId)

View File

@@ -14,7 +14,7 @@ public suspend fun TelegramBot.readBusinessMessage(
businessConnectionId: BusinessConnectionId, businessConnectionId: BusinessConnectionId,
chat: Chat, chat: Chat,
messageId: MessageId, messageId: MessageId,
): Unit = readBusinessMessage( ): Boolean = readBusinessMessage(
businessConnectionId = businessConnectionId, chatId = with(chat) {chat.id.toChatId()}, messageId businessConnectionId = businessConnectionId, chatId = with(chat) {chat.id.toChatId()}, messageId
= messageId = messageId
) )

View File

@@ -7,6 +7,6 @@ import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
public suspend fun TelegramBot.removeBusinessAccountProfilePhoto( public suspend fun TelegramBot.removeBusinessAccountProfilePhoto(
businessConnectionId: BusinessConnectionId, businessConnectionId: BusinessConnectionId,
isPublic: Boolean = false isPublic: Boolean = false
): Unit = execute( ): Boolean = execute(
RemoveBusinessAccountProfilePhoto(businessConnectionId = businessConnectionId, isPublic = isPublic) RemoveBusinessAccountProfilePhoto(businessConnectionId = businessConnectionId, isPublic = isPublic)
) )

View File

@@ -7,6 +7,6 @@ import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
public suspend fun TelegramBot.setBusinessAccountBio( public suspend fun TelegramBot.setBusinessAccountBio(
businessConnectionId: BusinessConnectionId, businessConnectionId: BusinessConnectionId,
bio: String bio: String
): Unit = execute( ): Boolean = execute(
SetBusinessAccountBio(businessConnectionId, bio) SetBusinessAccountBio(businessConnectionId, bio)
) )

View File

@@ -13,7 +13,7 @@ public suspend fun TelegramBot.setBusinessAccountGiftSettings(
businessConnectionId: BusinessConnectionId, businessConnectionId: BusinessConnectionId,
showGiftButton: Boolean, showGiftButton: Boolean,
acceptedGiftTypes: AcceptedGiftTypes acceptedGiftTypes: AcceptedGiftTypes
): Unit = execute( ): Boolean = execute(
SetBusinessAccountGiftSettings( SetBusinessAccountGiftSettings(
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
showGiftButton = showGiftButton, showGiftButton = showGiftButton,
@@ -28,7 +28,7 @@ public suspend fun TelegramBot.setBusinessAccountGiftSettings(
message: BusinessContentMessage<*>, message: BusinessContentMessage<*>,
showGiftButton: Boolean, showGiftButton: Boolean,
acceptedGiftTypes: AcceptedGiftTypes acceptedGiftTypes: AcceptedGiftTypes
): Unit = setBusinessAccountGiftSettings( ): Boolean = setBusinessAccountGiftSettings(
businessConnectionId = message.businessConnectionId, businessConnectionId = message.businessConnectionId,
showGiftButton = showGiftButton, showGiftButton = showGiftButton,
acceptedGiftTypes = acceptedGiftTypes acceptedGiftTypes = acceptedGiftTypes

View File

@@ -8,6 +8,6 @@ public suspend fun TelegramBot.setBusinessAccountName(
businessConnectionId: BusinessConnectionId, businessConnectionId: BusinessConnectionId,
firstName: String, firstName: String,
lastName: String? = null lastName: String? = null
): Unit = execute( ): Boolean = execute(
SetBusinessAccountName(businessConnectionId, firstName, lastName) SetBusinessAccountName(businessConnectionId, firstName, lastName)
) )

View File

@@ -9,6 +9,6 @@ public suspend fun TelegramBot.setBusinessAccountProfilePhoto(
businessConnectionId: BusinessConnectionId, businessConnectionId: BusinessConnectionId,
photo: InputProfilePhoto, photo: InputProfilePhoto,
isPublic: Boolean = false isPublic: Boolean = false
): Unit = execute( ): Boolean = execute(
SetBusinessAccountProfilePhoto(businessConnectionId, photo, isPublic) SetBusinessAccountProfilePhoto(businessConnectionId, photo, isPublic)
) )

View File

@@ -7,9 +7,11 @@ import dev.inmo.tgbotapi.requests.business_connection.SetBusinessAccountUsername
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.Username import dev.inmo.tgbotapi.types.Username
@GenerateVariations
public suspend fun TelegramBot.setBusinessAccountUsername( public suspend fun TelegramBot.setBusinessAccountUsername(
businessConnectionId: BusinessConnectionId, businessConnectionId: BusinessConnectionId,
username: Username? = null @GenerationVariant(String::class, "Username(username)", "username")
): Unit = execute( username: Username
): Boolean = execute(
SetBusinessAccountUsername(businessConnectionId, username) SetBusinessAccountUsername(businessConnectionId, username)
) )

View File

@@ -9,10 +9,8 @@ import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import kotlin.Boolean import kotlin.Boolean
import kotlin.String import kotlin.String
public suspend fun TelegramBot.setBusinessAccountUsername( public suspend
businessConnectionId: BusinessConnectionId, fun TelegramBot.setBusinessAccountUsername(businessConnectionId: BusinessConnectionId,
username: String? username: String): Boolean = setBusinessAccountUsername(
): Unit = setBusinessAccountUsername( businessConnectionId = businessConnectionId, username = with(username) { Username.prepare(username) }
businessConnectionId = businessConnectionId,
username = username ?.let { Username.prepare(username) }
) )

View File

@@ -7,6 +7,6 @@ import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
public suspend fun TelegramBot.transferBusinessAccountStars( public suspend fun TelegramBot.transferBusinessAccountStars(
businessConnectionId: BusinessConnectionId, businessConnectionId: BusinessConnectionId,
amount: Int amount: Int
): Unit = execute( ): Boolean = execute(
TransferBusinessAccountStars(businessConnectionId, amount) TransferBusinessAccountStars(businessConnectionId, amount)
) )

View File

@@ -21,7 +21,7 @@ public suspend fun TelegramBot.transferGift(
ownedGiftId: GiftId, ownedGiftId: GiftId,
newOwnerChatId: ChatId, newOwnerChatId: ChatId,
transferPaymentStarCount: Int? = null, transferPaymentStarCount: Int? = null,
): Unit = execute( ): Boolean = execute(
TransferGift( TransferGift(
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
ownedGiftId = ownedGiftId, ownedGiftId = ownedGiftId,
@@ -35,7 +35,7 @@ public suspend fun TelegramBot.transferGift(
gift: Gift.Regular, gift: Gift.Regular,
newOwnerChatId: ChatId, newOwnerChatId: ChatId,
transferPaymentStarCount: Int? = null, transferPaymentStarCount: Int? = null,
): Unit = transferGift( ): Boolean = transferGift(
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
ownedGiftId = gift.id, ownedGiftId = gift.id,
newOwnerChatId = newOwnerChatId, newOwnerChatId = newOwnerChatId,

View File

@@ -19,7 +19,7 @@ public suspend fun TelegramBot.convertGiftToStars(
ownedGiftId: GiftId, ownedGiftId: GiftId,
keepOriginalDetails: Boolean = false, keepOriginalDetails: Boolean = false,
starCount: Int? = null starCount: Int? = null
): Unit = execute( ): Boolean = execute(
UpgradeGift( UpgradeGift(
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
ownedGiftId = ownedGiftId, ownedGiftId = ownedGiftId,
@@ -32,7 +32,7 @@ public suspend fun TelegramBot.convertGiftToStars(
businessConnectionId: BusinessConnectionId, businessConnectionId: BusinessConnectionId,
gift: Gift.Regular, gift: Gift.Regular,
keepOriginalDetails: Boolean = false, keepOriginalDetails: Boolean = false,
): Unit = execute( ): Boolean = execute(
UpgradeGift( UpgradeGift(
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
ownedGiftId = gift.id, ownedGiftId = gift.id,

View File

@@ -7,8 +7,8 @@ import dev.inmo.tgbotapi.types.chat.PublicChat
public suspend fun TelegramBot.leaveChat( public suspend fun TelegramBot.leaveChat(
chatId: ChatIdentifier chatId: ChatIdentifier
): Unit = execute(LeaveChat(chatId)) ): Boolean = execute(LeaveChat(chatId))
public suspend fun TelegramBot.leaveChat( public suspend fun TelegramBot.leaveChat(
chat: PublicChat chat: PublicChat
): Unit = leaveChat(chat.id) ): Boolean = leaveChat(chat.id)

View File

@@ -10,7 +10,7 @@ import dev.inmo.tgbotapi.types.chat.Chat
public suspend fun TelegramBot.closeForumTopic( public suspend fun TelegramBot.closeForumTopic(
chatId: ChatIdentifier, chatId: ChatIdentifier,
messageThreadId: MessageThreadId messageThreadId: MessageThreadId
): Unit = execute( ): Boolean = execute(
CloseForumTopic( CloseForumTopic(
chatId, chatId,
messageThreadId messageThreadId
@@ -20,9 +20,9 @@ public suspend fun TelegramBot.closeForumTopic(
public suspend fun TelegramBot.closeForumTopic( public suspend fun TelegramBot.closeForumTopic(
chat: Chat, chat: Chat,
messageThreadId: MessageThreadId messageThreadId: MessageThreadId
): Unit = closeForumTopic(chat.id, messageThreadId) ): Boolean = closeForumTopic(chat.id, messageThreadId)
public suspend fun TelegramBot.closeForumTopic( public suspend fun TelegramBot.closeForumTopic(
chat: Chat, chat: Chat,
forumTopic: ForumTopic forumTopic: ForumTopic
): Unit = closeForumTopic(chat.id, forumTopic.messageThreadId) ): Boolean = closeForumTopic(chat.id, forumTopic.messageThreadId)

View File

@@ -10,10 +10,10 @@ import dev.inmo.tgbotapi.types.chat.Chat
public suspend fun TelegramBot.closeGeneralForumTopic( public suspend fun TelegramBot.closeGeneralForumTopic(
chatId: ChatIdentifier chatId: ChatIdentifier
): Unit = execute( ): Boolean = execute(
CloseGeneralForumTopic(chatId) CloseGeneralForumTopic(chatId)
) )
public suspend fun TelegramBot.closeGeneralForumTopic( public suspend fun TelegramBot.closeGeneralForumTopic(
chat: Chat chat: Chat
): Unit = closeGeneralForumTopic(chat.id) ): Boolean = closeGeneralForumTopic(chat.id)

View File

@@ -10,7 +10,7 @@ import dev.inmo.tgbotapi.types.chat.Chat
public suspend fun TelegramBot.deleteForumTopic( public suspend fun TelegramBot.deleteForumTopic(
chatId: ChatIdentifier, chatId: ChatIdentifier,
messageThreadId: MessageThreadId messageThreadId: MessageThreadId
): Unit = execute( ): Boolean = execute(
DeleteForumTopic( DeleteForumTopic(
chatId, chatId,
messageThreadId messageThreadId
@@ -20,14 +20,14 @@ public suspend fun TelegramBot.deleteForumTopic(
public suspend fun TelegramBot.deleteForumTopic( public suspend fun TelegramBot.deleteForumTopic(
chatId: ChatIdentifier, chatId: ChatIdentifier,
forumTopic: ForumTopic forumTopic: ForumTopic
): Unit = deleteForumTopic(chatId, forumTopic.messageThreadId) ): Boolean = deleteForumTopic(chatId, forumTopic.messageThreadId)
public suspend fun TelegramBot.deleteForumTopic( public suspend fun TelegramBot.deleteForumTopic(
chat: Chat, chat: Chat,
messageThreadId: MessageThreadId messageThreadId: MessageThreadId
): Unit = deleteForumTopic(chat.id, messageThreadId) ): Boolean = deleteForumTopic(chat.id, messageThreadId)
public suspend fun TelegramBot.deleteForumTopic( public suspend fun TelegramBot.deleteForumTopic(
chat: Chat, chat: Chat,
forumTopic: ForumTopic forumTopic: ForumTopic
): Unit = deleteForumTopic(chat.id, forumTopic.messageThreadId) ): Boolean = deleteForumTopic(chat.id, forumTopic.messageThreadId)

View File

@@ -13,7 +13,7 @@ public suspend fun TelegramBot.editForumTopic(
messageThreadId: MessageThreadId, messageThreadId: MessageThreadId,
name: String? = null, name: String? = null,
iconEmojiId: CustomEmojiId? = null iconEmojiId: CustomEmojiId? = null
): Unit = execute( ): Boolean = execute(
EditForumTopic( EditForumTopic(
chatId, chatId,
messageThreadId, messageThreadId,
@@ -27,10 +27,10 @@ public suspend fun TelegramBot.editForumTopic(
messageThreadId: MessageThreadId, messageThreadId: MessageThreadId,
name: String? = null, name: String? = null,
iconEmojiId: CustomEmojiId? = null iconEmojiId: CustomEmojiId? = null
): Unit = editForumTopic(chat.id, messageThreadId, name, iconEmojiId) ): Boolean = editForumTopic(chat.id, messageThreadId, name, iconEmojiId)
public suspend fun TelegramBot.editForumTopic( public suspend fun TelegramBot.editForumTopic(
chatIdentifier: ChatIdentifier, chatIdentifier: ChatIdentifier,
forumTopic: ForumTopic, forumTopic: ForumTopic,
iconEmojiId: CustomEmojiId? = forumTopic.iconEmojiId iconEmojiId: CustomEmojiId? = forumTopic.iconEmojiId
): Unit = editForumTopic(chatIdentifier, forumTopic.messageThreadId, forumTopic.name, iconEmojiId) ): Boolean = editForumTopic(chatIdentifier, forumTopic.messageThreadId, forumTopic.name, iconEmojiId)

View File

@@ -12,7 +12,7 @@ import dev.inmo.tgbotapi.types.chat.Chat
public suspend fun TelegramBot.editGeneralForumTopic( public suspend fun TelegramBot.editGeneralForumTopic(
chatId: ChatIdentifier, chatId: ChatIdentifier,
name: String name: String
): Unit = execute( ): Boolean = execute(
EditGeneralForumTopic( EditGeneralForumTopic(
chatId, chatId,
name name
@@ -22,9 +22,9 @@ public suspend fun TelegramBot.editGeneralForumTopic(
public suspend fun TelegramBot.editGeneralForumTopic( public suspend fun TelegramBot.editGeneralForumTopic(
chat: Chat, chat: Chat,
name: String name: String
): Unit = editGeneralForumTopic(chat.id, name) ): Boolean = editGeneralForumTopic(chat.id, name)
public suspend fun TelegramBot.editGeneralForumTopic( public suspend fun TelegramBot.editGeneralForumTopic(
chatIdentifier: ChatIdentifier, chatIdentifier: ChatIdentifier,
forumTopic: ForumTopic, forumTopic: ForumTopic,
): Unit = editGeneralForumTopic(chatIdentifier, forumTopic.name) ): Boolean = editGeneralForumTopic(chatIdentifier, forumTopic.name)

View File

@@ -11,10 +11,10 @@ import dev.inmo.tgbotapi.types.chat.Chat
public suspend fun TelegramBot.hideGeneralForumTopic( public suspend fun TelegramBot.hideGeneralForumTopic(
chatId: ChatIdentifier chatId: ChatIdentifier
): Unit = execute( ): Boolean = execute(
HideGeneralForumTopic(chatId) HideGeneralForumTopic(chatId)
) )
public suspend fun TelegramBot.hideGeneralForumTopic( public suspend fun TelegramBot.hideGeneralForumTopic(
chat: Chat chat: Chat
): Unit = hideGeneralForumTopic(chat.id) ): Boolean = hideGeneralForumTopic(chat.id)

View File

@@ -10,7 +10,7 @@ import dev.inmo.tgbotapi.types.chat.Chat
public suspend fun TelegramBot.reopenForumTopic( public suspend fun TelegramBot.reopenForumTopic(
chatId: ChatIdentifier, chatId: ChatIdentifier,
messageThreadId: MessageThreadId messageThreadId: MessageThreadId
): Unit = execute( ): Boolean = execute(
ReopenForumTopic( ReopenForumTopic(
chatId, chatId,
messageThreadId messageThreadId
@@ -20,9 +20,9 @@ public suspend fun TelegramBot.reopenForumTopic(
public suspend fun TelegramBot.reopenForumTopic( public suspend fun TelegramBot.reopenForumTopic(
chat: Chat, chat: Chat,
messageThreadId: MessageThreadId messageThreadId: MessageThreadId
): Unit = reopenForumTopic(chat.id, messageThreadId) ): Boolean = reopenForumTopic(chat.id, messageThreadId)
public suspend fun TelegramBot.reopenForumTopic( public suspend fun TelegramBot.reopenForumTopic(
chat: Chat, chat: Chat,
forumTopic: ForumTopic forumTopic: ForumTopic
): Unit = reopenForumTopic(chat.id, forumTopic.messageThreadId) ): Boolean = reopenForumTopic(chat.id, forumTopic.messageThreadId)

View File

@@ -10,10 +10,10 @@ import dev.inmo.tgbotapi.types.chat.Chat
public suspend fun TelegramBot.reopenGeneralForumTopic( public suspend fun TelegramBot.reopenGeneralForumTopic(
chatId: ChatIdentifier chatId: ChatIdentifier
): Unit = execute( ): Boolean = execute(
ReopenGeneralForumTopic(chatId) ReopenGeneralForumTopic(chatId)
) )
public suspend fun TelegramBot.reopenGeneralForumTopic( public suspend fun TelegramBot.reopenGeneralForumTopic(
chat: Chat chat: Chat
): Unit = reopenGeneralForumTopic(chat.id) ): Boolean = reopenGeneralForumTopic(chat.id)

View File

@@ -12,10 +12,10 @@ import dev.inmo.tgbotapi.types.chat.Chat
public suspend fun TelegramBot.unhideGeneralForumTopic( public suspend fun TelegramBot.unhideGeneralForumTopic(
chatId: ChatIdentifier chatId: ChatIdentifier
): Unit = execute( ): Boolean = execute(
UnhideGeneralForumTopic(chatId) UnhideGeneralForumTopic(chatId)
) )
public suspend fun TelegramBot.unhideGeneralForumTopic( public suspend fun TelegramBot.unhideGeneralForumTopic(
chat: Chat chat: Chat
): Unit = unhideGeneralForumTopic(chat.id) ): Boolean = unhideGeneralForumTopic(chat.id)

View File

@@ -10,7 +10,7 @@ import dev.inmo.tgbotapi.types.chat.Chat
public suspend fun TelegramBot.unpinAllForumTopicMessages( public suspend fun TelegramBot.unpinAllForumTopicMessages(
chatId: ChatIdentifier, chatId: ChatIdentifier,
messageThreadId: MessageThreadId messageThreadId: MessageThreadId
): Unit = execute( ): Boolean = execute(
UnpinAllForumTopicMessages( UnpinAllForumTopicMessages(
chatId, chatId,
messageThreadId messageThreadId
@@ -20,9 +20,9 @@ public suspend fun TelegramBot.unpinAllForumTopicMessages(
public suspend fun TelegramBot.unpinAllForumTopicMessages( public suspend fun TelegramBot.unpinAllForumTopicMessages(
chat: Chat, chat: Chat,
messageThreadId: MessageThreadId messageThreadId: MessageThreadId
): Unit = unpinAllForumTopicMessages(chat.id, messageThreadId) ): Boolean = unpinAllForumTopicMessages(chat.id, messageThreadId)
public suspend fun TelegramBot.unpinAllForumTopicMessages( public suspend fun TelegramBot.unpinAllForumTopicMessages(
chat: Chat, chat: Chat,
forumTopic: ForumTopic forumTopic: ForumTopic
): Unit = unpinAllForumTopicMessages(chat.id, forumTopic.messageThreadId) ): Boolean = unpinAllForumTopicMessages(chat.id, forumTopic.messageThreadId)

View File

@@ -10,7 +10,7 @@ import dev.inmo.tgbotapi.types.chat.Chat
public suspend fun TelegramBot.unpinAllGeneralForumTopicMessages( public suspend fun TelegramBot.unpinAllGeneralForumTopicMessages(
chatId: ChatIdentifier chatId: ChatIdentifier
): Unit = execute( ): Boolean = execute(
UnpinAllGeneralForumTopicMessages( UnpinAllGeneralForumTopicMessages(
chatId chatId
) )
@@ -18,4 +18,4 @@ public suspend fun TelegramBot.unpinAllGeneralForumTopicMessages(
public suspend fun TelegramBot.unpinAllGeneralForumTopicMessages( public suspend fun TelegramBot.unpinAllGeneralForumTopicMessages(
chat: Chat chat: Chat
): Unit = unpinAllGeneralForumTopicMessages(chat.id) ): Boolean = unpinAllGeneralForumTopicMessages(chat.id)

View File

@@ -117,17 +117,6 @@ public suspend fun TelegramBot.getChat(
chat: PrivateChatImpl chat: PrivateChatImpl
): ExtendedPrivateChatImpl = getChat(chat.id) as ExtendedPrivateChatImpl ): ExtendedPrivateChatImpl = getChat(chat.id) as ExtendedPrivateChatImpl
/**
* Will cast incoming [dev.inmo.tgbotapi.types.chat.ExtendedChat] to a
* [ExtendedPrivateForumChatImpl] with unsafe operator "as"
*
* @throws ClassCastException
*/
@PreviewFeature
public suspend fun TelegramBot.getChat(
chat: PrivateForumChatImpl
): ExtendedPrivateForumChatImpl = getChat(chat.id) as ExtendedPrivateForumChatImpl
/** /**
* Will cast incoming [dev.inmo.tgbotapi.types.chat.ExtendedChat] to a * Will cast incoming [dev.inmo.tgbotapi.types.chat.ExtendedChat] to a
* [ExtendedUser] with unsafe operator "as" * [ExtendedUser] with unsafe operator "as"

View File

@@ -12,31 +12,31 @@ import dev.inmo.tgbotapi.types.update.ChatJoinRequestUpdate
public suspend fun TelegramBot.approveChatJoinRequest( public suspend fun TelegramBot.approveChatJoinRequest(
chatId: ChatIdentifier, chatId: ChatIdentifier,
userId: UserId userId: UserId
): Unit = execute(ApproveChatJoinRequest(chatId, userId)) ): Boolean = execute(ApproveChatJoinRequest(chatId, userId))
public suspend fun TelegramBot.approveChatJoinRequest( public suspend fun TelegramBot.approveChatJoinRequest(
chat: PublicChat, chat: PublicChat,
userId: UserId userId: UserId
): Unit = approveChatJoinRequest(chat.id, userId) ): Boolean = approveChatJoinRequest(chat.id, userId)
public suspend fun TelegramBot.approveChatJoinRequest( public suspend fun TelegramBot.approveChatJoinRequest(
chatId: ChatIdentifier, chatId: ChatIdentifier,
user: User user: User
): Unit = approveChatJoinRequest(chatId, user.id) ): Boolean = approveChatJoinRequest(chatId, user.id)
public suspend fun TelegramBot.approveChatJoinRequest( public suspend fun TelegramBot.approveChatJoinRequest(
chat: PublicChat, chat: PublicChat,
user: User user: User
): Unit = approveChatJoinRequest(chat.id, user.id) ): Boolean = approveChatJoinRequest(chat.id, user.id)
public suspend fun TelegramBot.approveChatJoinRequest( public suspend fun TelegramBot.approveChatJoinRequest(
chatJoinRequest: ChatJoinRequest chatJoinRequest: ChatJoinRequest
): Unit = approveChatJoinRequest(chatJoinRequest.chat, chatJoinRequest.user) ): Boolean = approveChatJoinRequest(chatJoinRequest.chat, chatJoinRequest.user)
public suspend fun TelegramBot.approve( public suspend fun TelegramBot.approve(
chatJoinRequest: ChatJoinRequest chatJoinRequest: ChatJoinRequest
): Unit = approveChatJoinRequest(chatJoinRequest) ): Boolean = approveChatJoinRequest(chatJoinRequest)
public suspend fun TelegramBot.approveChatJoinRequest( public suspend fun TelegramBot.approveChatJoinRequest(
chatJoinRequestUpdate: ChatJoinRequestUpdate chatJoinRequestUpdate: ChatJoinRequestUpdate
): Unit = approveChatJoinRequest(chatJoinRequestUpdate.data) ): Boolean = approveChatJoinRequest(chatJoinRequestUpdate.data)

View File

@@ -12,31 +12,31 @@ import dev.inmo.tgbotapi.types.update.ChatJoinRequestUpdate
public suspend fun TelegramBot.declineChatJoinRequest( public suspend fun TelegramBot.declineChatJoinRequest(
chatId: ChatIdentifier, chatId: ChatIdentifier,
userId: UserId userId: UserId
): Unit = execute(DeclineChatJoinRequest(chatId, userId)) ): Boolean = execute(DeclineChatJoinRequest(chatId, userId))
public suspend fun TelegramBot.declineChatJoinRequest( public suspend fun TelegramBot.declineChatJoinRequest(
chat: PublicChat, chat: PublicChat,
userId: UserId userId: UserId
): Unit = declineChatJoinRequest(chat.id, userId) ): Boolean = declineChatJoinRequest(chat.id, userId)
public suspend fun TelegramBot.declineChatJoinRequest( public suspend fun TelegramBot.declineChatJoinRequest(
chatId: ChatIdentifier, chatId: ChatIdentifier,
user: User user: User
): Unit = declineChatJoinRequest(chatId, user.id) ): Boolean = declineChatJoinRequest(chatId, user.id)
public suspend fun TelegramBot.declineChatJoinRequest( public suspend fun TelegramBot.declineChatJoinRequest(
chat: PublicChat, chat: PublicChat,
user: User user: User
): Unit = declineChatJoinRequest(chat.id, user.id) ): Boolean = declineChatJoinRequest(chat.id, user.id)
public suspend fun TelegramBot.declineChatJoinRequest( public suspend fun TelegramBot.declineChatJoinRequest(
chatJoinRequest: ChatJoinRequest chatJoinRequest: ChatJoinRequest
): Unit = declineChatJoinRequest(chatJoinRequest.chat, chatJoinRequest.user) ): Boolean = declineChatJoinRequest(chatJoinRequest.chat, chatJoinRequest.user)
public suspend fun TelegramBot.decline( public suspend fun TelegramBot.decline(
chatJoinRequest: ChatJoinRequest chatJoinRequest: ChatJoinRequest
): Unit = declineChatJoinRequest(chatJoinRequest) ): Boolean = declineChatJoinRequest(chatJoinRequest)
public suspend fun TelegramBot.declineChatJoinRequest( public suspend fun TelegramBot.declineChatJoinRequest(
chatJoinRequestUpdate: ChatJoinRequestUpdate chatJoinRequestUpdate: ChatJoinRequestUpdate
): Unit = declineChatJoinRequest(chatJoinRequestUpdate.data) ): Boolean = declineChatJoinRequest(chatJoinRequestUpdate.data)

View File

@@ -14,25 +14,25 @@ public suspend fun TelegramBot.banChatMember(
userId: UserId, userId: UserId,
untilDate: TelegramDate? = null, untilDate: TelegramDate? = null,
revokeMessages: Boolean? = null revokeMessages: Boolean? = null
): Unit = execute(BanChatMember(chatId, userId, untilDate, revokeMessages)) ): Boolean = execute(BanChatMember(chatId, userId, untilDate, revokeMessages))
public suspend fun TelegramBot.banChatMember( public suspend fun TelegramBot.banChatMember(
chat: PublicChat, chat: PublicChat,
userId: UserId, userId: UserId,
untilDate: TelegramDate? = null, untilDate: TelegramDate? = null,
revokeMessages: Boolean? = null revokeMessages: Boolean? = null
): Unit = banChatMember(chat.id, userId, untilDate, revokeMessages) ): Boolean = banChatMember(chat.id, userId, untilDate, revokeMessages)
public suspend fun TelegramBot.banChatMember( public suspend fun TelegramBot.banChatMember(
chatId: IdChatIdentifier, chatId: IdChatIdentifier,
user: User, user: User,
untilDate: TelegramDate? = null, untilDate: TelegramDate? = null,
revokeMessages: Boolean? = null revokeMessages: Boolean? = null
): Unit = banChatMember(chatId, user.id, untilDate, revokeMessages) ): Boolean = banChatMember(chatId, user.id, untilDate, revokeMessages)
public suspend fun TelegramBot.banChatMember( public suspend fun TelegramBot.banChatMember(
chat: PublicChat, chat: PublicChat,
user: User, user: User,
untilDate: TelegramDate? = null, untilDate: TelegramDate? = null,
revokeMessages: Boolean? = null revokeMessages: Boolean? = null
): Unit = banChatMember(chat.id, user.id, untilDate, revokeMessages) ): Boolean = banChatMember(chat.id, user.id, untilDate, revokeMessages)

View File

@@ -9,19 +9,19 @@ import dev.inmo.tgbotapi.types.chat.PublicChat
public suspend fun TelegramBot.banChatSenderChat( public suspend fun TelegramBot.banChatSenderChat(
chatId: ChatIdentifier, chatId: ChatIdentifier,
senderChatId: IdChatIdentifier senderChatId: IdChatIdentifier
): Unit = execute(BanChatSenderChat(chatId, senderChatId)) ): Boolean = execute(BanChatSenderChat(chatId, senderChatId))
public suspend fun TelegramBot.banChatSenderChat( public suspend fun TelegramBot.banChatSenderChat(
chat: PublicChat, chat: PublicChat,
senderChatId: IdChatIdentifier senderChatId: IdChatIdentifier
): Unit = banChatSenderChat(chat.id, senderChatId) ): Boolean = banChatSenderChat(chat.id, senderChatId)
public suspend fun TelegramBot.banChatSenderChat( public suspend fun TelegramBot.banChatSenderChat(
chatId: IdChatIdentifier, chatId: IdChatIdentifier,
senderChat: PublicChat senderChat: PublicChat
): Unit = banChatSenderChat(chatId, senderChat.id) ): Boolean = banChatSenderChat(chatId, senderChat.id)
public suspend fun TelegramBot.banChatSenderChat( public suspend fun TelegramBot.banChatSenderChat(
chat: PublicChat, chat: PublicChat,
senderChat: PublicChat, senderChat: PublicChat,
): Unit = banChatSenderChat(chat.id, senderChat) ): Boolean = banChatSenderChat(chat.id, senderChat)

View File

@@ -2,6 +2,7 @@ package dev.inmo.tgbotapi.extensions.api.chat.members
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.chat.members.PromoteChannelAdministrator import dev.inmo.tgbotapi.requests.chat.members.PromoteChannelAdministrator
import dev.inmo.tgbotapi.requests.chat.members.PromoteChatMember
import dev.inmo.tgbotapi.types.IdChatIdentifier import dev.inmo.tgbotapi.types.IdChatIdentifier
import dev.inmo.tgbotapi.types.ChatIdentifier import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.TelegramDate import dev.inmo.tgbotapi.types.TelegramDate
@@ -25,9 +26,8 @@ public suspend fun TelegramBot.promoteChannelAdministrator(
canManageChat: Boolean? = null, canManageChat: Boolean? = null,
canPostStories: Boolean? = null, canPostStories: Boolean? = null,
canEditStories: Boolean? = null, canEditStories: Boolean? = null,
canDeleteStories: Boolean? = null, canDeleteStories: Boolean? = null
canManageDirectMessages: Boolean? = null, ): Boolean = execute(
): Unit = execute(
PromoteChannelAdministrator( PromoteChannelAdministrator(
chatId = chatId, chatId = chatId,
userId = userId, userId = userId,
@@ -44,8 +44,7 @@ public suspend fun TelegramBot.promoteChannelAdministrator(
canManageChat = canManageChat, canManageChat = canManageChat,
canPostStories = canPostStories, canPostStories = canPostStories,
canEditStories = canEditStories, canEditStories = canEditStories,
canDeleteStories = canDeleteStories, canDeleteStories = canDeleteStories
canManageDirectMessages = canManageDirectMessages,
) )
) )
@@ -65,9 +64,8 @@ public suspend fun TelegramBot.promoteChannelAdministrator(
canManageChat: Boolean? = null, canManageChat: Boolean? = null,
canPostStories: Boolean? = null, canPostStories: Boolean? = null,
canEditStories: Boolean? = null, canEditStories: Boolean? = null,
canDeleteStories: Boolean? = null, canDeleteStories: Boolean? = null
canManageDirectMessages: Boolean? = null, ): Boolean = promoteChannelAdministrator(
): Unit = promoteChannelAdministrator(
chat.id, chat.id,
userId, userId,
untilDate = untilDate, untilDate = untilDate,
@@ -83,8 +81,7 @@ public suspend fun TelegramBot.promoteChannelAdministrator(
canManageChat = canManageChat, canManageChat = canManageChat,
canPostStories = canPostStories, canPostStories = canPostStories,
canEditStories = canEditStories, canEditStories = canEditStories,
canDeleteStories = canDeleteStories, canDeleteStories = canDeleteStories
canManageDirectMessages = canManageDirectMessages,
) )
public suspend fun TelegramBot.promoteChannelAdministrator( public suspend fun TelegramBot.promoteChannelAdministrator(
@@ -103,9 +100,8 @@ public suspend fun TelegramBot.promoteChannelAdministrator(
canManageChat: Boolean? = null, canManageChat: Boolean? = null,
canPostStories: Boolean? = null, canPostStories: Boolean? = null,
canEditStories: Boolean? = null, canEditStories: Boolean? = null,
canDeleteStories: Boolean? = null, canDeleteStories: Boolean? = null
canManageDirectMessages: Boolean? = null, ): Boolean = promoteChannelAdministrator(
): Unit = promoteChannelAdministrator(
chatId, chatId,
user.id, user.id,
untilDate = untilDate, untilDate = untilDate,
@@ -121,8 +117,7 @@ public suspend fun TelegramBot.promoteChannelAdministrator(
canManageChat = canManageChat, canManageChat = canManageChat,
canPostStories = canPostStories, canPostStories = canPostStories,
canEditStories = canEditStories, canEditStories = canEditStories,
canDeleteStories = canDeleteStories, canDeleteStories = canDeleteStories
canManageDirectMessages = canManageDirectMessages,
) )
public suspend fun TelegramBot.promoteChannelAdministrator( public suspend fun TelegramBot.promoteChannelAdministrator(
@@ -141,9 +136,8 @@ public suspend fun TelegramBot.promoteChannelAdministrator(
canManageChat: Boolean? = null, canManageChat: Boolean? = null,
canPostStories: Boolean? = null, canPostStories: Boolean? = null,
canEditStories: Boolean? = null, canEditStories: Boolean? = null,
canDeleteStories: Boolean? = null, canDeleteStories: Boolean? = null
canManageDirectMessages: Boolean? = null, ): Boolean = promoteChannelAdministrator(
): Unit = promoteChannelAdministrator(
chat.id, chat.id,
user.id, user.id,
untilDate = untilDate, untilDate = untilDate,
@@ -159,6 +153,5 @@ public suspend fun TelegramBot.promoteChannelAdministrator(
canManageChat = canManageChat, canManageChat = canManageChat,
canPostStories = canPostStories, canPostStories = canPostStories,
canEditStories = canEditStories, canEditStories = canEditStories,
canDeleteStories = canDeleteStories, canDeleteStories = canDeleteStories
canManageDirectMessages = canManageDirectMessages,
) )

View File

@@ -21,21 +21,19 @@ public suspend fun TelegramBot.promoteChatAdministrator(
canPromoteMembers: Boolean? = null, canPromoteMembers: Boolean? = null,
canManageVideoChats: Boolean? = null, canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null, canManageChat: Boolean? = null,
canManageTags: Boolean? = null, ): Boolean = execute(
): Unit = execute(
PromoteChatMember( PromoteChatMember(
chatId = chatId, chatId,
userId = userId, userId,
untilDate = untilDate, untilDate,
isAnonymous = isAnonymous, isAnonymous,
canChangeInfo = canChangeInfo, canChangeInfo,
canDeleteMessages = canDeleteMessages, canDeleteMessages,
canInviteUsers = canInviteUsers, canInviteUsers,
canRestrictMembers = canRestrictMembers, canRestrictMembers,
canPromoteMembers = canPromoteMembers, canPromoteMembers,
canManageVideoChats = canManageVideoChats, canManageVideoChats,
canManageChat = canManageChat, canManageChat
canManageTags = canManageTags
) )
) )
@@ -51,20 +49,18 @@ public suspend fun TelegramBot.promoteChatAdministrator(
canPromoteMembers: Boolean? = null, canPromoteMembers: Boolean? = null,
canManageVideoChats: Boolean? = null, canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null, canManageChat: Boolean? = null,
canManageTags: Boolean? = null, ): Boolean = promoteChatAdministrator(
): Unit = promoteChatAdministrator( chat.id,
chatId = chat.id, userId,
userId = userId, untilDate,
untilDate = untilDate, isAnonymous,
isAnonymous = isAnonymous, canChangeInfo,
canChangeInfo = canChangeInfo, canDeleteMessages,
canDeleteMessages = canDeleteMessages, canInviteUsers,
canInviteUsers = canInviteUsers, canRestrictMembers,
canRestrictMembers = canRestrictMembers, canPromoteMembers,
canPromoteMembers = canPromoteMembers, canManageVideoChats,
canManageVideoChats = canManageVideoChats, canManageChat
canManageChat = canManageChat,
canManageTags = canManageTags
) )
public suspend fun TelegramBot.promoteChatAdministrator( public suspend fun TelegramBot.promoteChatAdministrator(
@@ -79,20 +75,18 @@ public suspend fun TelegramBot.promoteChatAdministrator(
canPromoteMembers: Boolean? = null, canPromoteMembers: Boolean? = null,
canManageVideoChats: Boolean? = null, canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null, canManageChat: Boolean? = null,
canManageTags: Boolean? = null, ): Boolean = promoteChatAdministrator(
): Unit = promoteChatAdministrator( chatId,
chatId = chatId, user.id,
userId = user.id, untilDate,
untilDate = untilDate, isAnonymous,
isAnonymous = isAnonymous, canChangeInfo,
canChangeInfo = canChangeInfo, canDeleteMessages,
canDeleteMessages = canDeleteMessages, canInviteUsers,
canInviteUsers = canInviteUsers, canRestrictMembers,
canRestrictMembers = canRestrictMembers, canPromoteMembers,
canPromoteMembers = canPromoteMembers, canManageVideoChats,
canManageVideoChats = canManageVideoChats, canManageChat
canManageChat = canManageChat,
canManageTags = canManageTags
) )
public suspend fun TelegramBot.promoteChatAdministrator( public suspend fun TelegramBot.promoteChatAdministrator(
@@ -107,18 +101,16 @@ public suspend fun TelegramBot.promoteChatAdministrator(
canPromoteMembers: Boolean? = null, canPromoteMembers: Boolean? = null,
canManageVideoChats: Boolean? = null, canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null, canManageChat: Boolean? = null,
canManageTags: Boolean? = null, ): Boolean = promoteChatAdministrator(
): Unit = promoteChatAdministrator( chat.id,
chatId = chat.id, user.id,
userId = user.id, untilDate,
untilDate = untilDate, isAnonymous,
isAnonymous = isAnonymous, canChangeInfo,
canChangeInfo = canChangeInfo, canDeleteMessages,
canDeleteMessages = canDeleteMessages, canInviteUsers,
canInviteUsers = canInviteUsers, canRestrictMembers,
canRestrictMembers = canRestrictMembers, canPromoteMembers,
canPromoteMembers = canPromoteMembers, canManageVideoChats,
canManageVideoChats = canManageVideoChats, canManageChat
canManageChat = canManageChat,
canManageTags = canManageTags
) )

View File

@@ -26,10 +26,8 @@ public suspend fun TelegramBot.promoteChatMember(
canManageTopics: Boolean? = null, canManageTopics: Boolean? = null,
canPostStories: Boolean? = null, canPostStories: Boolean? = null,
canEditStories: Boolean? = null, canEditStories: Boolean? = null,
canDeleteStories: Boolean? = null, canDeleteStories: Boolean? = null
canManageDirectMessages: Boolean? = null, ): Boolean = execute(
canManageTags: Boolean? = null
): Unit = execute(
PromoteChatMember( PromoteChatMember(
chatId = chatId, chatId = chatId,
userId = userId, userId = userId,
@@ -48,9 +46,7 @@ public suspend fun TelegramBot.promoteChatMember(
canManageTopics = canManageTopics, canManageTopics = canManageTopics,
canPostStories = canPostStories, canPostStories = canPostStories,
canEditStories = canEditStories, canEditStories = canEditStories,
canDeleteStories = canDeleteStories, canDeleteStories = canDeleteStories
canManageDirectMessages = canManageDirectMessages,
canManageTags = canManageTags,
) )
) )
@@ -73,10 +69,8 @@ public suspend fun TelegramBot.promoteChatMember(
canManageTopics: Boolean? = null, canManageTopics: Boolean? = null,
canPostStories: Boolean? = null, canPostStories: Boolean? = null,
canEditStories: Boolean? = null, canEditStories: Boolean? = null,
canDeleteStories: Boolean? = null, canDeleteStories: Boolean? = null
canManageDirectMessages: Boolean? = null, ): Boolean = promoteChatMember(
canManageTags: Boolean? = null
): Unit = promoteChatMember(
chat.id, chat.id,
userId, userId,
untilDate = untilDate, untilDate = untilDate,
@@ -94,9 +88,7 @@ public suspend fun TelegramBot.promoteChatMember(
canManageTopics = canManageTopics, canManageTopics = canManageTopics,
canPostStories = canPostStories, canPostStories = canPostStories,
canEditStories = canEditStories, canEditStories = canEditStories,
canDeleteStories = canDeleteStories, canDeleteStories = canDeleteStories
canManageDirectMessages = canManageDirectMessages,
canManageTags = canManageTags,
) )
@Warning("This method is too common. Use it with caution") @Warning("This method is too common. Use it with caution")
@@ -118,10 +110,8 @@ public suspend fun TelegramBot.promoteChatMember(
canManageTopics: Boolean? = null, canManageTopics: Boolean? = null,
canPostStories: Boolean? = null, canPostStories: Boolean? = null,
canEditStories: Boolean? = null, canEditStories: Boolean? = null,
canDeleteStories: Boolean? = null, canDeleteStories: Boolean? = null
canManageDirectMessages: Boolean? = null, ): Boolean = promoteChatMember(
canManageTags: Boolean? = null
): Unit = promoteChatMember(
chatId, chatId,
user.id, user.id,
untilDate = untilDate, untilDate = untilDate,
@@ -139,9 +129,7 @@ public suspend fun TelegramBot.promoteChatMember(
canManageTopics = canManageTopics, canManageTopics = canManageTopics,
canPostStories = canPostStories, canPostStories = canPostStories,
canEditStories = canEditStories, canEditStories = canEditStories,
canDeleteStories = canDeleteStories, canDeleteStories = canDeleteStories
canManageDirectMessages = canManageDirectMessages,
canManageTags = canManageTags,
) )
@Warning("This method is too common. Use it with caution") @Warning("This method is too common. Use it with caution")
@@ -163,10 +151,8 @@ public suspend fun TelegramBot.promoteChatMember(
canManageTopics: Boolean? = null, canManageTopics: Boolean? = null,
canPostStories: Boolean? = null, canPostStories: Boolean? = null,
canEditStories: Boolean? = null, canEditStories: Boolean? = null,
canDeleteStories: Boolean? = null, canDeleteStories: Boolean? = null
canManageDirectMessages: Boolean? = null, ): Boolean = promoteChatMember(
canManageTags: Boolean? = null
): Unit = promoteChatMember(
chat.id, chat.id,
user.id, user.id,
untilDate = untilDate, untilDate = untilDate,
@@ -184,7 +170,5 @@ public suspend fun TelegramBot.promoteChatMember(
canManageTopics = canManageTopics, canManageTopics = canManageTopics,
canPostStories = canPostStories, canPostStories = canPostStories,
canEditStories = canEditStories, canEditStories = canEditStories,
canDeleteStories = canDeleteStories, canDeleteStories = canDeleteStories
canManageDirectMessages = canManageDirectMessages,
canManageTags = canManageTags,
) )

View File

@@ -24,7 +24,7 @@ public suspend fun TelegramBot.promoteSupergroupAdministrator(
canManageVideoChats: Boolean? = null, canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null, canManageChat: Boolean? = null,
canManageTopics: Boolean? = null, canManageTopics: Boolean? = null,
): Unit = execute( ): Boolean = execute(
PromoteSupergroupAdministrator( PromoteSupergroupAdministrator(
chatId = chatId, chatId = chatId,
userId = userId, userId = userId,
@@ -56,7 +56,7 @@ public suspend fun TelegramBot.promoteSupergroupAdministrator(
canManageVideoChats: Boolean? = null, canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null, canManageChat: Boolean? = null,
canManageTopics: Boolean? = null, canManageTopics: Boolean? = null,
): Unit = promoteSupergroupAdministrator( ): Boolean = promoteSupergroupAdministrator(
chat.id, chat.id,
userId, userId,
untilDate = untilDate, untilDate = untilDate,
@@ -86,7 +86,7 @@ public suspend fun TelegramBot.promoteSupergroupAdministrator(
canManageVideoChats: Boolean? = null, canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null, canManageChat: Boolean? = null,
canManageTopics: Boolean? = null, canManageTopics: Boolean? = null,
): Unit = promoteSupergroupAdministrator( ): Boolean = promoteSupergroupAdministrator(
chatId, chatId,
user.id, user.id,
untilDate = untilDate, untilDate = untilDate,
@@ -116,7 +116,7 @@ public suspend fun TelegramBot.promoteSupergroupAdministrator(
canManageVideoChats: Boolean? = null, canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null, canManageChat: Boolean? = null,
canManageTopics: Boolean? = null, canManageTopics: Boolean? = null,
): Unit = promoteSupergroupAdministrator( ): Boolean = promoteSupergroupAdministrator(
chat.id, chat.id,
user.id, user.id,
untilDate = untilDate, untilDate = untilDate,

View File

@@ -16,7 +16,7 @@ public suspend fun TelegramBot.restrictChatMember(
untilDate: TelegramDate? = null, untilDate: TelegramDate? = null,
permissions: ChatPermissions = ChatPermissions(), permissions: ChatPermissions = ChatPermissions(),
useIndependentChatPermissions: Boolean? = permissions.isGranular.takeIf { it } useIndependentChatPermissions: Boolean? = permissions.isGranular.takeIf { it }
): Unit = execute(RestrictChatMember(chatId, userId, untilDate, permissions, useIndependentChatPermissions)) ): Boolean = execute(RestrictChatMember(chatId, userId, untilDate, permissions, useIndependentChatPermissions))
public suspend fun TelegramBot.restrictChatMember( public suspend fun TelegramBot.restrictChatMember(
chat: PublicChat, chat: PublicChat,
@@ -24,7 +24,7 @@ public suspend fun TelegramBot.restrictChatMember(
untilDate: TelegramDate? = null, untilDate: TelegramDate? = null,
permissions: ChatPermissions = ChatPermissions(), permissions: ChatPermissions = ChatPermissions(),
useIndependentChatPermissions: Boolean? = permissions.isGranular.takeIf { it } useIndependentChatPermissions: Boolean? = permissions.isGranular.takeIf { it }
): Unit = restrictChatMember(chat.id, userId, untilDate, permissions, useIndependentChatPermissions) ): Boolean = restrictChatMember(chat.id, userId, untilDate, permissions, useIndependentChatPermissions)
public suspend fun TelegramBot.restrictChatMember( public suspend fun TelegramBot.restrictChatMember(
chatId: IdChatIdentifier, chatId: IdChatIdentifier,
@@ -32,7 +32,7 @@ public suspend fun TelegramBot.restrictChatMember(
untilDate: TelegramDate? = null, untilDate: TelegramDate? = null,
permissions: ChatPermissions = ChatPermissions(), permissions: ChatPermissions = ChatPermissions(),
useIndependentChatPermissions: Boolean? = permissions.isGranular.takeIf { it } useIndependentChatPermissions: Boolean? = permissions.isGranular.takeIf { it }
): Unit = restrictChatMember(chatId, user.id, untilDate, permissions, useIndependentChatPermissions) ): Boolean = restrictChatMember(chatId, user.id, untilDate, permissions, useIndependentChatPermissions)
public suspend fun TelegramBot.restrictChatMember( public suspend fun TelegramBot.restrictChatMember(
chat: PublicChat, chat: PublicChat,
@@ -40,5 +40,5 @@ public suspend fun TelegramBot.restrictChatMember(
untilDate: TelegramDate? = null, untilDate: TelegramDate? = null,
permissions: ChatPermissions = ChatPermissions(), permissions: ChatPermissions = ChatPermissions(),
useIndependentChatPermissions: Boolean? = permissions.isGranular.takeIf { it } useIndependentChatPermissions: Boolean? = permissions.isGranular.takeIf { it }
): Unit = restrictChatMember(chat.id, user.id, untilDate, permissions, useIndependentChatPermissions) ): Boolean = restrictChatMember(chat.id, user.id, untilDate, permissions, useIndependentChatPermissions)

View File

@@ -11,22 +11,22 @@ public suspend fun TelegramBot.setChatAdministratorCustomTitle(
chatId: IdChatIdentifier, chatId: IdChatIdentifier,
userId: UserId, userId: UserId,
customTitle: String customTitle: String
): Unit = execute(SetChatAdministratorCustomTitle(chatId, userId, customTitle)) ): Boolean = execute(SetChatAdministratorCustomTitle(chatId, userId, customTitle))
public suspend fun TelegramBot.setChatAdministratorCustomTitle( public suspend fun TelegramBot.setChatAdministratorCustomTitle(
chat: PublicChat, chat: PublicChat,
userId: UserId, userId: UserId,
customTitle: String customTitle: String
): Unit = setChatAdministratorCustomTitle(chat.id, userId, customTitle) ): Boolean = setChatAdministratorCustomTitle(chat.id, userId, customTitle)
public suspend fun TelegramBot.setChatAdministratorCustomTitle( public suspend fun TelegramBot.setChatAdministratorCustomTitle(
chatId: IdChatIdentifier, chatId: IdChatIdentifier,
user: User, user: User,
customTitle: String customTitle: String
): Unit = setChatAdministratorCustomTitle(chatId, user.id, customTitle) ): Boolean = setChatAdministratorCustomTitle(chatId, user.id, customTitle)
public suspend fun TelegramBot.setChatAdministratorCustomTitle( public suspend fun TelegramBot.setChatAdministratorCustomTitle(
chat: PublicChat, chat: PublicChat,
user: User, user: User,
customTitle: String customTitle: String
): Unit = setChatAdministratorCustomTitle(chat.id, user.id, customTitle) ): Boolean = setChatAdministratorCustomTitle(chat.id, user.id, customTitle)

View File

@@ -1,31 +0,0 @@
package dev.inmo.tgbotapi.extensions.api.chat.members
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.chat.members.SetChatMemberTag
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.chat.PublicChat
import dev.inmo.tgbotapi.types.chat.User
public suspend fun TelegramBot.setChatMemberTag(
chatId: ChatIdentifier,
userId: UserId,
tag: UserTag? = null
): Unit = execute(SetChatMemberTag(chatId, userId, tag))
public suspend fun TelegramBot.setChatMemberTag(
chat: PublicChat,
userId: UserId,
tag: UserTag? = null
): Unit = setChatMemberTag(chat.id, userId, tag)
public suspend fun TelegramBot.setChatMemberTag(
chatId: ChatIdentifier,
user: User,
tag: UserTag? = null
): Unit = setChatMemberTag(chatId, user.id, tag)
public suspend fun TelegramBot.setChatMemberTag(
chat: PublicChat,
user: User,
tag: UserTag? = null
): Unit = setChatMemberTag(chat.id, user.id, tag)

View File

@@ -12,23 +12,23 @@ public suspend fun TelegramBot.unbanChatMember(
chatId: ChatIdentifier, chatId: ChatIdentifier,
userId: UserId, userId: UserId,
onlyIfBanned: Boolean? = null onlyIfBanned: Boolean? = null
): Unit = execute(UnbanChatMember(chatId, userId, onlyIfBanned)) ): Boolean = execute(UnbanChatMember(chatId, userId, onlyIfBanned))
public suspend fun TelegramBot.unbanChatMember( public suspend fun TelegramBot.unbanChatMember(
chat: PublicChat, chat: PublicChat,
userId: UserId, userId: UserId,
onlyIfBanned: Boolean? = null onlyIfBanned: Boolean? = null
): Unit = unbanChatMember(chat.id, userId, onlyIfBanned) ): Boolean = unbanChatMember(chat.id, userId, onlyIfBanned)
public suspend fun TelegramBot.unbanChatMember( public suspend fun TelegramBot.unbanChatMember(
chatId: IdChatIdentifier, chatId: IdChatIdentifier,
user: User, user: User,
onlyIfBanned: Boolean? = null onlyIfBanned: Boolean? = null
): Unit = unbanChatMember(chatId, user.id, onlyIfBanned) ): Boolean = unbanChatMember(chatId, user.id, onlyIfBanned)
public suspend fun TelegramBot.unbanChatMember( public suspend fun TelegramBot.unbanChatMember(
chat: PublicChat, chat: PublicChat,
user: User, user: User,
onlyIfBanned: Boolean? = null onlyIfBanned: Boolean? = null
): Unit = unbanChatMember(chat.id, user.id, onlyIfBanned) ): Boolean = unbanChatMember(chat.id, user.id, onlyIfBanned)

View File

@@ -9,19 +9,19 @@ import dev.inmo.tgbotapi.types.chat.PublicChat
public suspend fun TelegramBot.unbanChatSenderChat( public suspend fun TelegramBot.unbanChatSenderChat(
chatId: ChatIdentifier, chatId: ChatIdentifier,
senderChatId: IdChatIdentifier senderChatId: IdChatIdentifier
): Unit = execute(UnbanChatSenderChat(chatId, senderChatId)) ): Boolean = execute(UnbanChatSenderChat(chatId, senderChatId))
public suspend fun TelegramBot.unbanChatSenderChat( public suspend fun TelegramBot.unbanChatSenderChat(
chat: PublicChat, chat: PublicChat,
senderChatId: IdChatIdentifier senderChatId: IdChatIdentifier
): Unit = unbanChatSenderChat(chat.id, senderChatId) ): Boolean = unbanChatSenderChat(chat.id, senderChatId)
public suspend fun TelegramBot.unbanChatSenderChat( public suspend fun TelegramBot.unbanChatSenderChat(
chatId: IdChatIdentifier, chatId: IdChatIdentifier,
senderChat: PublicChat senderChat: PublicChat
): Unit = unbanChatSenderChat(chatId, senderChat.id) ): Boolean = unbanChatSenderChat(chatId, senderChat.id)
public suspend fun TelegramBot.unbanChatSenderChat( public suspend fun TelegramBot.unbanChatSenderChat(
chat: PublicChat, chat: PublicChat,
senderChat: PublicChat, senderChat: PublicChat,
): Unit = unbanChatSenderChat(chat.id, senderChat) ): Boolean = unbanChatSenderChat(chat.id, senderChat)

View File

@@ -7,8 +7,8 @@ import dev.inmo.tgbotapi.types.chat.PublicChat
public suspend fun TelegramBot.deleteChatPhoto( public suspend fun TelegramBot.deleteChatPhoto(
chatId: ChatIdentifier chatId: ChatIdentifier
): Unit = execute(DeleteChatPhoto(chatId)) ): Boolean = execute(DeleteChatPhoto(chatId))
public suspend fun TelegramBot.deleteChatPhoto( public suspend fun TelegramBot.deleteChatPhoto(
chat: PublicChat chat: PublicChat
): Unit = deleteChatPhoto(chat.id) ): Boolean = deleteChatPhoto(chat.id)

View File

@@ -14,17 +14,17 @@ public suspend fun TelegramBot.pinChatMessage(
messageId: MessageId, messageId: MessageId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false disableNotification: Boolean = false
): Unit = execute(PinChatMessage(chatId, messageId, businessConnectionId, disableNotification)) ): Boolean = execute(PinChatMessage(chatId, messageId, businessConnectionId, disableNotification))
public suspend fun TelegramBot.pinChatMessage( public suspend fun TelegramBot.pinChatMessage(
chat: Chat, chat: Chat,
messageId: MessageId, messageId: MessageId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false disableNotification: Boolean = false
): Unit = pinChatMessage(chat.id, messageId, businessConnectionId, disableNotification) ): Boolean = pinChatMessage(chat.id, messageId, businessConnectionId, disableNotification)
public suspend fun TelegramBot.pinChatMessage( public suspend fun TelegramBot.pinChatMessage(
message: AccessibleMessage, message: AccessibleMessage,
businessConnectionId: BusinessConnectionId? = message.chat.id.businessConnectionId, businessConnectionId: BusinessConnectionId? = message.chat.id.businessConnectionId,
disableNotification: Boolean = false disableNotification: Boolean = false
): Unit = pinChatMessage(message.chat.id, message.messageId, businessConnectionId, disableNotification) ): Boolean = pinChatMessage(message.chat.id, message.messageId, businessConnectionId, disableNotification)

View File

@@ -8,9 +8,9 @@ import dev.inmo.tgbotapi.types.chat.PublicChat
public suspend fun TelegramBot.setChatDescription( public suspend fun TelegramBot.setChatDescription(
chatId: ChatIdentifier, chatId: ChatIdentifier,
description: String description: String
): Unit = execute(SetChatDescription(chatId, description)) ): Boolean = execute(SetChatDescription(chatId, description))
public suspend fun TelegramBot.setChatDescription( public suspend fun TelegramBot.setChatDescription(
chat: PublicChat, chat: PublicChat,
description: String description: String
): Unit = setChatDescription(chat.id, description) ): Boolean = setChatDescription(chat.id, description)

View File

@@ -9,9 +9,9 @@ import dev.inmo.tgbotapi.types.chat.PrivateChat
public suspend fun TelegramBot.setChatMenuButton( public suspend fun TelegramBot.setChatMenuButton(
chatId: IdChatIdentifier, chatId: IdChatIdentifier,
menuButton: MenuButton menuButton: MenuButton
): Unit = execute(SetChatMenuButton(chatId, menuButton)) ): Boolean = execute(SetChatMenuButton(chatId, menuButton))
public suspend fun TelegramBot.setChatMenuButton( public suspend fun TelegramBot.setChatMenuButton(
chat: PrivateChat, chat: PrivateChat,
menuButton: MenuButton menuButton: MenuButton
): Unit = setChatMenuButton(chat.id, menuButton) ): Boolean = setChatMenuButton(chat.id, menuButton)

View File

@@ -10,10 +10,10 @@ public suspend fun TelegramBot.setDefaultChatMembersPermissions(
chatId: ChatIdentifier, chatId: ChatIdentifier,
permissions: ChatPermissions, permissions: ChatPermissions,
useIndependentChatPermissions: Boolean? = permissions.isGranular.takeIf { it } useIndependentChatPermissions: Boolean? = permissions.isGranular.takeIf { it }
): Unit = execute(SetChatPermissions(chatId, permissions, useIndependentChatPermissions)) ): Boolean = execute(SetChatPermissions(chatId, permissions, useIndependentChatPermissions))
public suspend fun TelegramBot.setDefaultChatMembersPermissions( public suspend fun TelegramBot.setDefaultChatMembersPermissions(
chat: PublicChat, chat: PublicChat,
permissions: ChatPermissions, permissions: ChatPermissions,
useIndependentChatPermissions: Boolean? = permissions.isGranular.takeIf { it } useIndependentChatPermissions: Boolean? = permissions.isGranular.takeIf { it }
): Unit = setDefaultChatMembersPermissions(chat.id, permissions, useIndependentChatPermissions) ): Boolean = setDefaultChatMembersPermissions(chat.id, permissions, useIndependentChatPermissions)

View File

@@ -9,9 +9,9 @@ import dev.inmo.tgbotapi.types.chat.PublicChat
public suspend fun TelegramBot.setChatPhoto( public suspend fun TelegramBot.setChatPhoto(
chatId: ChatIdentifier, chatId: ChatIdentifier,
photo: MultipartFile photo: MultipartFile
): Unit = execute(SetChatPhoto(chatId, photo)) ): Boolean = execute(SetChatPhoto(chatId, photo))
public suspend fun TelegramBot.setChatPhoto( public suspend fun TelegramBot.setChatPhoto(
chat: PublicChat, chat: PublicChat,
photo: MultipartFile photo: MultipartFile
): Unit = setChatPhoto(chat.id, photo) ): Boolean = setChatPhoto(chat.id, photo)

View File

@@ -8,9 +8,9 @@ import dev.inmo.tgbotapi.types.chat.PublicChat
public suspend fun TelegramBot.setChatTitle( public suspend fun TelegramBot.setChatTitle(
chatId: ChatIdentifier, chatId: ChatIdentifier,
title: String title: String
): Unit = execute(SetChatTitle(chatId, title)) ): Boolean = execute(SetChatTitle(chatId, title))
public suspend fun TelegramBot.setChatTitle( public suspend fun TelegramBot.setChatTitle(
chat: PublicChat, chat: PublicChat,
title: String title: String
): Unit = setChatTitle(chat.id, title) ): Boolean = setChatTitle(chat.id, title)

View File

@@ -6,4 +6,4 @@ import dev.inmo.tgbotapi.types.MenuButton
public suspend fun TelegramBot.setDefaultChatMenuButton( public suspend fun TelegramBot.setDefaultChatMenuButton(
menuButton: MenuButton menuButton: MenuButton
): Unit = execute(SetDefaultChatMenuButton(menuButton)) ): Boolean = execute(SetDefaultChatMenuButton(menuButton))

View File

@@ -7,8 +7,8 @@ import dev.inmo.tgbotapi.types.chat.Chat
public suspend fun TelegramBot.unpinAllChatMessages( public suspend fun TelegramBot.unpinAllChatMessages(
chatId: ChatIdentifier chatId: ChatIdentifier
): Unit = execute(UnpinAllChatMessages(chatId)) ): Boolean = execute(UnpinAllChatMessages(chatId))
public suspend fun TelegramBot.unpinAllChatMessages( public suspend fun TelegramBot.unpinAllChatMessages(
chat: Chat chat: Chat
): Unit = unpinAllChatMessages(chat.id) ): Boolean = unpinAllChatMessages(chat.id)

View File

@@ -13,15 +13,15 @@ public suspend fun TelegramBot.unpinChatMessage(
chatId: ChatIdentifier, chatId: ChatIdentifier,
messageId: MessageId? = null, messageId: MessageId? = null,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId
): Unit = execute(UnpinChatMessage(chatId, messageId, businessConnectionId)) ): Boolean = execute(UnpinChatMessage(chatId, messageId, businessConnectionId))
public suspend fun TelegramBot.unpinChatMessage( public suspend fun TelegramBot.unpinChatMessage(
chat: Chat, chat: Chat,
messageId: MessageId? = null, messageId: MessageId? = null,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId
): Unit = unpinChatMessage(chat.id, messageId, businessConnectionId) ): Boolean = unpinChatMessage(chat.id, messageId, businessConnectionId)
public suspend fun TelegramBot.unpinChatMessage( public suspend fun TelegramBot.unpinChatMessage(
message: AccessibleMessage, message: AccessibleMessage,
businessConnectionId: BusinessConnectionId? = message.chat.id.businessConnectionId, businessConnectionId: BusinessConnectionId? = message.chat.id.businessConnectionId,
): Unit = unpinChatMessage(message.chat.id, message.messageId, businessConnectionId) ): Boolean = unpinChatMessage(message.chat.id, message.messageId, businessConnectionId)

View File

@@ -7,8 +7,8 @@ import dev.inmo.tgbotapi.types.chat.SupergroupChat
public suspend fun TelegramBot.deleteChatStickerSet( public suspend fun TelegramBot.deleteChatStickerSet(
chatId: ChatIdentifier chatId: ChatIdentifier
): Unit = execute(DeleteChatStickerSet(chatId)) ): Boolean = execute(DeleteChatStickerSet(chatId))
public suspend fun TelegramBot.deleteChatStickerSet( public suspend fun TelegramBot.deleteChatStickerSet(
chat: SupergroupChat chat: SupergroupChat
): Unit = deleteChatStickerSet(chat.id) ): Boolean = deleteChatStickerSet(chat.id)

View File

@@ -9,9 +9,9 @@ import dev.inmo.tgbotapi.types.chat.SupergroupChat
public suspend fun TelegramBot.setChatStickerSet( public suspend fun TelegramBot.setChatStickerSet(
chatId: ChatIdentifier, chatId: ChatIdentifier,
stickerSetName: StickerSetName stickerSetName: StickerSetName
): Unit = execute(SetChatStickerSet(chatId, stickerSetName)) ): Boolean = execute(SetChatStickerSet(chatId, stickerSetName))
public suspend fun TelegramBot.setChatStickerSet( public suspend fun TelegramBot.setChatStickerSet(
chat: SupergroupChat, chat: SupergroupChat,
stickerSetName: StickerSetName stickerSetName: StickerSetName
): Unit = setChatStickerSet(chat.id, stickerSetName) ): Boolean = setChatStickerSet(chat.id, stickerSetName)

View File

@@ -27,7 +27,7 @@ public suspend fun TelegramBot.edit(
heading: Degrees? = null, heading: Degrees? = null,
proximityAlertRadius: Meters? = null, proximityAlertRadius: Meters? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
): Unit = editLiveLocation(messageId, latitude, longitude, horizontalAccuracy, heading, proximityAlertRadius, replyMarkup) ): Boolean = editLiveLocation(messageId, latitude, longitude, horizontalAccuracy, heading, proximityAlertRadius, replyMarkup)
/** /**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
@@ -37,7 +37,7 @@ public suspend fun TelegramBot.edit(
messageId: InlineMessageId, messageId: InlineMessageId,
location: LiveLocation, location: LiveLocation,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
): Unit = editLiveLocation( ): Boolean = editLiveLocation(
messageId, location, replyMarkup messageId, location, replyMarkup
) )
@@ -49,7 +49,7 @@ public suspend fun TelegramBot.edit(
messageId: InlineMessageId, messageId: InlineMessageId,
media: TelegramFreeMedia, media: TelegramFreeMedia,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
): Unit = editMessageMedia(messageId, media, replyMarkup) ): Boolean = editMessageMedia(messageId, media, replyMarkup)
/** /**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
@@ -58,7 +58,7 @@ public suspend fun TelegramBot.edit(
public suspend fun TelegramBot.edit( public suspend fun TelegramBot.edit(
messageId: InlineMessageId, messageId: InlineMessageId,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
): Unit = editMessageReplyMarkup(messageId, replyMarkup) ): Boolean = editMessageReplyMarkup(messageId, replyMarkup)
/** /**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
@@ -71,7 +71,7 @@ public suspend fun TelegramBot.edit(
showCaptionAboveMedia: Boolean = false, showCaptionAboveMedia: Boolean = false,
linkPreviewOptions: LinkPreviewOptions? = null, linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
): Unit = editMessageText(messageId, text, parseMode, showCaptionAboveMedia, linkPreviewOptions, replyMarkup) ): Boolean = editMessageText(messageId, text, parseMode, showCaptionAboveMedia, linkPreviewOptions, replyMarkup)
/** /**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
@@ -83,7 +83,7 @@ public suspend fun TelegramBot.edit(
showCaptionAboveMedia: Boolean = false, showCaptionAboveMedia: Boolean = false,
linkPreviewOptions: LinkPreviewOptions? = null, linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
): Unit = editMessageText(messageId, entities, showCaptionAboveMedia, linkPreviewOptions, replyMarkup) ): Boolean = editMessageText(messageId, entities, showCaptionAboveMedia, linkPreviewOptions, replyMarkup)
/** /**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
@@ -96,7 +96,7 @@ public suspend fun TelegramBot.edit(
linkPreviewOptions: LinkPreviewOptions? = null, linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null, replyMarkup: InlineKeyboardMarkup? = null,
builderBody: EntitiesBuilderBody builderBody: EntitiesBuilderBody
): Unit = edit(messageId, buildEntities(separator, builderBody), showCaptionAboveMedia, linkPreviewOptions, replyMarkup) ): Boolean = edit(messageId, buildEntities(separator, builderBody), showCaptionAboveMedia, linkPreviewOptions, replyMarkup)
/** /**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
@@ -109,4 +109,4 @@ public suspend fun TelegramBot.edit(
linkPreviewOptions: LinkPreviewOptions? = null, linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null, replyMarkup: InlineKeyboardMarkup? = null,
builderBody: EntitiesBuilderBody builderBody: EntitiesBuilderBody
): Unit = edit(messageId, buildEntities(separator, builderBody), showCaptionAboveMedia, linkPreviewOptions, replyMarkup) ): Boolean = edit(messageId, buildEntities(separator, builderBody), showCaptionAboveMedia, linkPreviewOptions, replyMarkup)

View File

@@ -16,7 +16,7 @@ public suspend fun TelegramBot.editMessageCaption(
text: String, text: String,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
): Unit = execute(EditInlineMessageCaption(inlineMessageId, text, parseMode, replyMarkup)) ): Boolean = execute(EditInlineMessageCaption(inlineMessageId, text, parseMode, replyMarkup))
/** /**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
@@ -26,4 +26,4 @@ public suspend fun TelegramBot.editMessageCaption(
inlineMessageId: InlineMessageId, inlineMessageId: InlineMessageId,
entities: TextSourcesList, entities: TextSourcesList,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
): Unit = execute(EditInlineMessageCaption(inlineMessageId, entities, replyMarkup)) ): Boolean = execute(EditInlineMessageCaption(inlineMessageId, entities, replyMarkup))

View File

@@ -14,7 +14,7 @@ public suspend fun TelegramBot.editLiveLocation(
heading: Degrees? = null, heading: Degrees? = null,
proximityAlertRadius: Meters? = null, proximityAlertRadius: Meters? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
): Unit = execute( ): Boolean = execute(
EditInlineMessageLiveLocation( EditInlineMessageLiveLocation(
inlineMessageId, latitude, longitude, horizontalAccuracy, heading, proximityAlertRadius, replyMarkup inlineMessageId, latitude, longitude, horizontalAccuracy, heading, proximityAlertRadius, replyMarkup
) )
@@ -23,4 +23,4 @@ public suspend fun TelegramBot.editLiveLocation(
inlineMessageId: InlineMessageId, inlineMessageId: InlineMessageId,
location: LiveLocation, location: LiveLocation,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
): Unit = editLiveLocation(inlineMessageId, location.latitude, location.longitude, location.horizontalAccuracy, location.heading, location.proximityAlertRadius, replyMarkup) ): Boolean = editLiveLocation(inlineMessageId, location.latitude, location.longitude, location.horizontalAccuracy, location.heading, location.proximityAlertRadius, replyMarkup)

View File

@@ -12,7 +12,7 @@ import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
public suspend fun TelegramBot.stopLiveLocation( public suspend fun TelegramBot.stopLiveLocation(
inlineMessageId: InlineMessageId, inlineMessageId: InlineMessageId,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
): Unit = execute( ): Boolean = execute(
StopInlineMessageLiveLocation( StopInlineMessageLiveLocation(
inlineMessageId, replyMarkup inlineMessageId, replyMarkup
) )

View File

@@ -14,4 +14,4 @@ public suspend fun TelegramBot.editMessageMedia(
inlineMessageId: InlineMessageId, inlineMessageId: InlineMessageId,
media: TelegramFreeMedia, media: TelegramFreeMedia,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
): Unit = execute(EditInlineMessageMedia(inlineMessageId, media, replyMarkup)) ): Boolean = execute(EditInlineMessageMedia(inlineMessageId, media, replyMarkup))

View File

@@ -10,7 +10,7 @@ public suspend fun TelegramBot.editUserStarSubscription(
userId: UserId, userId: UserId,
telegramPaymentChargeId: TelegramPaymentChargeId, telegramPaymentChargeId: TelegramPaymentChargeId,
isCanceled: Boolean isCanceled: Boolean
): Unit = execute( ): Boolean = execute(
EditUserStarSubscription( EditUserStarSubscription(
userId = userId, userId = userId,
telegramPaymentChargeId = telegramPaymentChargeId, telegramPaymentChargeId = telegramPaymentChargeId,
@@ -22,7 +22,7 @@ public suspend fun TelegramBot.editUserStarSubscription(
user: User, user: User,
telegramPaymentChargeId: TelegramPaymentChargeId, telegramPaymentChargeId: TelegramPaymentChargeId,
isCanceled: Boolean isCanceled: Boolean
): Unit = editUserStarSubscription( ): Boolean = editUserStarSubscription(
userId = user.id, userId = user.id,
telegramPaymentChargeId = telegramPaymentChargeId, telegramPaymentChargeId = telegramPaymentChargeId,
isCanceled = isCanceled isCanceled = isCanceled
@@ -31,7 +31,7 @@ public suspend fun TelegramBot.editUserStarSubscription(
public suspend fun TelegramBot.cancelUserStarSubscription( public suspend fun TelegramBot.cancelUserStarSubscription(
userId: UserId, userId: UserId,
telegramPaymentChargeId: TelegramPaymentChargeId, telegramPaymentChargeId: TelegramPaymentChargeId,
): Unit = editUserStarSubscription( ): Boolean = editUserStarSubscription(
userId = userId, userId = userId,
telegramPaymentChargeId = telegramPaymentChargeId, telegramPaymentChargeId = telegramPaymentChargeId,
isCanceled = true isCanceled = true
@@ -40,7 +40,7 @@ public suspend fun TelegramBot.cancelUserStarSubscription(
public suspend fun TelegramBot.cancelUserStarSubscription( public suspend fun TelegramBot.cancelUserStarSubscription(
user: User, user: User,
telegramPaymentChargeId: TelegramPaymentChargeId, telegramPaymentChargeId: TelegramPaymentChargeId,
): Unit = editUserStarSubscription( ): Boolean = editUserStarSubscription(
user = user, user = user,
telegramPaymentChargeId = telegramPaymentChargeId, telegramPaymentChargeId = telegramPaymentChargeId,
isCanceled = true isCanceled = true
@@ -49,7 +49,7 @@ public suspend fun TelegramBot.cancelUserStarSubscription(
public suspend fun TelegramBot.enableUserStarSubscription( public suspend fun TelegramBot.enableUserStarSubscription(
userId: UserId, userId: UserId,
telegramPaymentChargeId: TelegramPaymentChargeId, telegramPaymentChargeId: TelegramPaymentChargeId,
): Unit = editUserStarSubscription( ): Boolean = editUserStarSubscription(
userId = userId, userId = userId,
telegramPaymentChargeId = telegramPaymentChargeId, telegramPaymentChargeId = telegramPaymentChargeId,
isCanceled = false isCanceled = false
@@ -58,7 +58,7 @@ public suspend fun TelegramBot.enableUserStarSubscription(
public suspend fun TelegramBot.enableUserStarSubscription( public suspend fun TelegramBot.enableUserStarSubscription(
user: User, user: User,
telegramPaymentChargeId: TelegramPaymentChargeId, telegramPaymentChargeId: TelegramPaymentChargeId,
): Unit = editUserStarSubscription( ): Boolean = editUserStarSubscription(
user = user, user = user,
telegramPaymentChargeId = telegramPaymentChargeId, telegramPaymentChargeId = telegramPaymentChargeId,
isCanceled = false isCanceled = false

View File

@@ -12,4 +12,4 @@ import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
public suspend fun TelegramBot.editMessageReplyMarkup( public suspend fun TelegramBot.editMessageReplyMarkup(
inlineMessageId: InlineMessageId, inlineMessageId: InlineMessageId,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
): Unit = execute(EditInlineMessageReplyMarkup(inlineMessageId, replyMarkup)) ): Boolean = execute(EditInlineMessageReplyMarkup(inlineMessageId, replyMarkup))

View File

@@ -22,7 +22,7 @@ public suspend fun TelegramBot.editMessageText(
showCaptionAboveMedia: Boolean = false, showCaptionAboveMedia: Boolean = false,
linkPreviewOptions: LinkPreviewOptions? = null, linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
): Unit = execute(EditInlineMessageText(inlineMessageId, text, parseMode, showCaptionAboveMedia, linkPreviewOptions, replyMarkup)) ): Boolean = execute(EditInlineMessageText(inlineMessageId, text, parseMode, showCaptionAboveMedia, linkPreviewOptions, replyMarkup))
/** /**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
@@ -34,7 +34,7 @@ public suspend fun TelegramBot.editMessageText(
showCaptionAboveMedia: Boolean = false, showCaptionAboveMedia: Boolean = false,
linkPreviewOptions: LinkPreviewOptions? = null, linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
): Unit = execute(EditInlineMessageText(inlineMessageId, entities, showCaptionAboveMedia, linkPreviewOptions, replyMarkup)) ): Boolean = execute(EditInlineMessageText(inlineMessageId, entities, showCaptionAboveMedia, linkPreviewOptions, replyMarkup))
/** /**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
@@ -47,7 +47,7 @@ public suspend fun TelegramBot.editMessageText(
linkPreviewOptions: LinkPreviewOptions? = null, linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null, replyMarkup: InlineKeyboardMarkup? = null,
builderBody: EntitiesBuilderBody builderBody: EntitiesBuilderBody
): Unit = editMessageText(inlineMessageId, buildEntities(separator, builderBody), showCaptionAboveMedia, linkPreviewOptions, replyMarkup) ): Boolean = editMessageText(inlineMessageId, buildEntities(separator, builderBody), showCaptionAboveMedia, linkPreviewOptions, replyMarkup)
/** /**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
@@ -60,4 +60,4 @@ public suspend fun TelegramBot.editMessageText(
linkPreviewOptions: LinkPreviewOptions? = null, linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null, replyMarkup: InlineKeyboardMarkup? = null,
builderBody: EntitiesBuilderBody builderBody: EntitiesBuilderBody
): Unit = editMessageText(inlineMessageId, buildEntities(separator, builderBody), showCaptionAboveMedia, linkPreviewOptions, replyMarkup) ): Boolean = editMessageText(inlineMessageId, buildEntities(separator, builderBody), showCaptionAboveMedia, linkPreviewOptions, replyMarkup)

View File

@@ -15,7 +15,7 @@ public suspend fun TelegramBot.setGameScore(
messageId: MessageId, messageId: MessageId,
force: Boolean = false, force: Boolean = false,
disableEditMessage: Boolean = false disableEditMessage: Boolean = false
): Unit = execute( ): Boolean = execute(
SetGameScoreByChatId(userId, score, chatId, messageId, force, disableEditMessage) SetGameScoreByChatId(userId, score, chatId, messageId, force, disableEditMessage)
) )
@@ -26,7 +26,7 @@ public suspend fun TelegramBot.setGameScore(
messageId: MessageId, messageId: MessageId,
force: Boolean = false, force: Boolean = false,
disableEditMessage: Boolean = false disableEditMessage: Boolean = false
): Unit = setGameScore( ): Boolean = setGameScore(
user.id, score, chatId, messageId, force, disableEditMessage user.id, score, chatId, messageId, force, disableEditMessage
) )
@@ -37,7 +37,7 @@ public suspend fun TelegramBot.setGameScore(
messageId: MessageId, messageId: MessageId,
force: Boolean = false, force: Boolean = false,
disableEditMessage: Boolean = false disableEditMessage: Boolean = false
): Unit = setGameScore( ): Boolean = setGameScore(
userId, score, chat.id, messageId, force, disableEditMessage userId, score, chat.id, messageId, force, disableEditMessage
) )
@@ -48,7 +48,7 @@ public suspend fun TelegramBot.setGameScore(
messageId: MessageId, messageId: MessageId,
force: Boolean = false, force: Boolean = false,
disableEditMessage: Boolean = false disableEditMessage: Boolean = false
): Unit = setGameScore( ): Boolean = setGameScore(
user.id, score, chat.id, messageId, force, disableEditMessage user.id, score, chat.id, messageId, force, disableEditMessage
) )
@@ -58,7 +58,7 @@ public suspend fun TelegramBot.setGameScore(
message: ContentMessage<GameContent>, message: ContentMessage<GameContent>,
force: Boolean = false, force: Boolean = false,
disableEditMessage: Boolean = false disableEditMessage: Boolean = false
): Unit = setGameScore( ): Boolean = setGameScore(
userId, score, message.chat.id, message.messageId, force, disableEditMessage userId, score, message.chat.id, message.messageId, force, disableEditMessage
) )
@@ -68,6 +68,6 @@ public suspend fun TelegramBot.setGameScore(
message: ContentMessage<GameContent>, message: ContentMessage<GameContent>,
force: Boolean = false, force: Boolean = false,
disableEditMessage: Boolean = false disableEditMessage: Boolean = false
): Unit = setGameScore( ): Boolean = setGameScore(
user.id, score, message.chat.id, message.messageId, force, disableEditMessage user.id, score, message.chat.id, message.messageId, force, disableEditMessage
) )

View File

@@ -11,7 +11,7 @@ public suspend fun TelegramBot.setGameScore(
inlineMessageId: InlineMessageId, inlineMessageId: InlineMessageId,
force: Boolean = false, force: Boolean = false,
disableEditMessage: Boolean = false disableEditMessage: Boolean = false
): Unit = execute( ): Boolean = execute(
SetGameScoreByInlineMessageId( SetGameScoreByInlineMessageId(
userId, score, inlineMessageId, force, disableEditMessage userId, score, inlineMessageId, force, disableEditMessage
) )
@@ -23,4 +23,4 @@ public suspend fun TelegramBot.setGameScore(
inlineMessageId: InlineMessageId, inlineMessageId: InlineMessageId,
force: Boolean = false, force: Boolean = false,
disableEditMessage: Boolean = false disableEditMessage: Boolean = false
): Unit = setGameScore(user.id, score, inlineMessageId, force, disableEditMessage) ): Boolean = setGameScore(user.id, score, inlineMessageId, force, disableEditMessage)

View File

@@ -1,23 +0,0 @@
package dev.inmo.tgbotapi.extensions.api.get
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.get.GetUserProfileAudios
import dev.inmo.tgbotapi.types.chat.CommonUser
import dev.inmo.tgbotapi.types.UserId
import dev.inmo.tgbotapi.types.UserProfileAudios
public suspend fun TelegramBot.getUserProfileAudios(
userId: UserId,
offset: Int? = null,
limit: Int? = null
): UserProfileAudios = execute(
GetUserProfileAudios(
userId = userId, offset = offset, limit = limit
)
)
public suspend fun TelegramBot.getUserProfileAudios(
user: CommonUser,
offset: Int? = null,
limit: Int? = null
): UserProfileAudios = getUserProfileAudios(userId = user.id, offset = offset, limit = limit)

Some files were not shown because too many files have changed in this diff Show More