mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2025-12-25 15:45:47 +00:00
Compare commits
20 Commits
f47b3673a7
...
v12.0.1
| Author | SHA1 | Date | |
|---|---|---|---|
| 3da2229a9c | |||
| 624289cc8e | |||
| 9edc8a0d5a | |||
| 3bf914471a | |||
| 7d3c8a2d27 | |||
| f12628bec3 | |||
| c1734e6d12 | |||
| 4bff860c01 | |||
| 6a8b83f750 | |||
| ab9718b7c6 | |||
| 0a9235bcd9 | |||
| eff2f2ba41 | |||
| db644c93ff | |||
| 28e031265c | |||
| 84abd006ad | |||
| 5f4a327c2e | |||
| c5102590cc | |||
| 072264faad | |||
| 6b74bc155e | |||
| 9d506b11a3 |
11
CHANGELOG.md
11
CHANGELOG.md
@@ -1,7 +1,18 @@
|
||||
# TelegramBotAPI changelog
|
||||
|
||||
## 12.0.1
|
||||
|
||||
* `Version`:
|
||||
* `Ktor`: `2.3.9` -> `2.3.10`
|
||||
* `MicroUtils`: `0.20.39` -> `0.20.45`
|
||||
* `UUID`: `0.8.2` -> `0.8.4`
|
||||
|
||||
## 12.0.0
|
||||
|
||||
**Add support of [Telegram Bots API 7.2](https://core.telegram.org/bots/api-changelog#march-31-2024)**
|
||||
|
||||
**THIS UPDATE CONTAINS A LOT OF BREAKING CHANGES**
|
||||
|
||||
## 11.0.0
|
||||
|
||||
**THIS UPDATE CONTAINS REMOVES OF DEPRECATED THINGS**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# TelegramBotAPI [](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi) [](https://core.telegram.org/bots/api-changelog#february-16-2024)
|
||||
# TelegramBotAPI [](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi) [](https://core.telegram.org/bots/api-changelog#march-31-2024)
|
||||
|
||||
| Docs | [](https://tgbotapi.inmo.dev/index.html) [](https://docs.inmo.dev/tgbotapi/index.html) |
|
||||
|:----------------------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
|
||||
|
||||
@@ -6,4 +6,4 @@ kotlin.incremental=true
|
||||
kotlin.incremental.js=true
|
||||
|
||||
library_group=dev.inmo
|
||||
library_version=12.0.0
|
||||
library_version=12.0.1
|
||||
|
||||
@@ -7,13 +7,13 @@ kotlin-coroutines = "1.8.0"
|
||||
javax-activation = "1.1.1"
|
||||
|
||||
korlibs = "5.4.0"
|
||||
uuid = "0.8.2"
|
||||
ktor = "2.3.9"
|
||||
uuid = "0.8.4"
|
||||
ktor = "2.3.10"
|
||||
|
||||
ksp = "1.9.23-1.0.19"
|
||||
ksp = "1.9.23-1.0.20"
|
||||
kotlin-poet = "1.16.0"
|
||||
|
||||
microutils = "0.20.39"
|
||||
microutils = "0.20.45"
|
||||
kslog = "1.3.3"
|
||||
|
||||
versions = "0.51.0"
|
||||
|
||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
|
||||
|
||||
@@ -2065,25 +2065,25 @@ public final class dev/inmo/tgbotapi/extensions/api/send/polls/SendPollKt {
|
||||
}
|
||||
|
||||
public final class dev/inmo/tgbotapi/extensions/api/stickers/AddStickerToSetKt {
|
||||
public static final fun addStickerToSet (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/CommonUser;Ldev/inmo/tgbotapi/types/stickers/StickerSet;Ldev/inmo/tgbotapi/requests/abstracts/InputFile;Ljava/util/List;Ldev/inmo/tgbotapi/types/stickers/MaskPosition;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static final fun addStickerToSet (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/CommonUser;Ldev/inmo/tgbotapi/types/stickers/StickerSet;Ldev/inmo/tgbotapi/requests/abstracts/InputFile;Ljava/util/List;Ljava/util/List;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static final fun addStickerToSet (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/CommonUser;Ldev/inmo/tgbotapi/types/stickers/StickerSet;Ldev/inmo/tgbotapi/requests/abstracts/InputFile;Ldev/inmo/tgbotapi/types/StickerFormat;Ljava/util/List;Ldev/inmo/tgbotapi/types/stickers/MaskPosition;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static final fun addStickerToSet (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/CommonUser;Ldev/inmo/tgbotapi/types/stickers/StickerSet;Ldev/inmo/tgbotapi/requests/abstracts/InputFile;Ldev/inmo/tgbotapi/types/StickerFormat;Ljava/util/List;Ljava/util/List;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static final fun addStickerToSet (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/CommonUser;Ldev/inmo/tgbotapi/types/stickers/StickerSet;Ldev/inmo/tgbotapi/requests/stickers/InputSticker;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static synthetic fun addStickerToSet$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/CommonUser;Ldev/inmo/tgbotapi/types/stickers/StickerSet;Ldev/inmo/tgbotapi/requests/abstracts/InputFile;Ljava/util/List;Ldev/inmo/tgbotapi/types/stickers/MaskPosition;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
|
||||
public static synthetic fun addStickerToSet$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/CommonUser;Ldev/inmo/tgbotapi/types/stickers/StickerSet;Ldev/inmo/tgbotapi/requests/abstracts/InputFile;Ljava/util/List;Ljava/util/List;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
|
||||
public static synthetic fun addStickerToSet$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/CommonUser;Ldev/inmo/tgbotapi/types/stickers/StickerSet;Ldev/inmo/tgbotapi/requests/abstracts/InputFile;Ldev/inmo/tgbotapi/types/StickerFormat;Ljava/util/List;Ldev/inmo/tgbotapi/types/stickers/MaskPosition;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
|
||||
public static synthetic fun addStickerToSet$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/CommonUser;Ldev/inmo/tgbotapi/types/stickers/StickerSet;Ldev/inmo/tgbotapi/requests/abstracts/InputFile;Ldev/inmo/tgbotapi/types/StickerFormat;Ljava/util/List;Ljava/util/List;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
|
||||
public static final fun addStickerToSet-4iNBclM (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLdev/inmo/tgbotapi/types/stickers/StickerSet;Ldev/inmo/tgbotapi/requests/stickers/InputSticker;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static final fun addStickerToSet-4iNBclM (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLjava/lang/String;Ldev/inmo/tgbotapi/requests/stickers/InputSticker;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static final fun addStickerToSet-It0iktY (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLjava/lang/String;Ldev/inmo/tgbotapi/requests/stickers/InputSticker;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static final fun addStickerToSet-VjR9mJc (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLdev/inmo/tgbotapi/types/stickers/StickerSet;Ldev/inmo/tgbotapi/requests/abstracts/InputFile;Ljava/util/List;Ldev/inmo/tgbotapi/types/stickers/MaskPosition;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static final fun addStickerToSet-VjR9mJc (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLdev/inmo/tgbotapi/types/stickers/StickerSet;Ldev/inmo/tgbotapi/requests/abstracts/InputFile;Ljava/util/List;Ljava/util/List;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static synthetic fun addStickerToSet-VjR9mJc$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLdev/inmo/tgbotapi/types/stickers/StickerSet;Ldev/inmo/tgbotapi/requests/abstracts/InputFile;Ljava/util/List;Ldev/inmo/tgbotapi/types/stickers/MaskPosition;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
|
||||
public static synthetic fun addStickerToSet-VjR9mJc$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLdev/inmo/tgbotapi/types/stickers/StickerSet;Ldev/inmo/tgbotapi/requests/abstracts/InputFile;Ljava/util/List;Ljava/util/List;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
|
||||
public static final fun addStickerToSet-W2FzMBY (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLdev/inmo/tgbotapi/types/stickers/StickerSet;Ldev/inmo/tgbotapi/requests/abstracts/InputFile;Ldev/inmo/tgbotapi/types/StickerFormat;Ljava/util/List;Ldev/inmo/tgbotapi/types/stickers/MaskPosition;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static final fun addStickerToSet-W2FzMBY (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLdev/inmo/tgbotapi/types/stickers/StickerSet;Ldev/inmo/tgbotapi/requests/abstracts/InputFile;Ldev/inmo/tgbotapi/types/StickerFormat;Ljava/util/List;Ljava/util/List;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static synthetic fun addStickerToSet-W2FzMBY$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLdev/inmo/tgbotapi/types/stickers/StickerSet;Ldev/inmo/tgbotapi/requests/abstracts/InputFile;Ldev/inmo/tgbotapi/types/StickerFormat;Ljava/util/List;Ldev/inmo/tgbotapi/types/stickers/MaskPosition;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
|
||||
public static synthetic fun addStickerToSet-W2FzMBY$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLdev/inmo/tgbotapi/types/stickers/StickerSet;Ldev/inmo/tgbotapi/requests/abstracts/InputFile;Ldev/inmo/tgbotapi/types/StickerFormat;Ljava/util/List;Ljava/util/List;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
|
||||
}
|
||||
|
||||
public final class dev/inmo/tgbotapi/extensions/api/stickers/CreateNewStickerSetKt {
|
||||
public static final fun createNewStickerSet (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/CommonUser;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/StickerFormat;Ljava/util/List;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static synthetic fun createNewStickerSet$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/CommonUser;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/StickerFormat;Ljava/util/List;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
|
||||
public static final fun createNewStickerSet-W2FzMBY (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLjava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/StickerFormat;Ljava/util/List;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static synthetic fun createNewStickerSet-W2FzMBY$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLjava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/StickerFormat;Ljava/util/List;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
|
||||
public static final fun createNewStickerSet (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/CommonUser;Ljava/lang/String;Ljava/lang/String;Ljava/util/List;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static synthetic fun createNewStickerSet$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/CommonUser;Ljava/lang/String;Ljava/lang/String;Ljava/util/List;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
|
||||
public static final fun createNewStickerSet-VjR9mJc (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLjava/lang/String;Ljava/lang/String;Ljava/util/List;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static synthetic fun createNewStickerSet-VjR9mJc$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLjava/lang/String;Ljava/lang/String;Ljava/util/List;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
|
||||
}
|
||||
|
||||
public final class dev/inmo/tgbotapi/extensions/api/stickers/DeleteStickerFromSetKt {
|
||||
@@ -2097,6 +2097,21 @@ public final class dev/inmo/tgbotapi/extensions/api/stickers/DeleteStickerSetKt
|
||||
public static final fun deleteStickerSet-ES61iX4 (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
}
|
||||
|
||||
public final class dev/inmo/tgbotapi/extensions/api/stickers/ReplaceStickerInSetKt {
|
||||
public static final fun replaceStickerInSet (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/CommonUser;Ldev/inmo/tgbotapi/types/stickers/StickerSet;Ldev/inmo/tgbotapi/requests/abstracts/FileId;Ldev/inmo/tgbotapi/requests/abstracts/InputFile;Ldev/inmo/tgbotapi/types/StickerFormat;Ljava/util/List;Ldev/inmo/tgbotapi/types/stickers/MaskPosition;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static final fun replaceStickerInSet (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/CommonUser;Ldev/inmo/tgbotapi/types/stickers/StickerSet;Ldev/inmo/tgbotapi/requests/abstracts/FileId;Ldev/inmo/tgbotapi/requests/abstracts/InputFile;Ldev/inmo/tgbotapi/types/StickerFormat;Ljava/util/List;Ljava/util/List;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static final fun replaceStickerInSet (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/CommonUser;Ldev/inmo/tgbotapi/types/stickers/StickerSet;Ldev/inmo/tgbotapi/requests/abstracts/FileId;Ldev/inmo/tgbotapi/requests/stickers/InputSticker;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static synthetic fun replaceStickerInSet$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/CommonUser;Ldev/inmo/tgbotapi/types/stickers/StickerSet;Ldev/inmo/tgbotapi/requests/abstracts/FileId;Ldev/inmo/tgbotapi/requests/abstracts/InputFile;Ldev/inmo/tgbotapi/types/StickerFormat;Ljava/util/List;Ldev/inmo/tgbotapi/types/stickers/MaskPosition;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
|
||||
public static synthetic fun replaceStickerInSet$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/CommonUser;Ldev/inmo/tgbotapi/types/stickers/StickerSet;Ldev/inmo/tgbotapi/requests/abstracts/FileId;Ldev/inmo/tgbotapi/requests/abstracts/InputFile;Ldev/inmo/tgbotapi/types/StickerFormat;Ljava/util/List;Ljava/util/List;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
|
||||
public static final fun replaceStickerInSet-GSYghJ8 (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLdev/inmo/tgbotapi/types/stickers/StickerSet;Ldev/inmo/tgbotapi/requests/abstracts/FileId;Ldev/inmo/tgbotapi/requests/abstracts/InputFile;Ldev/inmo/tgbotapi/types/StickerFormat;Ljava/util/List;Ldev/inmo/tgbotapi/types/stickers/MaskPosition;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static final fun replaceStickerInSet-GSYghJ8 (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLdev/inmo/tgbotapi/types/stickers/StickerSet;Ldev/inmo/tgbotapi/requests/abstracts/FileId;Ldev/inmo/tgbotapi/requests/abstracts/InputFile;Ldev/inmo/tgbotapi/types/StickerFormat;Ljava/util/List;Ljava/util/List;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static synthetic fun replaceStickerInSet-GSYghJ8$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLdev/inmo/tgbotapi/types/stickers/StickerSet;Ldev/inmo/tgbotapi/requests/abstracts/FileId;Ldev/inmo/tgbotapi/requests/abstracts/InputFile;Ldev/inmo/tgbotapi/types/StickerFormat;Ljava/util/List;Ldev/inmo/tgbotapi/types/stickers/MaskPosition;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
|
||||
public static synthetic fun replaceStickerInSet-GSYghJ8$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLdev/inmo/tgbotapi/types/stickers/StickerSet;Ldev/inmo/tgbotapi/requests/abstracts/FileId;Ldev/inmo/tgbotapi/requests/abstracts/InputFile;Ldev/inmo/tgbotapi/types/StickerFormat;Ljava/util/List;Ljava/util/List;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
|
||||
public static final fun replaceStickerInSet-ftAj2Hw (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLjava/lang/String;Ldev/inmo/tgbotapi/requests/abstracts/FileId;Ldev/inmo/tgbotapi/requests/stickers/InputSticker;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static final fun replaceStickerInSet-ySMgKnk (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLdev/inmo/tgbotapi/types/stickers/StickerSet;Ldev/inmo/tgbotapi/requests/abstracts/FileId;Ldev/inmo/tgbotapi/requests/stickers/InputSticker;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static final fun replaceStickerInSet-ySMgKnk (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLjava/lang/String;Ldev/inmo/tgbotapi/requests/abstracts/FileId;Ldev/inmo/tgbotapi/requests/stickers/InputSticker;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
}
|
||||
|
||||
public final class dev/inmo/tgbotapi/extensions/api/stickers/SetStickerEmojiListKt {
|
||||
public static final fun setStickerEmojiList (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/requests/abstracts/FileId;Ljava/util/List;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static final fun setStickerEmojiList (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/files/Sticker;[Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
@@ -2132,15 +2147,15 @@ public final class dev/inmo/tgbotapi/extensions/api/thumbs/SetCustomEmojiSticker
|
||||
public static final fun setCustomEmojiStickerSetThumbnail-KofBPHw (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ljava/lang/String;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
}
|
||||
|
||||
public final class dev/inmo/tgbotapi/extensions/api/thumbs/SetStickerSetThumbKt {
|
||||
public static final fun setStickerSetThumbnail (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/CommonUser;Ldev/inmo/tgbotapi/types/stickers/StickerSet;Ldev/inmo/tgbotapi/requests/abstracts/FileId;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static final fun setStickerSetThumbnail (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/CommonUser;Ldev/inmo/tgbotapi/types/stickers/StickerSet;Ldev/inmo/tgbotapi/requests/abstracts/MultipartFile;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static final fun setStickerSetThumbnail-4iNBclM (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLdev/inmo/tgbotapi/types/stickers/StickerSet;Ldev/inmo/tgbotapi/requests/abstracts/FileId;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static final fun setStickerSetThumbnail-4iNBclM (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLdev/inmo/tgbotapi/types/stickers/StickerSet;Ldev/inmo/tgbotapi/requests/abstracts/MultipartFile;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static final fun setStickerSetThumbnail-DXF-zCU (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/CommonUser;Ljava/lang/String;Ldev/inmo/tgbotapi/requests/abstracts/FileId;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static final fun setStickerSetThumbnail-DXF-zCU (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/CommonUser;Ljava/lang/String;Ldev/inmo/tgbotapi/requests/abstracts/MultipartFile;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static final fun setStickerSetThumbnail-It0iktY (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLjava/lang/String;Ldev/inmo/tgbotapi/requests/abstracts/FileId;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static final fun setStickerSetThumbnail-It0iktY (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLjava/lang/String;Ldev/inmo/tgbotapi/requests/abstracts/MultipartFile;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public final class dev/inmo/tgbotapi/extensions/api/thumbs/SetStickerSetThumbnailKt {
|
||||
public static final fun setStickerSetThumbnail (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/CommonUser;Ldev/inmo/tgbotapi/types/stickers/StickerSet;Ldev/inmo/tgbotapi/types/StickerFormat;Ldev/inmo/tgbotapi/requests/abstracts/FileId;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static final fun setStickerSetThumbnail (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/CommonUser;Ldev/inmo/tgbotapi/types/stickers/StickerSet;Ldev/inmo/tgbotapi/types/StickerFormat;Ldev/inmo/tgbotapi/requests/abstracts/MultipartFile;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static final fun setStickerSetThumbnail-0VZ_ni8 (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/CommonUser;Ljava/lang/String;Ldev/inmo/tgbotapi/types/StickerFormat;Ldev/inmo/tgbotapi/requests/abstracts/FileId;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static final fun setStickerSetThumbnail-0VZ_ni8 (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/CommonUser;Ljava/lang/String;Ldev/inmo/tgbotapi/types/StickerFormat;Ldev/inmo/tgbotapi/requests/abstracts/MultipartFile;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static final fun setStickerSetThumbnail-ftAj2Hw (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLjava/lang/String;Ldev/inmo/tgbotapi/types/StickerFormat;Ldev/inmo/tgbotapi/requests/abstracts/FileId;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static final fun setStickerSetThumbnail-ftAj2Hw (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLjava/lang/String;Ldev/inmo/tgbotapi/types/StickerFormat;Ldev/inmo/tgbotapi/requests/abstracts/MultipartFile;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static final fun setStickerSetThumbnail-ySMgKnk (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLdev/inmo/tgbotapi/types/stickers/StickerSet;Ldev/inmo/tgbotapi/types/StickerFormat;Ldev/inmo/tgbotapi/requests/abstracts/FileId;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static final fun setStickerSetThumbnail-ySMgKnk (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLdev/inmo/tgbotapi/types/stickers/StickerSet;Ldev/inmo/tgbotapi/types/StickerFormat;Ldev/inmo/tgbotapi/requests/abstracts/MultipartFile;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
}
|
||||
|
||||
public final class dev/inmo/tgbotapi/extensions/api/utils/UpdatesHandlingKt {
|
||||
|
||||
@@ -7,7 +7,7 @@ import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
|
||||
|
||||
suspend fun TelegramBot.getBusinessConnection(
|
||||
id: BusinessConnectionId
|
||||
) = execute(GetBusinessConnection(id = id))
|
||||
) = execute(GetBusinessConnection(businessConnectionId = id))
|
||||
|
||||
@Warning("This method may lead to error due to raw String type usage")
|
||||
suspend fun TelegramBot.getBusinessConnection(
|
||||
|
||||
@@ -4,6 +4,7 @@ import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.abstracts.InputFile
|
||||
import dev.inmo.tgbotapi.requests.stickers.AddStickerToSet
|
||||
import dev.inmo.tgbotapi.requests.stickers.InputSticker
|
||||
import dev.inmo.tgbotapi.types.StickerFormat
|
||||
import dev.inmo.tgbotapi.types.StickerSetName
|
||||
import dev.inmo.tgbotapi.types.StickerType
|
||||
import dev.inmo.tgbotapi.types.chat.CommonUser
|
||||
@@ -39,6 +40,7 @@ suspend fun TelegramBot.addStickerToSet(
|
||||
userId: UserId,
|
||||
stickerSet: StickerSet,
|
||||
sticker: InputFile,
|
||||
format: StickerFormat,
|
||||
emojis: List<String>,
|
||||
keywords: List<String> = emptyList()
|
||||
) = addStickerToSet(
|
||||
@@ -47,15 +49,18 @@ suspend fun TelegramBot.addStickerToSet(
|
||||
when (stickerSet.stickerType) {
|
||||
StickerType.CustomEmoji -> InputSticker.WithKeywords.CustomEmoji(
|
||||
sticker,
|
||||
format,
|
||||
emojis,
|
||||
keywords
|
||||
)
|
||||
StickerType.Mask -> InputSticker.Mask(
|
||||
sticker,
|
||||
format,
|
||||
emojis
|
||||
)
|
||||
StickerType.Regular -> InputSticker.WithKeywords.Regular(
|
||||
sticker,
|
||||
format,
|
||||
emojis,
|
||||
keywords
|
||||
)
|
||||
@@ -67,6 +72,7 @@ suspend fun TelegramBot.addStickerToSet(
|
||||
userId: UserId,
|
||||
stickerSet: StickerSet,
|
||||
sticker: InputFile,
|
||||
format: StickerFormat,
|
||||
emojis: List<String>,
|
||||
maskPosition: MaskPosition? = null
|
||||
) = addStickerToSet(
|
||||
@@ -75,16 +81,19 @@ suspend fun TelegramBot.addStickerToSet(
|
||||
when (stickerSet.stickerType) {
|
||||
StickerType.CustomEmoji -> InputSticker.WithKeywords.CustomEmoji(
|
||||
sticker,
|
||||
format,
|
||||
emojis,
|
||||
emptyList()
|
||||
)
|
||||
StickerType.Mask -> InputSticker.Mask(
|
||||
sticker,
|
||||
format,
|
||||
emojis,
|
||||
maskPosition
|
||||
)
|
||||
StickerType.Regular -> InputSticker.WithKeywords.Regular(
|
||||
sticker,
|
||||
format,
|
||||
emojis,
|
||||
emptyList()
|
||||
)
|
||||
@@ -106,18 +115,20 @@ suspend fun TelegramBot.addStickerToSet(
|
||||
user: CommonUser,
|
||||
stickerSet: StickerSet,
|
||||
sticker: InputFile,
|
||||
format: StickerFormat,
|
||||
emojis: List<String>,
|
||||
keywords: List<String> = emptyList()
|
||||
) = addStickerToSet(
|
||||
user.id, stickerSet, sticker, emojis, keywords
|
||||
user.id, stickerSet, sticker, format, emojis, keywords
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.addStickerToSet(
|
||||
user: CommonUser,
|
||||
stickerSet: StickerSet,
|
||||
sticker: InputFile,
|
||||
format: StickerFormat,
|
||||
emojis: List<String>,
|
||||
maskPosition: MaskPosition? = null
|
||||
) = addStickerToSet(
|
||||
user.id, stickerSet, sticker, emojis, maskPosition
|
||||
user.id, stickerSet, sticker, format, emojis, maskPosition
|
||||
)
|
||||
|
||||
@@ -11,11 +11,10 @@ suspend fun TelegramBot.createNewStickerSet(
|
||||
userId: UserId,
|
||||
name: String,
|
||||
title: String,
|
||||
stickersFormat: StickerFormat,
|
||||
stickers: List<InputSticker>,
|
||||
needsRepainting: Boolean = false
|
||||
) = execute(
|
||||
CreateNewStickerSet(userId, name, title, stickersFormat, stickers, needsRepainting)
|
||||
CreateNewStickerSet(userId, name, title, stickers, needsRepainting)
|
||||
)
|
||||
|
||||
|
||||
@@ -23,9 +22,8 @@ suspend fun TelegramBot.createNewStickerSet(
|
||||
user: CommonUser,
|
||||
name: String,
|
||||
title: String,
|
||||
stickersFormat: StickerFormat,
|
||||
stickers: List<InputSticker>,
|
||||
needsRepainting: Boolean = false,
|
||||
) = createNewStickerSet(
|
||||
user.id, name, title, stickersFormat, stickers, needsRepainting
|
||||
user.id, name, title, stickers, needsRepainting
|
||||
)
|
||||
|
||||
@@ -0,0 +1,148 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.stickers
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||
import dev.inmo.tgbotapi.requests.abstracts.InputFile
|
||||
import dev.inmo.tgbotapi.requests.stickers.AddStickerToSet
|
||||
import dev.inmo.tgbotapi.requests.stickers.InputSticker
|
||||
import dev.inmo.tgbotapi.requests.stickers.ReplaceStickerInSet
|
||||
import dev.inmo.tgbotapi.types.StickerFormat
|
||||
import dev.inmo.tgbotapi.types.StickerSetName
|
||||
import dev.inmo.tgbotapi.types.StickerType
|
||||
import dev.inmo.tgbotapi.types.chat.CommonUser
|
||||
import dev.inmo.tgbotapi.types.UserId
|
||||
import dev.inmo.tgbotapi.types.stickers.MaskPosition
|
||||
import dev.inmo.tgbotapi.types.stickers.StickerSet
|
||||
|
||||
suspend fun TelegramBot.replaceStickerInSet(
|
||||
userId: UserId,
|
||||
stickerSetName: StickerSetName,
|
||||
oldSticker: FileId,
|
||||
newSticker: InputSticker
|
||||
) = execute(
|
||||
ReplaceStickerInSet(userId, stickerSetName, oldSticker, newSticker)
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.replaceStickerInSet(
|
||||
userId: UserId,
|
||||
stickerSetName: String,
|
||||
oldSticker: FileId,
|
||||
newSticker: InputSticker
|
||||
) = replaceStickerInSet(userId, StickerSetName(stickerSetName), oldSticker, newSticker)
|
||||
|
||||
suspend fun TelegramBot.replaceStickerInSet(
|
||||
userId: UserId,
|
||||
stickerSet: StickerSet,
|
||||
oldSticker: FileId,
|
||||
newSticker: InputSticker
|
||||
) = replaceStickerInSet(
|
||||
userId,
|
||||
stickerSet.name,
|
||||
oldSticker,
|
||||
newSticker
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.replaceStickerInSet(
|
||||
userId: UserId,
|
||||
stickerSet: StickerSet,
|
||||
oldSticker: FileId,
|
||||
sticker: InputFile,
|
||||
format: StickerFormat,
|
||||
emojis: List<String>,
|
||||
keywords: List<String> = emptyList()
|
||||
) = replaceStickerInSet(
|
||||
userId,
|
||||
stickerSet,
|
||||
oldSticker,
|
||||
when (stickerSet.stickerType) {
|
||||
StickerType.CustomEmoji -> InputSticker.WithKeywords.CustomEmoji(
|
||||
sticker,
|
||||
format,
|
||||
emojis,
|
||||
keywords
|
||||
)
|
||||
StickerType.Mask -> InputSticker.Mask(
|
||||
sticker,
|
||||
format,
|
||||
emojis
|
||||
)
|
||||
StickerType.Regular -> InputSticker.WithKeywords.Regular(
|
||||
sticker,
|
||||
format,
|
||||
emojis,
|
||||
keywords
|
||||
)
|
||||
is StickerType.Unknown -> error("Unable to create sticker to the set with type ${stickerSet.stickerType}")
|
||||
}
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.replaceStickerInSet(
|
||||
userId: UserId,
|
||||
stickerSet: StickerSet,
|
||||
oldSticker: FileId,
|
||||
sticker: InputFile,
|
||||
format: StickerFormat,
|
||||
emojis: List<String>,
|
||||
maskPosition: MaskPosition? = null
|
||||
) = replaceStickerInSet(
|
||||
userId,
|
||||
stickerSet.name,
|
||||
oldSticker,
|
||||
when (stickerSet.stickerType) {
|
||||
StickerType.CustomEmoji -> InputSticker.WithKeywords.CustomEmoji(
|
||||
sticker,
|
||||
format,
|
||||
emojis,
|
||||
emptyList()
|
||||
)
|
||||
StickerType.Mask -> InputSticker.Mask(
|
||||
sticker,
|
||||
format,
|
||||
emojis,
|
||||
maskPosition
|
||||
)
|
||||
StickerType.Regular -> InputSticker.WithKeywords.Regular(
|
||||
sticker,
|
||||
format,
|
||||
emojis,
|
||||
emptyList()
|
||||
)
|
||||
is StickerType.Unknown -> error("Unable to create sticker to the set with type ${stickerSet.stickerType}")
|
||||
}
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.replaceStickerInSet(
|
||||
user: CommonUser,
|
||||
stickerSet: StickerSet,
|
||||
oldSticker: FileId,
|
||||
newSticker: InputSticker
|
||||
) = replaceStickerInSet(
|
||||
user.id,
|
||||
stickerSet.name,
|
||||
oldSticker,
|
||||
newSticker
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.replaceStickerInSet(
|
||||
user: CommonUser,
|
||||
stickerSet: StickerSet,
|
||||
oldSticker: FileId,
|
||||
sticker: InputFile,
|
||||
format: StickerFormat,
|
||||
emojis: List<String>,
|
||||
keywords: List<String> = emptyList()
|
||||
) = replaceStickerInSet(
|
||||
user.id, stickerSet, oldSticker, sticker, format, emojis, keywords
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.replaceStickerInSet(
|
||||
user: CommonUser,
|
||||
stickerSet: StickerSet,
|
||||
oldSticker: FileId,
|
||||
sticker: InputFile,
|
||||
format: StickerFormat,
|
||||
emojis: List<String>,
|
||||
maskPosition: MaskPosition? = null
|
||||
) = replaceStickerInSet(
|
||||
user.id, stickerSet, oldSticker, sticker, format, emojis, maskPosition
|
||||
)
|
||||
@@ -4,6 +4,7 @@ import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||
import dev.inmo.tgbotapi.requests.abstracts.MultipartFile
|
||||
import dev.inmo.tgbotapi.requests.stickers.SetStickerSetThumbnail
|
||||
import dev.inmo.tgbotapi.types.StickerFormat
|
||||
import dev.inmo.tgbotapi.types.StickerSetName
|
||||
import dev.inmo.tgbotapi.types.chat.CommonUser
|
||||
import dev.inmo.tgbotapi.types.UserId
|
||||
@@ -12,63 +13,71 @@ import dev.inmo.tgbotapi.types.stickers.StickerSet
|
||||
suspend fun TelegramBot.setStickerSetThumbnail(
|
||||
userId: UserId,
|
||||
stickerSetName: StickerSetName,
|
||||
format: StickerFormat,
|
||||
thumbnail: FileId
|
||||
) = execute(
|
||||
SetStickerSetThumbnail(userId, stickerSetName, thumbnail)
|
||||
SetStickerSetThumbnail(userId, stickerSetName, format, thumbnail)
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.setStickerSetThumbnail(
|
||||
userId: UserId,
|
||||
stickerSetName: StickerSetName,
|
||||
format: StickerFormat,
|
||||
thumbnail: MultipartFile
|
||||
) = execute(
|
||||
SetStickerSetThumbnail(userId, stickerSetName, thumbnail)
|
||||
SetStickerSetThumbnail(userId, stickerSetName, format, thumbnail)
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.setStickerSetThumbnail(
|
||||
user: CommonUser,
|
||||
stickerSetName: StickerSetName,
|
||||
format: StickerFormat,
|
||||
thumbnail: FileId
|
||||
) = setStickerSetThumbnail(
|
||||
user.id, stickerSetName, thumbnail
|
||||
user.id, stickerSetName, format, thumbnail
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.setStickerSetThumbnail(
|
||||
user: CommonUser,
|
||||
stickerSetName: StickerSetName,
|
||||
format: StickerFormat,
|
||||
thumbnail: MultipartFile
|
||||
) = setStickerSetThumbnail(
|
||||
user.id, stickerSetName, thumbnail
|
||||
user.id, stickerSetName, format, thumbnail
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.setStickerSetThumbnail(
|
||||
userId: UserId,
|
||||
stickerSet: StickerSet,
|
||||
format: StickerFormat,
|
||||
thumbnail: FileId
|
||||
) = setStickerSetThumbnail(
|
||||
userId, stickerSet.name, thumbnail
|
||||
userId, stickerSet.name, format, thumbnail
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.setStickerSetThumbnail(
|
||||
userId: UserId,
|
||||
stickerSet: StickerSet,
|
||||
format: StickerFormat,
|
||||
thumbnail: MultipartFile
|
||||
) = setStickerSetThumbnail(
|
||||
userId, stickerSet.name, thumbnail
|
||||
userId, stickerSet.name, format, thumbnail
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.setStickerSetThumbnail(
|
||||
user: CommonUser,
|
||||
stickerSet: StickerSet,
|
||||
format: StickerFormat,
|
||||
thumbnail: FileId
|
||||
) = setStickerSetThumbnail(
|
||||
user.id, stickerSet, thumbnail
|
||||
user.id, stickerSet, format, thumbnail
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.setStickerSetThumbnail(
|
||||
user: CommonUser,
|
||||
stickerSet: StickerSet,
|
||||
format: StickerFormat,
|
||||
thumbnail: MultipartFile
|
||||
) = setStickerSetThumbnail(
|
||||
user.id, stickerSet, thumbnail
|
||||
user.id, stickerSet, format, thumbnail
|
||||
)
|
||||
File diff suppressed because it is too large
Load Diff
@@ -102,7 +102,7 @@ class DefaultKtorRequestsExecutor internal constructor(
|
||||
is BotException -> e
|
||||
else -> CommonBotException(cause = e)
|
||||
}.also { newException ->
|
||||
logger.v(newException) { "Result exception on handling of $request is an exception" }
|
||||
logger.v(newException) { "Result exception on handling of $request is an exception: ${newException.stackTraceToString()}" }
|
||||
if (newException is GetUpdatesConflict) {
|
||||
logger.w(newException) {
|
||||
"Warning!!! Other bot with the same bot token requests updates with getUpdate in parallel"
|
||||
|
||||
@@ -19,7 +19,7 @@ data class GetChat(
|
||||
@Transient
|
||||
override val resultDeserializer: DeserializationStrategy<ExtendedChat> = when {
|
||||
chatId is ChatIdWithThreadId -> ExtendedChatSerializer.BasedOnForumThread(chatId.threadId)
|
||||
chatId is BusinessChatId -> ExtendedChatSerializer.BasedOnBusinessConnection(chatId.businessId)
|
||||
chatId is BusinessChatId -> ExtendedChatSerializer.BasedOnBusinessConnection(chatId.businessConnectionId)
|
||||
else -> ExtendedChatSerializer.Companion
|
||||
}
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package dev.inmo.tgbotapi.requests.get
|
||||
|
||||
import dev.inmo.tgbotapi.abstracts.types.WithBusinessConnectionId
|
||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||
import dev.inmo.tgbotapi.types.businessConnectionIdField
|
||||
import dev.inmo.tgbotapi.types.business_connection.BusinessConnection
|
||||
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
|
||||
import dev.inmo.tgbotapi.types.files.PathedFile
|
||||
import dev.inmo.tgbotapi.types.idField
|
||||
import kotlinx.serialization.DeserializationStrategy
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
@@ -12,15 +12,15 @@ import kotlinx.serialization.SerializationStrategy
|
||||
|
||||
@Serializable
|
||||
data class GetBusinessConnection(
|
||||
@SerialName(idField)
|
||||
val id: BusinessConnectionId
|
||||
) : SimpleRequest<BusinessConnection> {
|
||||
@SerialName(businessConnectionIdField)
|
||||
override val businessConnectionId: BusinessConnectionId
|
||||
) : SimpleRequest<BusinessConnection>, WithBusinessConnectionId {
|
||||
override fun method(): String {
|
||||
return "getBusinessConnection"
|
||||
}
|
||||
|
||||
override val resultDeserializer: DeserializationStrategy<BusinessConnection>
|
||||
get() = BusinessConnection.serializer()
|
||||
get() = BusinessConnection.Companion
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
||||
@@ -38,7 +38,7 @@ data class AddStickerToSetData internal constructor(
|
||||
@SerialName(nameField)
|
||||
override val name: StickerSetName,
|
||||
@SerialName(stickerField)
|
||||
override val inputSticker: InputSticker
|
||||
override val newSticker: InputSticker
|
||||
) : StandardStickerSetAction {
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
|
||||
@@ -21,14 +21,13 @@ fun CreateNewStickerSet(
|
||||
userId: UserId,
|
||||
name: StickerSetName,
|
||||
title: String,
|
||||
stickersFormat: StickerFormat,
|
||||
stickers: List<InputSticker>,
|
||||
needsRepainting: Boolean? = null
|
||||
): Request<Boolean> {
|
||||
val data = when(stickers.first()) {
|
||||
is InputSticker.Mask -> CreateNewStickerSet.Mask(userId, name, title, stickersFormat, stickers.filterIsInstance<InputSticker.Mask>())
|
||||
is InputSticker.WithKeywords.CustomEmoji -> CreateNewStickerSet.CustomEmoji(userId, name, title, stickersFormat, stickers.filterIsInstance<InputSticker.WithKeywords.CustomEmoji>(), needsRepainting)
|
||||
is InputSticker.WithKeywords.Regular -> CreateNewStickerSet.Regular(userId, name, title, stickersFormat, stickers.filterIsInstance<InputSticker.WithKeywords.Regular>())
|
||||
is InputSticker.Mask -> CreateNewStickerSet.Mask(userId, name, title, stickers.filterIsInstance<InputSticker.Mask>())
|
||||
is InputSticker.WithKeywords.CustomEmoji -> CreateNewStickerSet.CustomEmoji(userId, name, title, stickers.filterIsInstance<InputSticker.WithKeywords.CustomEmoji>(), needsRepainting)
|
||||
is InputSticker.WithKeywords.Regular -> CreateNewStickerSet.Regular(userId, name, title, stickers.filterIsInstance<InputSticker.WithKeywords.Regular>())
|
||||
}
|
||||
val multipartParts = stickers.mapNotNull {
|
||||
(it.sticker as? MultipartFile)
|
||||
@@ -63,14 +62,12 @@ fun CreateNewStickerSet(
|
||||
userId: UserId,
|
||||
name: String,
|
||||
title: String,
|
||||
stickersFormat: StickerFormat,
|
||||
stickers: List<InputSticker>,
|
||||
needsRepainting: Boolean? = null
|
||||
) = CreateNewStickerSet(
|
||||
userId = userId,
|
||||
name = StickerSetName(name),
|
||||
title = title,
|
||||
stickersFormat = stickersFormat,
|
||||
stickers = stickers,
|
||||
needsRepainting = needsRepainting
|
||||
)
|
||||
@@ -79,7 +76,6 @@ fun CreateNewStickerSet(
|
||||
sealed interface CreateNewStickerSet : CreateStickerSetAction {
|
||||
val stickerType: StickerType
|
||||
val stickers: List<InputSticker>
|
||||
val stickersFormat: StickerFormat
|
||||
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
@@ -94,8 +90,6 @@ sealed interface CreateNewStickerSet : CreateStickerSetAction {
|
||||
override val name: StickerSetName,
|
||||
@SerialName(titleField)
|
||||
override val title: String,
|
||||
@SerialName(stickerFormatField)
|
||||
override val stickersFormat: StickerFormat,
|
||||
@SerialName(stickersField)
|
||||
override val stickers: List<InputSticker.WithKeywords.Regular>
|
||||
) : CreateNewStickerSet {
|
||||
@@ -111,8 +105,6 @@ sealed interface CreateNewStickerSet : CreateStickerSetAction {
|
||||
override val name: StickerSetName,
|
||||
@SerialName(titleField)
|
||||
override val title: String,
|
||||
@SerialName(stickerFormatField)
|
||||
override val stickersFormat: StickerFormat,
|
||||
@SerialName(stickersField)
|
||||
override val stickers: List<InputSticker.Mask>
|
||||
) : CreateNewStickerSet {
|
||||
@@ -128,8 +120,6 @@ sealed interface CreateNewStickerSet : CreateStickerSetAction {
|
||||
override val name: StickerSetName,
|
||||
@SerialName(titleField)
|
||||
override val title: String,
|
||||
@SerialName(stickerFormatField)
|
||||
override val stickersFormat: StickerFormat,
|
||||
@SerialName(stickersField)
|
||||
override val stickers: List<InputSticker.WithKeywords.CustomEmoji>,
|
||||
@SerialName(needsRepaintingField)
|
||||
@@ -148,8 +138,6 @@ sealed interface CreateNewStickerSet : CreateStickerSetAction {
|
||||
override val name: StickerSetName,
|
||||
@SerialName(titleField)
|
||||
override val title: String,
|
||||
@SerialName(stickerFormatField)
|
||||
val stickersFormat: StickerFormat,
|
||||
@SerialName(stickersField)
|
||||
val stickers: List<InputSticker>,
|
||||
@SerialName(stickerTypeField)
|
||||
@@ -172,7 +160,6 @@ object CreateNewStickerSetSerializer : KSerializer<CreateNewStickerSet>,
|
||||
it.userId,
|
||||
it.name,
|
||||
it.title,
|
||||
it.stickersFormat,
|
||||
it.stickers,
|
||||
it.stickerType,
|
||||
(it as? CreateNewStickerSet.CustomEmoji)?.needsRepainting
|
||||
@@ -184,7 +171,6 @@ object CreateNewStickerSetSerializer : KSerializer<CreateNewStickerSet>,
|
||||
it.userId,
|
||||
it.name,
|
||||
it.title,
|
||||
it.stickersFormat,
|
||||
it.stickers.filterIsInstance<InputSticker.WithKeywords.CustomEmoji>(),
|
||||
it.needsRepainting
|
||||
)
|
||||
@@ -192,14 +178,12 @@ object CreateNewStickerSetSerializer : KSerializer<CreateNewStickerSet>,
|
||||
it.userId,
|
||||
it.name,
|
||||
it.title,
|
||||
it.stickersFormat,
|
||||
it.stickers.filterIsInstance<InputSticker.Mask>(),
|
||||
)
|
||||
StickerType.Regular -> CreateNewStickerSet.Regular(
|
||||
it.userId,
|
||||
it.name,
|
||||
it.title,
|
||||
it.stickersFormat,
|
||||
it.stickers.filterIsInstance<InputSticker.WithKeywords.Regular>(),
|
||||
)
|
||||
is StickerType.Unknown -> error("Unable to create new sticker set due to error in type format: ${it.stickerType}")
|
||||
|
||||
@@ -2,11 +2,7 @@ package dev.inmo.tgbotapi.requests.stickers
|
||||
|
||||
import dev.inmo.micro_utils.serialization.mapper.MapperSerializer
|
||||
import dev.inmo.tgbotapi.requests.abstracts.InputFile
|
||||
import dev.inmo.tgbotapi.types.StickerType
|
||||
import dev.inmo.tgbotapi.types.emojiListField
|
||||
import dev.inmo.tgbotapi.types.keywordsField
|
||||
import dev.inmo.tgbotapi.types.maskPositionField
|
||||
import dev.inmo.tgbotapi.types.stickerField
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.stickers.MaskPosition
|
||||
import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded
|
||||
import kotlinx.serialization.KSerializer
|
||||
@@ -17,12 +13,15 @@ import kotlinx.serialization.Serializable
|
||||
@Serializable(InputStickerSerializer::class)
|
||||
sealed interface InputSticker {
|
||||
val sticker: InputFile
|
||||
val format: StickerFormat
|
||||
val emojisList: List<String>
|
||||
|
||||
@Serializable
|
||||
data class Mask(
|
||||
@SerialName(stickerField)
|
||||
override val sticker: InputFile,
|
||||
@SerialName(formatField)
|
||||
override val format: StickerFormat,
|
||||
@SerialName(emojiListField)
|
||||
override val emojisList: List<String>,
|
||||
@SerialName(maskPositionField)
|
||||
@@ -37,6 +36,8 @@ sealed interface InputSticker {
|
||||
data class Regular(
|
||||
@SerialName(stickerField)
|
||||
override val sticker: InputFile,
|
||||
@SerialName(formatField)
|
||||
override val format: StickerFormat,
|
||||
@SerialName(emojiListField)
|
||||
override val emojisList: List<String>,
|
||||
@SerialName(keywordsField)
|
||||
@@ -47,6 +48,8 @@ sealed interface InputSticker {
|
||||
data class CustomEmoji(
|
||||
@SerialName(stickerField)
|
||||
override val sticker: InputFile,
|
||||
@SerialName(formatField)
|
||||
override val format: StickerFormat,
|
||||
@SerialName(emojiListField)
|
||||
override val emojisList: List<String>,
|
||||
@SerialName(keywordsField)
|
||||
@@ -61,6 +64,7 @@ object InputStickerSerializer : KSerializer<InputSticker>, MapperSerializer<Inpu
|
||||
when (it) {
|
||||
is InputSticker.Mask -> SurrogateInputSticker(
|
||||
it.sticker,
|
||||
it.format,
|
||||
it.emojisList,
|
||||
emptyList(),
|
||||
it.maskPosition,
|
||||
@@ -68,6 +72,7 @@ object InputStickerSerializer : KSerializer<InputSticker>, MapperSerializer<Inpu
|
||||
)
|
||||
is InputSticker.WithKeywords.CustomEmoji -> SurrogateInputSticker(
|
||||
it.sticker,
|
||||
it.format,
|
||||
it.emojisList,
|
||||
it.keywords,
|
||||
null,
|
||||
@@ -75,6 +80,7 @@ object InputStickerSerializer : KSerializer<InputSticker>, MapperSerializer<Inpu
|
||||
)
|
||||
is InputSticker.WithKeywords.Regular -> SurrogateInputSticker(
|
||||
it.sticker,
|
||||
it.format,
|
||||
it.emojisList,
|
||||
it.keywords,
|
||||
null,
|
||||
@@ -86,21 +92,25 @@ object InputStickerSerializer : KSerializer<InputSticker>, MapperSerializer<Inpu
|
||||
when (it.internalType) {
|
||||
StickerType.CustomEmoji -> InputSticker.WithKeywords.CustomEmoji(
|
||||
it.sticker,
|
||||
it.format,
|
||||
it.emojisList,
|
||||
it.keywords
|
||||
)
|
||||
StickerType.Mask -> InputSticker.Mask(
|
||||
it.sticker,
|
||||
it.format,
|
||||
it.emojisList,
|
||||
it.maskPosition
|
||||
)
|
||||
StickerType.Regular -> InputSticker.WithKeywords.Regular(
|
||||
it.sticker,
|
||||
it.format,
|
||||
it.emojisList,
|
||||
it.keywords
|
||||
)
|
||||
is StickerType.Unknown -> InputSticker.WithKeywords.Regular(
|
||||
it.sticker,
|
||||
it.format,
|
||||
it.emojisList,
|
||||
it.keywords
|
||||
)
|
||||
@@ -111,6 +121,8 @@ object InputStickerSerializer : KSerializer<InputSticker>, MapperSerializer<Inpu
|
||||
data class SurrogateInputSticker internal constructor(
|
||||
@SerialName(stickerField)
|
||||
val sticker: InputFile,
|
||||
@SerialName(formatField)
|
||||
val format: StickerFormat,
|
||||
@SerialName(emojiListField)
|
||||
val emojisList: List<String>,
|
||||
@SerialName(keywordsField)
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
package dev.inmo.tgbotapi.requests.stickers
|
||||
|
||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||
import dev.inmo.tgbotapi.requests.abstracts.MultipartFile
|
||||
import dev.inmo.tgbotapi.requests.abstracts.Request
|
||||
import dev.inmo.tgbotapi.requests.common.CommonMultipartFileRequest
|
||||
import dev.inmo.tgbotapi.requests.stickers.abstracts.StandardStickerSetAction
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.files.File
|
||||
import kotlinx.serialization.*
|
||||
|
||||
fun ReplaceStickerInSet(
|
||||
userId: UserId,
|
||||
stickerSetName: StickerSetName,
|
||||
oldSticker: FileId,
|
||||
newSticker: InputSticker
|
||||
): Request<Boolean> {
|
||||
val data = ReplaceStickerInSetData(
|
||||
userId = userId,
|
||||
name = stickerSetName,
|
||||
oldSticker = oldSticker,
|
||||
newSticker = newSticker
|
||||
)
|
||||
return when (val sticker = newSticker.sticker) {
|
||||
is MultipartFile -> CommonMultipartFileRequest(
|
||||
data,
|
||||
mapOf(sticker.fileId to sticker)
|
||||
)
|
||||
is FileId -> data
|
||||
}
|
||||
}
|
||||
|
||||
fun ReplaceStickerInSet(
|
||||
userId: UserId,
|
||||
stickerSetName: String,
|
||||
oldSticker: FileId,
|
||||
newSticker: InputSticker
|
||||
): Request<Boolean> = ReplaceStickerInSetData(
|
||||
userId = userId,
|
||||
name = StickerSetName(stickerSetName),
|
||||
oldSticker = oldSticker,
|
||||
newSticker = newSticker
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class ReplaceStickerInSetData internal constructor(
|
||||
@SerialName(userIdField)
|
||||
override val userId: UserId,
|
||||
@SerialName(nameField)
|
||||
override val name: StickerSetName,
|
||||
@SerialName(oldStickerField)
|
||||
val oldSticker: FileId,
|
||||
@SerialName(stickerField)
|
||||
override val newSticker: InputSticker
|
||||
) : StandardStickerSetAction {
|
||||
override fun method(): String = "replaceStickerInSet"
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
||||
@@ -9,10 +9,11 @@ import kotlinx.serialization.*
|
||||
fun SetStickerSetThumbnail(
|
||||
userId: UserId,
|
||||
stickerSetName: StickerSetName,
|
||||
format: StickerFormat,
|
||||
thumbnail: MultipartFile
|
||||
): Request<Boolean> {
|
||||
return CommonMultipartFileRequest(
|
||||
SetStickerSetThumbnail(userId, stickerSetName),
|
||||
SetStickerSetThumbnail(userId, stickerSetName, format),
|
||||
mapOf(thumbnailField to thumbnail)
|
||||
)
|
||||
}
|
||||
@@ -20,10 +21,12 @@ fun SetStickerSetThumbnail(
|
||||
fun SetStickerSetThumbnail(
|
||||
userId: UserId,
|
||||
stickerSetName: String,
|
||||
format: StickerFormat,
|
||||
thumbnail: MultipartFile
|
||||
): Request<Boolean> = SetStickerSetThumbnail(
|
||||
userId = userId,
|
||||
stickerSetName = StickerSetName(stickerSetName),
|
||||
stickerSetName = StickerSetName(stickerSetName, ),
|
||||
format = format,
|
||||
thumbnail = thumbnail
|
||||
)
|
||||
|
||||
@@ -33,6 +36,8 @@ data class SetStickerSetThumbnail (
|
||||
override val userId: UserId,
|
||||
@SerialName(nameField)
|
||||
override val name: StickerSetName,
|
||||
@SerialName(formatField)
|
||||
val format: StickerFormat,
|
||||
@SerialName(thumbnailField)
|
||||
val thumbnail: FileId? = null
|
||||
) : OwnerStickerSetAction {
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
package dev.inmo.tgbotapi.requests.stickers.abstracts
|
||||
|
||||
import dev.inmo.tgbotapi.requests.stickers.InputSticker
|
||||
import dev.inmo.tgbotapi.types.stickers.MaskPosition
|
||||
|
||||
interface StandardStickerSetAction : OwnerStickerSetAction {
|
||||
val inputSticker: InputSticker
|
||||
val newSticker: InputSticker
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package dev.inmo.tgbotapi.types
|
||||
|
||||
import korlibs.time.Date
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class Birthdate(
|
||||
@SerialName(dayField)
|
||||
val day: Int,
|
||||
@SerialName(monthField)
|
||||
val month: Int,
|
||||
@SerialName(yearField)
|
||||
val year: Int
|
||||
) {
|
||||
val date: Date by lazy {
|
||||
Date(year, month, day)
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,7 @@ sealed interface IdChatIdentifier : ChatIdentifier {
|
||||
abstract val chatId: RawChatId
|
||||
val threadId: MessageThreadId?
|
||||
get() = null
|
||||
val businessId: BusinessConnectionId?
|
||||
val businessConnectionId: BusinessConnectionId?
|
||||
get() = null
|
||||
|
||||
companion object {
|
||||
@@ -63,7 +63,7 @@ value class ChatIdWithThreadId(val chatIdWithThreadId: Pair<RawChatId, MessageTh
|
||||
value class BusinessChatId(val chatIdWithBusinessConnectionId: Pair<RawChatId, BusinessConnectionId>) : IdChatIdentifier {
|
||||
override val chatId: RawChatId
|
||||
get() = chatIdWithBusinessConnectionId.first
|
||||
override val businessId: BusinessConnectionId
|
||||
override val businessConnectionId: BusinessConnectionId
|
||||
get() = chatIdWithBusinessConnectionId.second
|
||||
|
||||
constructor(chatId: RawChatId, businessConnectionId: BusinessConnectionId): this(chatId to businessConnectionId)
|
||||
@@ -196,7 +196,7 @@ object FullChatIdentifierSerializer : KSerializer<ChatIdentifier> {
|
||||
when (value) {
|
||||
is ChatId -> encoder.encodeLong(value.chatId.long)
|
||||
is ChatIdWithThreadId -> encoder.encodeString("${value.chatId}/${value.threadId}")
|
||||
is BusinessChatId -> encoder.encodeString("${value.chatId}//${value.businessId}")
|
||||
is BusinessChatId -> encoder.encodeString("${value.chatId}//${value.businessConnectionId}")
|
||||
is Username -> encoder.encodeString(value.full)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,6 +151,7 @@ const val profileAccentColorIdField = "profile_accent_color_id"
|
||||
const val backgroundCustomEmojiIdField = "background_custom_emoji_id"
|
||||
const val profileBackgroundCustomEmojiIdField = "profile_background_custom_emoji_id"
|
||||
const val personalChatField = "personal_chat"
|
||||
const val birthdateField = "birthdate"
|
||||
const val hasVisibleHistoryField = "has_visible_history"
|
||||
const val unrestrictBoostsCountField = "unrestrict_boost_count"
|
||||
const val customEmojiStickerSetNameField = "custom_emoji_sticker_set_name"
|
||||
@@ -263,6 +264,10 @@ const val requestUserField = "request_user"
|
||||
const val requestUsersField = "request_users"
|
||||
const val requestChatField = "request_chat"
|
||||
const val requestIdField = "request_id"
|
||||
const val requestTitleField = "request_title"
|
||||
const val requestUsernameField = "request_username"
|
||||
const val requestPhotoField = "request_photo"
|
||||
const val requestNameField = "request_name"
|
||||
const val maxQuantityField = "max_quantity"
|
||||
|
||||
const val userIsBotField = "user_is_bot"
|
||||
@@ -374,6 +379,7 @@ const val oldChatMemberField = "old_chat_member"
|
||||
const val newChatMemberField = "new_chat_member"
|
||||
const val stickerTypeField = "sticker_type"
|
||||
const val stickerFormatField = "sticker_format"
|
||||
const val formatField = "format"
|
||||
const val needsRepaintingField = "needs_repainting"
|
||||
|
||||
const val okField = "ok"
|
||||
@@ -419,6 +425,7 @@ const val offsetField = "offset"
|
||||
const val limitField = "limit"
|
||||
const val stickersField = "stickers"
|
||||
const val stickerField = "sticker"
|
||||
const val oldStickerField = "old_sticker"
|
||||
const val keywordsField = "keywords"
|
||||
const val urlField = "url"
|
||||
const val addressField = "address"
|
||||
@@ -592,3 +599,7 @@ const val businessConnectionIdField = "business_connection_id"
|
||||
const val businessIntroField = "business_intro"
|
||||
const val businessLocationField = "business_location"
|
||||
const val businessOpeningHoursField = "business_opening_hours"
|
||||
|
||||
const val dayField = "day"
|
||||
const val monthField = "month"
|
||||
const val yearField = "year"
|
||||
|
||||
@@ -19,6 +19,9 @@ const val UPDATE_MESSAGE_REACTION_COUNT = "message_reaction_count"
|
||||
const val UPDATE_CHAT_BOOST = "chat_boost"
|
||||
const val UPDATE_REMOVE_CHAT_BOOST = "removed_chat_boost"
|
||||
const val UPDATE_BUSINESS_CONNECTION = "business_connection"
|
||||
const val UPDATE_BUSINESS_MESSAGE = "business_message"
|
||||
const val UPDATE_EDITED_BUSINESS_MESSAGE = "edited_business_message"
|
||||
const val UPDATE_DELETED_BUSINESS_MESSAGES = "deleted_business_messages"
|
||||
|
||||
val ALL_UPDATES_LIST_WITHOUT_REACTIONS = listOf(
|
||||
UPDATE_MESSAGE,
|
||||
@@ -37,7 +40,10 @@ val ALL_UPDATES_LIST_WITHOUT_REACTIONS = listOf(
|
||||
UPDATE_CHAT_JOIN_REQUEST,
|
||||
UPDATE_CHAT_BOOST,
|
||||
UPDATE_REMOVE_CHAT_BOOST,
|
||||
UPDATE_BUSINESS_CONNECTION
|
||||
UPDATE_BUSINESS_CONNECTION,
|
||||
UPDATE_BUSINESS_MESSAGE,
|
||||
UPDATE_EDITED_BUSINESS_MESSAGE,
|
||||
UPDATE_DELETED_BUSINESS_MESSAGES
|
||||
)
|
||||
|
||||
val ALL_UPDATES_LIST = ALL_UPDATES_LIST_WITHOUT_REACTIONS + listOf(
|
||||
|
||||
@@ -4,15 +4,12 @@ import dev.inmo.tgbotapi.abstracts.types.WithBusinessConnectionId
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.chat.PreviewUser
|
||||
import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded
|
||||
import kotlinx.serialization.EncodeDefault
|
||||
import kotlinx.serialization.KSerializer
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.descriptors.SerialDescriptor
|
||||
import kotlinx.serialization.encoding.Decoder
|
||||
import kotlinx.serialization.encoding.Encoder
|
||||
|
||||
@Serializable
|
||||
@Serializable(BusinessConnection.Companion::class)
|
||||
@ClassCastsIncluded
|
||||
sealed interface BusinessConnection : WithBusinessConnectionId {
|
||||
val id: BusinessConnectionId
|
||||
@@ -59,6 +56,7 @@ sealed interface BusinessConnection : WithBusinessConnectionId {
|
||||
override val isEnabled: Boolean = false
|
||||
}
|
||||
|
||||
@Serializer(BusinessConnection::class)
|
||||
companion object : KSerializer<BusinessConnection> {
|
||||
override val descriptor: SerialDescriptor
|
||||
get() = RawBusinessConnection.serializer().descriptor
|
||||
@@ -69,8 +67,7 @@ sealed interface BusinessConnection : WithBusinessConnectionId {
|
||||
}
|
||||
|
||||
override fun serialize(encoder: Encoder, value: BusinessConnection) {
|
||||
|
||||
RawBusinessConnection.serializer().serialize(encoder, RawBusinessConnection(value))
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,11 +2,8 @@ package dev.inmo.tgbotapi.types.business_connection
|
||||
|
||||
import dev.inmo.tgbotapi.abstracts.types.WithBusinessConnectionId
|
||||
import dev.inmo.tgbotapi.abstracts.types.WithOptionalBusinessConnectionId
|
||||
import dev.inmo.tgbotapi.types.MessageId
|
||||
import dev.inmo.tgbotapi.types.businessConnectionIdField
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.chat.PreviewChat
|
||||
import dev.inmo.tgbotapi.types.chatField
|
||||
import dev.inmo.tgbotapi.types.messageIdField
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@@ -16,6 +13,6 @@ data class BusinessMessagesDeleted(
|
||||
override val businessConnectionId: BusinessConnectionId,
|
||||
@SerialName(chatField)
|
||||
val chat: PreviewChat,
|
||||
@SerialName(messageIdField)
|
||||
val messageId: MessageId
|
||||
@SerialName(messageIdsField)
|
||||
val messageIds: List<MessageId>
|
||||
) : WithBusinessConnectionId
|
||||
|
||||
@@ -12,7 +12,4 @@ data class BusinessOpeningHours(
|
||||
val timeZoneName: String,
|
||||
@SerialName(openingHoursField)
|
||||
val openingHours: List<BusinessOpeningHoursInterval>
|
||||
) {
|
||||
val timezone: Timezone
|
||||
get() = Timezone.valueOf(timeZoneName)
|
||||
}
|
||||
)
|
||||
|
||||
@@ -6,7 +6,7 @@ import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class RawBusinessConnection(
|
||||
internal data class RawBusinessConnection(
|
||||
@SerialName(idField)
|
||||
val id: BusinessConnectionId,
|
||||
@SerialName(userField)
|
||||
|
||||
@@ -1,15 +1,8 @@
|
||||
package dev.inmo.tgbotapi.types.buttons
|
||||
|
||||
import dev.inmo.tgbotapi.types.botAdministratorRightsField
|
||||
import dev.inmo.tgbotapi.types.botIsMemberField
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.chat.member.ChatCommonAdministratorRights
|
||||
import dev.inmo.tgbotapi.types.chatHasUsernameField
|
||||
import dev.inmo.tgbotapi.types.chatIsChannelField
|
||||
import dev.inmo.tgbotapi.types.chatIsCreatedField
|
||||
import dev.inmo.tgbotapi.types.chatIsForumField
|
||||
import dev.inmo.tgbotapi.types.request.RequestId
|
||||
import dev.inmo.tgbotapi.types.requestIdField
|
||||
import dev.inmo.tgbotapi.types.userAdministratorRightsField
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@@ -34,7 +27,13 @@ data class KeyboardButtonRequestChat(
|
||||
@SerialName(botAdministratorRightsField)
|
||||
val botRightsInChat: ChatCommonAdministratorRights? = null,
|
||||
@SerialName(botIsMemberField)
|
||||
val botIsMember: Boolean? = null
|
||||
val botIsMember: Boolean? = null,
|
||||
@SerialName(requestTitleField)
|
||||
val requestTitle: Boolean? = null,
|
||||
@SerialName(requestUsernameField)
|
||||
val requestUsername: Boolean? = null,
|
||||
@SerialName(requestPhotoField)
|
||||
val requestPhoto: Boolean? = null
|
||||
) {
|
||||
companion object {
|
||||
fun Channel(
|
||||
@@ -43,7 +42,10 @@ data class KeyboardButtonRequestChat(
|
||||
isOwnedBy: Boolean? = null,
|
||||
userRightsInChat: ChatCommonAdministratorRights? = null,
|
||||
botRightsInChat: ChatCommonAdministratorRights? = null,
|
||||
botIsMember: Boolean? = null
|
||||
botIsMember: Boolean? = null,
|
||||
requestTitle: Boolean? = null,
|
||||
requestUsername: Boolean? = null,
|
||||
requestPhoto: Boolean? = null,
|
||||
) = KeyboardButtonRequestChat(
|
||||
requestId = requestId,
|
||||
isChannel = true,
|
||||
@@ -52,7 +54,10 @@ data class KeyboardButtonRequestChat(
|
||||
isOwnedBy = isOwnedBy,
|
||||
userRightsInChat = userRightsInChat,
|
||||
botRightsInChat = botRightsInChat,
|
||||
botIsMember = botIsMember
|
||||
botIsMember = botIsMember,
|
||||
requestTitle = requestTitle,
|
||||
requestUsername = requestUsername,
|
||||
requestPhoto = requestPhoto,
|
||||
)
|
||||
|
||||
fun Group(
|
||||
@@ -62,7 +67,10 @@ data class KeyboardButtonRequestChat(
|
||||
isOwnedBy: Boolean? = null,
|
||||
userRightsInChat: ChatCommonAdministratorRights? = null,
|
||||
botRightsInChat: ChatCommonAdministratorRights? = null,
|
||||
botIsMember: Boolean? = null
|
||||
botIsMember: Boolean? = null,
|
||||
requestTitle: Boolean? = null,
|
||||
requestUsername: Boolean? = null,
|
||||
requestPhoto: Boolean? = null,
|
||||
) = KeyboardButtonRequestChat(
|
||||
requestId = requestId,
|
||||
isChannel = false,
|
||||
@@ -71,7 +79,10 @@ data class KeyboardButtonRequestChat(
|
||||
isOwnedBy = isOwnedBy,
|
||||
userRightsInChat = userRightsInChat,
|
||||
botRightsInChat = botRightsInChat,
|
||||
botIsMember = botIsMember
|
||||
botIsMember = botIsMember,
|
||||
requestTitle = requestTitle,
|
||||
requestUsername = requestUsername,
|
||||
requestPhoto = requestPhoto,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,9 @@ sealed interface KeyboardButtonRequestUsers {
|
||||
val isBot: Boolean?
|
||||
val isPremium: Boolean?
|
||||
val maxCount: Int
|
||||
val requestName: Boolean?
|
||||
val requestUsername: Boolean?
|
||||
val requestPhoto: Boolean?
|
||||
|
||||
@Serializable
|
||||
data class Any(
|
||||
@@ -27,7 +30,13 @@ sealed interface KeyboardButtonRequestUsers {
|
||||
@SerialName(userIsPremiumField)
|
||||
override val isPremium: Boolean? = null,
|
||||
@SerialName(maxQuantityField)
|
||||
override val maxCount: Int = keyboardButtonRequestUserLimit.first
|
||||
override val maxCount: Int = keyboardButtonRequestUserLimit.first,
|
||||
@SerialName(requestNameField)
|
||||
override val requestName: Boolean? = null,
|
||||
@SerialName(requestUsernameField)
|
||||
override val requestUsername: Boolean? = null,
|
||||
@SerialName(requestPhotoField)
|
||||
override val requestPhoto: Boolean? = null,
|
||||
) : KeyboardButtonRequestUsers {
|
||||
@SerialName(userIsBotField)
|
||||
@EncodeDefault
|
||||
@@ -41,7 +50,13 @@ sealed interface KeyboardButtonRequestUsers {
|
||||
@SerialName(userIsPremiumField)
|
||||
override val isPremium: Boolean? = null,
|
||||
@SerialName(maxQuantityField)
|
||||
override val maxCount: Int = keyboardButtonRequestUserLimit.first
|
||||
override val maxCount: Int = keyboardButtonRequestUserLimit.first,
|
||||
@SerialName(requestNameField)
|
||||
override val requestName: Boolean? = null,
|
||||
@SerialName(requestUsernameField)
|
||||
override val requestUsername: Boolean? = null,
|
||||
@SerialName(requestPhotoField)
|
||||
override val requestPhoto: Boolean? = null,
|
||||
) : KeyboardButtonRequestUsers {
|
||||
@SerialName(userIsBotField)
|
||||
@EncodeDefault
|
||||
@@ -53,7 +68,13 @@ sealed interface KeyboardButtonRequestUsers {
|
||||
@SerialName(requestIdField)
|
||||
override val requestId: RequestId,
|
||||
@SerialName(maxQuantityField)
|
||||
override val maxCount: Int = keyboardButtonRequestUserLimit.first
|
||||
override val maxCount: Int = keyboardButtonRequestUserLimit.first,
|
||||
@SerialName(requestNameField)
|
||||
override val requestName: Boolean? = null,
|
||||
@SerialName(requestUsernameField)
|
||||
override val requestUsername: Boolean? = null,
|
||||
@SerialName(requestPhotoField)
|
||||
override val requestPhoto: Boolean? = null,
|
||||
) : KeyboardButtonRequestUsers {
|
||||
@SerialName(userIsBotField)
|
||||
@EncodeDefault
|
||||
@@ -73,7 +94,13 @@ sealed interface KeyboardButtonRequestUsers {
|
||||
@SerialName(userIsPremiumField)
|
||||
val userIsPremium: Boolean? = null,
|
||||
@SerialName(maxQuantityField)
|
||||
val maxCount: Int = keyboardButtonRequestUserLimit.first
|
||||
val maxCount: Int = keyboardButtonRequestUserLimit.first,
|
||||
@SerialName(requestNameField)
|
||||
val requestName: Boolean? = null,
|
||||
@SerialName(requestUsernameField)
|
||||
val requestUsername: Boolean? = null,
|
||||
@SerialName(requestPhotoField)
|
||||
val requestPhoto: Boolean? = null,
|
||||
)
|
||||
private val realSerializer = Surrogate.serializer()
|
||||
|
||||
@@ -83,9 +110,29 @@ sealed interface KeyboardButtonRequestUsers {
|
||||
val surrogate = realSerializer.deserialize(decoder)
|
||||
|
||||
return when (surrogate.userIsBot) {
|
||||
true -> Bot(surrogate.requestId, surrogate.maxCount)
|
||||
false -> Common(surrogate.requestId, surrogate.userIsPremium, surrogate.maxCount)
|
||||
null -> Any(surrogate.requestId, surrogate.userIsPremium, surrogate.maxCount)
|
||||
true -> Bot(
|
||||
requestId = surrogate.requestId,
|
||||
maxCount = surrogate.maxCount,
|
||||
requestName = surrogate.requestName,
|
||||
requestUsername = surrogate.requestUsername,
|
||||
requestPhoto = surrogate.requestPhoto
|
||||
)
|
||||
false -> Common(
|
||||
requestId = surrogate.requestId,
|
||||
isPremium = surrogate.userIsPremium,
|
||||
maxCount = surrogate.maxCount,
|
||||
requestName = surrogate.requestName,
|
||||
requestUsername = surrogate.requestUsername,
|
||||
requestPhoto = surrogate.requestPhoto
|
||||
)
|
||||
null -> Any(
|
||||
requestId = surrogate.requestId,
|
||||
isPremium = surrogate.userIsPremium,
|
||||
maxCount = surrogate.maxCount,
|
||||
requestName = surrogate.requestName,
|
||||
requestUsername = surrogate.requestUsername,
|
||||
requestPhoto = surrogate.requestPhoto
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,10 +140,13 @@ sealed interface KeyboardButtonRequestUsers {
|
||||
realSerializer.serialize(
|
||||
encoder,
|
||||
Surrogate(
|
||||
value.requestId,
|
||||
value.isBot,
|
||||
(value as? Common) ?.isPremium,
|
||||
value.maxCount
|
||||
requestId = value.requestId,
|
||||
userIsBot = value.isBot,
|
||||
userIsPremium = (value as? Common) ?.isPremium,
|
||||
maxCount = value.maxCount,
|
||||
requestName = value.requestName,
|
||||
requestUsername = value.requestUsername,
|
||||
requestPhoto = value.requestPhoto
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -4,7 +4,11 @@ import dev.inmo.tgbotapi.types.buttons.*
|
||||
import dev.inmo.tgbotapi.types.chat.member.ChatCommonAdministratorRights
|
||||
import dev.inmo.tgbotapi.types.keyboardButtonRequestUserLimit
|
||||
import dev.inmo.tgbotapi.types.request.RequestId
|
||||
import dev.inmo.tgbotapi.types.requestNameField
|
||||
import dev.inmo.tgbotapi.types.requestPhotoField
|
||||
import dev.inmo.tgbotapi.types.requestUsernameField
|
||||
import dev.inmo.tgbotapi.types.webapps.WebAppInfo
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlin.math.max
|
||||
|
||||
|
||||
@@ -71,10 +75,19 @@ inline fun requestUsersReplyButton(
|
||||
inline fun requestBotsReplyButton(
|
||||
text: String,
|
||||
requestId: RequestId,
|
||||
maxCount: Int = keyboardButtonRequestUserLimit.first
|
||||
maxCount: Int = keyboardButtonRequestUserLimit.first,
|
||||
requestName: Boolean? = null,
|
||||
requestUsername: Boolean? = null,
|
||||
requestPhoto: Boolean? = null,
|
||||
) = requestUsersReplyButton(
|
||||
text,
|
||||
KeyboardButtonRequestUsers.Bot(requestId, maxCount)
|
||||
KeyboardButtonRequestUsers.Bot(
|
||||
requestId = requestId,
|
||||
maxCount = maxCount,
|
||||
requestName = requestName,
|
||||
requestUsername = requestUsername,
|
||||
requestPhoto = requestPhoto
|
||||
)
|
||||
)
|
||||
|
||||
/**
|
||||
@@ -84,10 +97,20 @@ inline fun requestUsersReplyButton(
|
||||
text: String,
|
||||
requestId: RequestId,
|
||||
premiumUser: Boolean? = null,
|
||||
maxCount: Int = keyboardButtonRequestUserLimit.first
|
||||
maxCount: Int = keyboardButtonRequestUserLimit.first,
|
||||
requestName: Boolean? = null,
|
||||
requestUsername: Boolean? = null,
|
||||
requestPhoto: Boolean? = null,
|
||||
) = requestUsersReplyButton(
|
||||
text,
|
||||
KeyboardButtonRequestUsers.Common(requestId, premiumUser, maxCount)
|
||||
KeyboardButtonRequestUsers.Common(
|
||||
requestId = requestId,
|
||||
isPremium = premiumUser,
|
||||
maxCount = maxCount,
|
||||
requestName = requestName,
|
||||
requestUsername = requestUsername,
|
||||
requestPhoto = requestPhoto
|
||||
)
|
||||
)
|
||||
|
||||
/**
|
||||
@@ -97,12 +120,18 @@ inline fun requestUserReplyButton(
|
||||
text: String,
|
||||
requestId: RequestId,
|
||||
premiumUser: Boolean? = null,
|
||||
maxCount: Int = keyboardButtonRequestUserLimit.first
|
||||
maxCount: Int = keyboardButtonRequestUserLimit.first,
|
||||
requestName: Boolean? = null,
|
||||
requestUsername: Boolean? = null,
|
||||
requestPhoto: Boolean? = null,
|
||||
) = requestUsersReplyButton(
|
||||
text,
|
||||
requestId,
|
||||
premiumUser,
|
||||
maxCount
|
||||
maxCount,
|
||||
requestName = requestName,
|
||||
requestUsername = requestUsername,
|
||||
requestPhoto = requestPhoto
|
||||
)
|
||||
|
||||
/**
|
||||
@@ -112,10 +141,20 @@ inline fun requestUsersOrBotsReplyButton(
|
||||
text: String,
|
||||
requestId: RequestId,
|
||||
premiumUser: Boolean? = null,
|
||||
maxCount: Int = keyboardButtonRequestUserLimit.first
|
||||
maxCount: Int = keyboardButtonRequestUserLimit.first,
|
||||
requestName: Boolean? = null,
|
||||
requestUsername: Boolean? = null,
|
||||
requestPhoto: Boolean? = null,
|
||||
) = requestUsersReplyButton(
|
||||
text,
|
||||
KeyboardButtonRequestUsers.Any(requestId, premiumUser, maxCount)
|
||||
KeyboardButtonRequestUsers.Any(
|
||||
requestId = requestId,
|
||||
isPremium = premiumUser,
|
||||
maxCount = maxCount,
|
||||
requestName = requestName,
|
||||
requestUsername = requestUsername,
|
||||
requestPhoto = requestPhoto
|
||||
)
|
||||
)
|
||||
|
||||
/**
|
||||
@@ -123,10 +162,18 @@ inline fun requestUsersOrBotsReplyButton(
|
||||
*/
|
||||
inline fun requestUserOrBotReplyButton(
|
||||
text: String,
|
||||
requestId: RequestId
|
||||
requestId: RequestId,
|
||||
requestName: Boolean? = null,
|
||||
requestUsername: Boolean? = null,
|
||||
requestPhoto: Boolean? = null,
|
||||
) = requestUsersReplyButton(
|
||||
text,
|
||||
KeyboardButtonRequestUsers.Any(requestId)
|
||||
KeyboardButtonRequestUsers.Any(
|
||||
requestId = requestId,
|
||||
requestName = requestName,
|
||||
requestUsername = requestUsername,
|
||||
requestPhoto = requestPhoto
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -153,7 +200,10 @@ inline fun requestChatReplyButton(
|
||||
isOwnedBy: Boolean? = null,
|
||||
userRightsInChat: ChatCommonAdministratorRights? = null,
|
||||
botRightsInChat: ChatCommonAdministratorRights? = null,
|
||||
botIsMember: Boolean = false
|
||||
botIsMember: Boolean = false,
|
||||
requestTitle: Boolean? = null,
|
||||
requestUsername: Boolean? = null,
|
||||
requestPhoto: Boolean? = null,
|
||||
) = requestChatReplyButton(
|
||||
text,
|
||||
KeyboardButtonRequestChat(
|
||||
@@ -164,7 +214,10 @@ inline fun requestChatReplyButton(
|
||||
isOwnedBy = isOwnedBy,
|
||||
userRightsInChat = userRightsInChat,
|
||||
botRightsInChat = botRightsInChat,
|
||||
botIsMember = botIsMember
|
||||
botIsMember = botIsMember,
|
||||
requestTitle = requestTitle,
|
||||
requestUsername = requestUsername,
|
||||
requestPhoto = requestPhoto,
|
||||
)
|
||||
)
|
||||
|
||||
@@ -178,7 +231,10 @@ inline fun requestChannelReplyButton(
|
||||
isOwnedBy: Boolean? = null,
|
||||
userRightsInChat: ChatCommonAdministratorRights? = null,
|
||||
botRightsInChat: ChatCommonAdministratorRights? = null,
|
||||
botIsMember: Boolean = false
|
||||
botIsMember: Boolean = false,
|
||||
requestTitle: Boolean? = null,
|
||||
requestUsername: Boolean? = null,
|
||||
requestPhoto: Boolean? = null,
|
||||
) = requestChatReplyButton(
|
||||
text,
|
||||
KeyboardButtonRequestChat.Channel(
|
||||
@@ -187,7 +243,10 @@ inline fun requestChannelReplyButton(
|
||||
isOwnedBy = isOwnedBy,
|
||||
userRightsInChat = userRightsInChat,
|
||||
botRightsInChat = botRightsInChat,
|
||||
botIsMember = botIsMember
|
||||
botIsMember = botIsMember,
|
||||
requestTitle = requestTitle,
|
||||
requestUsername = requestUsername,
|
||||
requestPhoto = requestPhoto,
|
||||
)
|
||||
)
|
||||
|
||||
@@ -203,7 +262,10 @@ inline fun requestChannelReplyButton(
|
||||
isOwnedBy: Boolean? = null,
|
||||
userRightsInChat: ChatCommonAdministratorRights? = null,
|
||||
botRightsInChat: ChatCommonAdministratorRights? = null,
|
||||
botIsMember: Boolean? = null
|
||||
botIsMember: Boolean? = null,
|
||||
requestTitle: Boolean? = null,
|
||||
requestUsername: Boolean? = null,
|
||||
requestPhoto: Boolean? = null,
|
||||
) = requestChatReplyButton(
|
||||
text,
|
||||
KeyboardButtonRequestChat.Group(
|
||||
@@ -213,6 +275,9 @@ inline fun requestChannelReplyButton(
|
||||
isOwnedBy = isOwnedBy,
|
||||
userRightsInChat = userRightsInChat,
|
||||
botRightsInChat = botRightsInChat,
|
||||
botIsMember = botIsMember
|
||||
botIsMember = botIsMember,
|
||||
requestTitle = requestTitle,
|
||||
requestUsername = requestUsername,
|
||||
requestPhoto = requestPhoto,
|
||||
)
|
||||
)
|
||||
|
||||
@@ -133,6 +133,8 @@ data class ExtendedPrivateChatImpl(
|
||||
override val businessLocation: BusinessLocation? = null,
|
||||
@SerialName(businessOpeningHoursField)
|
||||
override val businessOpeningHours: BusinessOpeningHours? = null,
|
||||
@SerialName(birthdateField)
|
||||
override val birthdate: Birthdate? = null,
|
||||
@SerialName(personalChatField)
|
||||
@Serializable(PreviewChatSerializer::class)
|
||||
override val personalChat: PreviewChannelChat? = null
|
||||
|
||||
@@ -46,6 +46,7 @@ sealed interface ExtendedPrivateChat : PrivateChat, ExtendedChatWithUsername, Ex
|
||||
val businessLocation: BusinessLocation?
|
||||
val businessOpeningHours: BusinessOpeningHours?
|
||||
|
||||
val birthdate: Birthdate?
|
||||
val personalChat: PreviewChannelChat?
|
||||
|
||||
val allowCreateUserIdLink: Boolean
|
||||
|
||||
@@ -29,7 +29,7 @@ data class StickerSurrogate(
|
||||
val mask_position: MaskPosition? = null,
|
||||
val custom_emoji_id: CustomEmojiId? = null,
|
||||
val file_size: Long? = null,
|
||||
val needs_repainting: Boolean = false
|
||||
val needs_repainting: Boolean = false,
|
||||
)
|
||||
|
||||
// TODO:: Serializer
|
||||
@@ -40,9 +40,9 @@ sealed interface Sticker : TelegramMediaFile, SizedMediaFile, ThumbedMediaFile,
|
||||
val stickerFormat: StickerFormat
|
||||
|
||||
val isAnimated
|
||||
get() = false
|
||||
get() = stickerFormat is StickerFormat.Animated
|
||||
val isVideo
|
||||
get() = false
|
||||
get() = stickerFormat is StickerFormat.Video
|
||||
val type: StickerType
|
||||
|
||||
fun asInputSticker(emojis: List<String> = emoji ?.let { listOf(it) } ?: error("Unable to create input sticker without emojis")): InputSticker
|
||||
@@ -238,6 +238,7 @@ sealed interface RegularSticker : Sticker {
|
||||
|
||||
override fun asInputSticker(emojis: List<String>) = InputSticker.WithKeywords.Regular(
|
||||
fileId,
|
||||
stickerFormat,
|
||||
emojis,
|
||||
emptyList()
|
||||
)
|
||||
@@ -339,6 +340,7 @@ sealed interface MaskSticker : Sticker {
|
||||
|
||||
override fun asInputSticker(emojis: List<String>) = InputSticker.Mask(
|
||||
fileId,
|
||||
stickerFormat,
|
||||
emojis,
|
||||
maskPosition
|
||||
)
|
||||
@@ -439,6 +441,7 @@ sealed interface CustomEmojiSticker : Sticker {
|
||||
|
||||
override fun asInputSticker(emojis: List<String>) = InputSticker.WithKeywords.CustomEmoji(
|
||||
fileId,
|
||||
stickerFormat,
|
||||
emojis,
|
||||
emptyList()
|
||||
)
|
||||
@@ -563,6 +566,7 @@ data class UnknownSticker(
|
||||
) : Sticker {
|
||||
override fun asInputSticker(emojis: List<String>) = InputSticker.WithKeywords.Regular(
|
||||
fileId,
|
||||
stickerFormat,
|
||||
emojis,
|
||||
emptyList()
|
||||
)
|
||||
|
||||
@@ -2,9 +2,9 @@ package dev.inmo.tgbotapi.types.message.abstracts
|
||||
|
||||
import dev.inmo.tgbotapi.abstracts.types.WithBusinessConnectionId
|
||||
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
|
||||
import dev.inmo.tgbotapi.types.chat.Bot
|
||||
import dev.inmo.tgbotapi.types.chat.PreviewBot
|
||||
import dev.inmo.tgbotapi.types.chat.PreviewBusinessChat
|
||||
import dev.inmo.tgbotapi.types.chat.PreviewPrivateChat
|
||||
import dev.inmo.tgbotapi.types.message.content.MessageContent
|
||||
|
||||
interface BusinessContentMessage<T: MessageContent> : PossiblySentViaBotCommonMessage<T>, FromUserMessage,
|
||||
@@ -12,4 +12,11 @@ interface BusinessContentMessage<T: MessageContent> : PossiblySentViaBotCommonMe
|
||||
override val chat: PreviewBusinessChat
|
||||
override val businessConnectionId: BusinessConnectionId
|
||||
val senderBusinessBot: PreviewBot?
|
||||
|
||||
/**
|
||||
* Currently, there are only 1-1 business chats and any message in the [chat] sent not by [PreviewBusinessChat.original]
|
||||
* must be sent by bot or user
|
||||
*/
|
||||
val sentByBusinessConnectionOwner: Boolean
|
||||
get() = chat.original.id != from.id && from !is Bot
|
||||
}
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
package dev.inmo.tgbotapi.types.request
|
||||
|
||||
import dev.inmo.tgbotapi.types.ChatId
|
||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.UserId
|
||||
import dev.inmo.tgbotapi.types.chatIdField
|
||||
import dev.inmo.tgbotapi.types.requestIdField
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.files.Photo
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@@ -13,5 +10,11 @@ data class ChatShared(
|
||||
@SerialName(requestIdField)
|
||||
override val requestId: RequestId,
|
||||
@SerialName(chatIdField)
|
||||
override val chatId: ChatId
|
||||
override val chatId: ChatId,
|
||||
@SerialName(titleField)
|
||||
val title: String? = null,
|
||||
@SerialName(usernameField)
|
||||
val username: Username? = null,
|
||||
@SerialName(photoField)
|
||||
val photo: Photo? = null
|
||||
) : ChatSharedRequest
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package dev.inmo.tgbotapi.types.request
|
||||
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.files.Photo
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class SharedUser(
|
||||
@SerialName(userIdField)
|
||||
val id: UserId,
|
||||
@SerialName(firstNameField)
|
||||
val firstName: String? = null,
|
||||
@SerialName(lastNameField)
|
||||
val lastName: String? = null,
|
||||
@SerialName(usernameField)
|
||||
val username: Username? = null,
|
||||
@SerialName(photoField)
|
||||
val photo: Photo? = null,
|
||||
)
|
||||
@@ -1,6 +1,7 @@
|
||||
package dev.inmo.tgbotapi.types.request
|
||||
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.chat.PreviewUser
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@@ -8,15 +9,30 @@ import kotlinx.serialization.Serializable
|
||||
data class UsersShared(
|
||||
@SerialName(requestIdField)
|
||||
override val requestId: RequestId,
|
||||
@SerialName(userIdsField)
|
||||
val userIds: List<UserId>
|
||||
@SerialName(usersField)
|
||||
val users: List<SharedUser>
|
||||
) : ChatSharedRequest {
|
||||
val userIds: List<UserId> by lazy {
|
||||
users.map { it.id }
|
||||
}
|
||||
val userId: UserId
|
||||
get() = userIds.first()
|
||||
constructor(
|
||||
requestId: RequestId,
|
||||
userId: UserId
|
||||
) : this(requestId, listOf(userId))
|
||||
user: SharedUser
|
||||
) : this(requestId, listOf(user))
|
||||
|
||||
override val chatId: ChatId
|
||||
get() = userId
|
||||
|
||||
companion object {
|
||||
operator fun invoke(
|
||||
requestId: RequestId,
|
||||
userIds: List<UserId>
|
||||
) = UsersShared(requestId, userIds.map { SharedUser(it) })
|
||||
operator fun invoke(
|
||||
requestId: RequestId,
|
||||
userId: UserId
|
||||
) = UsersShared(requestId, SharedUser(userId))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,12 +25,7 @@ sealed interface StickerSet {
|
||||
val name: StickerSetName
|
||||
val title: String
|
||||
val stickerType: StickerType
|
||||
val stickerFormat: StickerFormat
|
||||
val stickers: List<Sticker>
|
||||
val isAnimated: Boolean
|
||||
get() = false
|
||||
val isVideo: Boolean
|
||||
get() = false
|
||||
val thumbnail: PhotoSize?
|
||||
|
||||
object Serializer : KSerializer<StickerSet> {
|
||||
@@ -42,69 +37,33 @@ sealed interface StickerSet {
|
||||
|
||||
return when (surrogate.sticker_type) {
|
||||
StickerType.CustomEmoji -> when {
|
||||
surrogate.is_animated == true -> CustomEmojiAnimatedStickerSet(
|
||||
else -> CustomEmojiStickerSet(
|
||||
surrogate.name,
|
||||
surrogate.title,
|
||||
surrogate.stickers.filterIsInstance<CustomEmojiAnimatedSticker>(),
|
||||
surrogate.thumb
|
||||
)
|
||||
surrogate.is_video == true -> CustomEmojiVideoStickerSet(
|
||||
surrogate.name,
|
||||
surrogate.title,
|
||||
surrogate.stickers.filterIsInstance<CustomEmojiVideoSticker>(),
|
||||
surrogate.thumb
|
||||
)
|
||||
else -> CustomEmojiSimpleStickerSet(
|
||||
surrogate.name,
|
||||
surrogate.title,
|
||||
surrogate.stickers.filterIsInstance<CustomEmojiSimpleSticker>(),
|
||||
surrogate.stickers.filterIsInstance<CustomEmojiSticker>(),
|
||||
surrogate.thumb
|
||||
)
|
||||
}
|
||||
StickerType.Mask -> when {
|
||||
surrogate.is_animated == true -> MaskAnimatedStickerSet(
|
||||
else -> MaskStickerSet(
|
||||
surrogate.name,
|
||||
surrogate.title,
|
||||
surrogate.stickers.filterIsInstance<MaskAnimatedSticker>(),
|
||||
surrogate.thumb
|
||||
)
|
||||
surrogate.is_video == true -> MaskVideoStickerSet(
|
||||
surrogate.name,
|
||||
surrogate.title,
|
||||
surrogate.stickers.filterIsInstance<MaskVideoSticker>(),
|
||||
surrogate.thumb
|
||||
)
|
||||
else -> MaskSimpleStickerSet(
|
||||
surrogate.name,
|
||||
surrogate.title,
|
||||
surrogate.stickers.filterIsInstance<MaskSimpleSticker>(),
|
||||
surrogate.stickers.filterIsInstance<MaskSticker>(),
|
||||
surrogate.thumb
|
||||
)
|
||||
}
|
||||
StickerType.Regular -> when {
|
||||
surrogate.is_animated == true -> RegularAnimatedStickerSet(
|
||||
else -> RegularStickerSet(
|
||||
surrogate.name,
|
||||
surrogate.title,
|
||||
surrogate.stickers.filterIsInstance<RegularAnimatedSticker>(),
|
||||
surrogate.thumb
|
||||
)
|
||||
surrogate.is_video == true -> RegularVideoStickerSet(
|
||||
surrogate.name,
|
||||
surrogate.title,
|
||||
surrogate.stickers.filterIsInstance<RegularVideoSticker>(),
|
||||
surrogate.thumb
|
||||
)
|
||||
else -> RegularSimpleStickerSet(
|
||||
surrogate.name,
|
||||
surrogate.title,
|
||||
surrogate.stickers.filterIsInstance<RegularSimpleSticker>(),
|
||||
surrogate.stickers.filterIsInstance<RegularSticker>(),
|
||||
surrogate.thumb
|
||||
)
|
||||
}
|
||||
is StickerType.Unknown -> UnknownStickerSet(
|
||||
surrogate.name,
|
||||
surrogate.title,
|
||||
surrogate.stickers.filterIsInstance<RegularSimpleSticker>(),
|
||||
surrogate.stickers.filterIsInstance<RegularSticker>(),
|
||||
surrogate.sticker_type,
|
||||
surrogate.thumb,
|
||||
json
|
||||
@@ -119,180 +78,48 @@ sealed interface StickerSet {
|
||||
}
|
||||
|
||||
@Serializable
|
||||
sealed interface AnimatedStickerSet : StickerSet {
|
||||
override val isAnimated: Boolean
|
||||
get() = true
|
||||
@SerialName(stickerFormatField)
|
||||
@EncodeDefault
|
||||
override val stickerFormat: StickerFormat
|
||||
get() = StickerFormat.Animated
|
||||
}
|
||||
@Serializable
|
||||
sealed interface VideoStickerSet : StickerSet {
|
||||
override val isVideo: Boolean
|
||||
get() = true
|
||||
@SerialName(stickerFormatField)
|
||||
@EncodeDefault
|
||||
override val stickerFormat: StickerFormat
|
||||
get() = StickerFormat.Video
|
||||
}
|
||||
@Serializable
|
||||
sealed interface RegularStickerSet : StickerSet
|
||||
@Serializable
|
||||
sealed interface MaskStickerSet : StickerSet
|
||||
@Serializable
|
||||
sealed interface CustomEmojiStickerSet : StickerSet
|
||||
|
||||
@Serializable
|
||||
data class RegularSimpleStickerSet(
|
||||
data class RegularStickerSet(
|
||||
@SerialName(nameField)
|
||||
override val name: StickerSetName,
|
||||
@SerialName(titleField)
|
||||
override val title: String,
|
||||
@SerialName(stickersField)
|
||||
override val stickers: List<RegularSimpleSticker>,
|
||||
override val stickers: List<RegularSticker>,
|
||||
@SerialName(thumbnailField)
|
||||
override val thumbnail: PhotoSize? = null
|
||||
) : RegularStickerSet {
|
||||
@SerialName(stickerTypeField)
|
||||
@EncodeDefault
|
||||
override val stickerType: StickerType = StickerType.Regular
|
||||
@SerialName(stickerFormatField)
|
||||
@EncodeDefault
|
||||
override val stickerFormat: StickerFormat = StickerFormat.Static
|
||||
}
|
||||
|
||||
@Serializable
|
||||
data class RegularAnimatedStickerSet(
|
||||
@SerialName(nameField)
|
||||
override val name: StickerSetName,
|
||||
@SerialName(titleField)
|
||||
override val title: String,
|
||||
@SerialName(stickersField)
|
||||
override val stickers: List<RegularAnimatedSticker>,
|
||||
@SerialName(thumbnailField)
|
||||
override val thumbnail: PhotoSize? = null
|
||||
) : RegularStickerSet, AnimatedStickerSet {
|
||||
) : StickerSet {
|
||||
@SerialName(stickerTypeField)
|
||||
@EncodeDefault
|
||||
override val stickerType: StickerType = StickerType.Regular
|
||||
}
|
||||
|
||||
@Serializable
|
||||
data class RegularVideoStickerSet(
|
||||
data class MaskStickerSet(
|
||||
@SerialName(nameField)
|
||||
override val name: StickerSetName,
|
||||
@SerialName(titleField)
|
||||
override val title: String,
|
||||
@SerialName(stickersField)
|
||||
override val stickers: List<RegularVideoSticker>,
|
||||
override val stickers: List<MaskSticker>,
|
||||
@SerialName(thumbnailField)
|
||||
override val thumbnail: PhotoSize? = null
|
||||
) : RegularStickerSet, VideoStickerSet {
|
||||
@SerialName(stickerTypeField)
|
||||
@EncodeDefault
|
||||
override val stickerType: StickerType = StickerType.Regular
|
||||
}
|
||||
|
||||
@Serializable
|
||||
data class MaskSimpleStickerSet(
|
||||
@SerialName(nameField)
|
||||
override val name: StickerSetName,
|
||||
@SerialName(titleField)
|
||||
override val title: String,
|
||||
@SerialName(stickersField)
|
||||
override val stickers: List<MaskSimpleSticker>,
|
||||
@SerialName(thumbnailField)
|
||||
override val thumbnail: PhotoSize? = null
|
||||
) : MaskStickerSet {
|
||||
@SerialName(stickerTypeField)
|
||||
@EncodeDefault
|
||||
override val stickerType: StickerType = StickerType.Mask
|
||||
|
||||
@SerialName(stickerFormatField)
|
||||
@EncodeDefault
|
||||
override val stickerFormat: StickerFormat = StickerFormat.Static
|
||||
}
|
||||
|
||||
@Serializable
|
||||
data class MaskAnimatedStickerSet(
|
||||
@SerialName(nameField)
|
||||
override val name: StickerSetName,
|
||||
@SerialName(titleField)
|
||||
override val title: String,
|
||||
@SerialName(stickersField)
|
||||
override val stickers: List<MaskAnimatedSticker>,
|
||||
@SerialName(thumbnailField)
|
||||
override val thumbnail: PhotoSize? = null
|
||||
) : MaskStickerSet, AnimatedStickerSet {
|
||||
) : StickerSet {
|
||||
@SerialName(stickerTypeField)
|
||||
@EncodeDefault
|
||||
override val stickerType: StickerType = StickerType.Mask
|
||||
}
|
||||
|
||||
@Serializable
|
||||
data class MaskVideoStickerSet(
|
||||
data class CustomEmojiStickerSet(
|
||||
@SerialName(nameField)
|
||||
override val name: StickerSetName,
|
||||
@SerialName(titleField)
|
||||
override val title: String,
|
||||
@SerialName(stickersField)
|
||||
override val stickers: List<MaskVideoSticker>,
|
||||
override val stickers: List<CustomEmojiSticker>,
|
||||
@SerialName(thumbnailField)
|
||||
override val thumbnail: PhotoSize? = null
|
||||
) : MaskStickerSet, VideoStickerSet {
|
||||
@SerialName(stickerTypeField)
|
||||
@EncodeDefault
|
||||
override val stickerType: StickerType = StickerType.Mask
|
||||
}
|
||||
|
||||
@Serializable
|
||||
data class CustomEmojiSimpleStickerSet(
|
||||
@SerialName(nameField)
|
||||
override val name: StickerSetName,
|
||||
@SerialName(titleField)
|
||||
override val title: String,
|
||||
@SerialName(stickersField)
|
||||
override val stickers: List<CustomEmojiSimpleSticker>,
|
||||
@SerialName(thumbnailField)
|
||||
override val thumbnail: PhotoSize? = null
|
||||
) : CustomEmojiStickerSet {
|
||||
@SerialName(stickerTypeField)
|
||||
@EncodeDefault
|
||||
override val stickerType: StickerType = StickerType.CustomEmoji
|
||||
|
||||
@SerialName(stickerFormatField)
|
||||
@EncodeDefault
|
||||
override val stickerFormat: StickerFormat = StickerFormat.Static
|
||||
}
|
||||
|
||||
@Serializable
|
||||
data class CustomEmojiAnimatedStickerSet(
|
||||
@SerialName(nameField)
|
||||
override val name: StickerSetName,
|
||||
@SerialName(titleField)
|
||||
override val title: String,
|
||||
@SerialName(stickersField)
|
||||
override val stickers: List<CustomEmojiAnimatedSticker>,
|
||||
@SerialName(thumbnailField)
|
||||
override val thumbnail: PhotoSize? = null
|
||||
) : CustomEmojiStickerSet, AnimatedStickerSet {
|
||||
@SerialName(stickerTypeField)
|
||||
@EncodeDefault
|
||||
override val stickerType: StickerType = StickerType.CustomEmoji
|
||||
}
|
||||
|
||||
@Serializable
|
||||
data class CustomEmojiVideoStickerSet(
|
||||
@SerialName(nameField)
|
||||
override val name: StickerSetName,
|
||||
@SerialName(titleField)
|
||||
override val title: String,
|
||||
@SerialName(stickersField)
|
||||
override val stickers: List<CustomEmojiVideoSticker>,
|
||||
@SerialName(thumbnailField)
|
||||
override val thumbnail: PhotoSize? = null
|
||||
) : CustomEmojiStickerSet, VideoStickerSet {
|
||||
) : StickerSet {
|
||||
@SerialName(stickerTypeField)
|
||||
@EncodeDefault
|
||||
override val stickerType: StickerType = StickerType.CustomEmoji
|
||||
@@ -311,4 +138,4 @@ data class UnknownStickerSet(
|
||||
@SerialName(thumbnailField)
|
||||
override val thumbnail: PhotoSize? = null,
|
||||
val raw: JsonElement
|
||||
) : CustomEmojiStickerSet, VideoStickerSet
|
||||
) : StickerSet
|
||||
|
||||
@@ -49,6 +49,7 @@ internal data class RawUpdate constructor(
|
||||
private val message_reaction_count: ChatMessageReactionsCountUpdated? = null,
|
||||
private val chat_boost: ChatBoostUpdated? = null,
|
||||
private val removed_chat_boost: ChatBoostRemoved? = null,
|
||||
@Serializable(BusinessConnection.Companion::class)
|
||||
private val business_connection: BusinessConnection? = null,
|
||||
@Serializable(TelegramBotAPIMessageDeserializeOnlySerializer::class)
|
||||
private val business_message: BusinessContentMessage<*>? = null,
|
||||
|
||||
@@ -3196,27 +3196,29 @@ public final class dev/inmo/tgbotapi/extensions/utils/types/buttons/ReplyKeyboar
|
||||
public static synthetic fun flatReplyKeyboard$default (Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/String;Ljava/lang/Boolean;Ljava/lang/Boolean;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/buttons/ReplyKeyboardMarkup;
|
||||
public static final fun replyKeyboard (Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/String;Ljava/lang/Boolean;Ljava/lang/Boolean;Lkotlin/jvm/functions/Function1;)Ldev/inmo/tgbotapi/types/buttons/ReplyKeyboardMarkup;
|
||||
public static synthetic fun replyKeyboard$default (Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/String;Ljava/lang/Boolean;Ljava/lang/Boolean;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/buttons/ReplyKeyboardMarkup;
|
||||
public static final fun requestBotButton-k9yqfdo (Ldev/inmo/tgbotapi/utils/RowBuilder;Ljava/lang/String;S)Z
|
||||
public static final fun requestBotsButton-t22p7TQ (Ldev/inmo/tgbotapi/utils/RowBuilder;Ljava/lang/String;SI)Z
|
||||
public static synthetic fun requestBotsButton-t22p7TQ$default (Ldev/inmo/tgbotapi/utils/RowBuilder;Ljava/lang/String;SIILjava/lang/Object;)Z
|
||||
public static final fun requestChannelButton-XjXd-ic (Ldev/inmo/tgbotapi/utils/RowBuilder;Ljava/lang/String;SLjava/lang/Boolean;Ljava/lang/Boolean;Ldev/inmo/tgbotapi/types/chat/member/ChatCommonAdministratorRights;Ldev/inmo/tgbotapi/types/chat/member/ChatCommonAdministratorRights;Ljava/lang/Boolean;)Z
|
||||
public static synthetic fun requestChannelButton-XjXd-ic$default (Ldev/inmo/tgbotapi/utils/RowBuilder;Ljava/lang/String;SLjava/lang/Boolean;Ljava/lang/Boolean;Ldev/inmo/tgbotapi/types/chat/member/ChatCommonAdministratorRights;Ldev/inmo/tgbotapi/types/chat/member/ChatCommonAdministratorRights;Ljava/lang/Boolean;ILjava/lang/Object;)Z
|
||||
public static final fun requestBotButton-6J3sOes (Ldev/inmo/tgbotapi/utils/RowBuilder;Ljava/lang/String;SLjava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;)Z
|
||||
public static synthetic fun requestBotButton-6J3sOes$default (Ldev/inmo/tgbotapi/utils/RowBuilder;Ljava/lang/String;SLjava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;ILjava/lang/Object;)Z
|
||||
public static final fun requestBotsButton-6xNxnbw (Ldev/inmo/tgbotapi/utils/RowBuilder;Ljava/lang/String;SILjava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;)Z
|
||||
public static synthetic fun requestBotsButton-6xNxnbw$default (Ldev/inmo/tgbotapi/utils/RowBuilder;Ljava/lang/String;SILjava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;ILjava/lang/Object;)Z
|
||||
public static final fun requestChannelButton-cvDvKfo (Ldev/inmo/tgbotapi/utils/RowBuilder;Ljava/lang/String;SLjava/lang/Boolean;Ljava/lang/Boolean;Ldev/inmo/tgbotapi/types/chat/member/ChatCommonAdministratorRights;Ldev/inmo/tgbotapi/types/chat/member/ChatCommonAdministratorRights;Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;)Z
|
||||
public static synthetic fun requestChannelButton-cvDvKfo$default (Ldev/inmo/tgbotapi/utils/RowBuilder;Ljava/lang/String;SLjava/lang/Boolean;Ljava/lang/Boolean;Ldev/inmo/tgbotapi/types/chat/member/ChatCommonAdministratorRights;Ldev/inmo/tgbotapi/types/chat/member/ChatCommonAdministratorRights;Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;ILjava/lang/Object;)Z
|
||||
public static final fun requestChatButton (Ldev/inmo/tgbotapi/utils/RowBuilder;Ljava/lang/String;Ldev/inmo/tgbotapi/types/buttons/KeyboardButtonRequestChat;)Z
|
||||
public static final fun requestChatButton-Lj92p0I (Ldev/inmo/tgbotapi/utils/RowBuilder;Ljava/lang/String;SLjava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;Ldev/inmo/tgbotapi/types/chat/member/ChatCommonAdministratorRights;Ldev/inmo/tgbotapi/types/chat/member/ChatCommonAdministratorRights;Ljava/lang/Boolean;)Z
|
||||
public static synthetic fun requestChatButton-Lj92p0I$default (Ldev/inmo/tgbotapi/utils/RowBuilder;Ljava/lang/String;SLjava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;Ldev/inmo/tgbotapi/types/chat/member/ChatCommonAdministratorRights;Ldev/inmo/tgbotapi/types/chat/member/ChatCommonAdministratorRights;Ljava/lang/Boolean;ILjava/lang/Object;)Z
|
||||
public static final fun requestChatButton-n4yCVdQ (Ldev/inmo/tgbotapi/utils/RowBuilder;Ljava/lang/String;SLjava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;Ldev/inmo/tgbotapi/types/chat/member/ChatCommonAdministratorRights;Ldev/inmo/tgbotapi/types/chat/member/ChatCommonAdministratorRights;Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;)Z
|
||||
public static synthetic fun requestChatButton-n4yCVdQ$default (Ldev/inmo/tgbotapi/utils/RowBuilder;Ljava/lang/String;SLjava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;Ldev/inmo/tgbotapi/types/chat/member/ChatCommonAdministratorRights;Ldev/inmo/tgbotapi/types/chat/member/ChatCommonAdministratorRights;Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;ILjava/lang/Object;)Z
|
||||
public static final fun requestContactButton (Ldev/inmo/tgbotapi/utils/RowBuilder;Ljava/lang/String;)Z
|
||||
public static final fun requestGroupButton-GP8XSDU (Ldev/inmo/tgbotapi/utils/RowBuilder;Ljava/lang/String;SLjava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;Ldev/inmo/tgbotapi/types/chat/member/ChatCommonAdministratorRights;Ldev/inmo/tgbotapi/types/chat/member/ChatCommonAdministratorRights;Ljava/lang/Boolean;)Z
|
||||
public static synthetic fun requestGroupButton-GP8XSDU$default (Ldev/inmo/tgbotapi/utils/RowBuilder;Ljava/lang/String;SLjava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;Ldev/inmo/tgbotapi/types/chat/member/ChatCommonAdministratorRights;Ldev/inmo/tgbotapi/types/chat/member/ChatCommonAdministratorRights;Ljava/lang/Boolean;ILjava/lang/Object;)Z
|
||||
public static final fun requestGroupButton-dh25vGQ (Ldev/inmo/tgbotapi/utils/RowBuilder;Ljava/lang/String;SLjava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;Ldev/inmo/tgbotapi/types/chat/member/ChatCommonAdministratorRights;Ldev/inmo/tgbotapi/types/chat/member/ChatCommonAdministratorRights;Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;)Z
|
||||
public static synthetic fun requestGroupButton-dh25vGQ$default (Ldev/inmo/tgbotapi/utils/RowBuilder;Ljava/lang/String;SLjava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;Ldev/inmo/tgbotapi/types/chat/member/ChatCommonAdministratorRights;Ldev/inmo/tgbotapi/types/chat/member/ChatCommonAdministratorRights;Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;ILjava/lang/Object;)Z
|
||||
public static final fun requestLocationButton (Ldev/inmo/tgbotapi/utils/RowBuilder;Ljava/lang/String;)Z
|
||||
public static final fun requestPollButton (Ldev/inmo/tgbotapi/utils/RowBuilder;Ljava/lang/String;Ldev/inmo/tgbotapi/types/buttons/KeyboardButtonPollType;)Z
|
||||
public static final fun requestUserButton-t22p7TQ (Ldev/inmo/tgbotapi/utils/RowBuilder;Ljava/lang/String;SLjava/lang/Boolean;)Z
|
||||
public static synthetic fun requestUserButton-t22p7TQ$default (Ldev/inmo/tgbotapi/utils/RowBuilder;Ljava/lang/String;SLjava/lang/Boolean;ILjava/lang/Object;)Z
|
||||
public static final fun requestUserOrBotButton-k9yqfdo (Ldev/inmo/tgbotapi/utils/RowBuilder;Ljava/lang/String;S)Z
|
||||
public static final fun requestUserButton-6xNxnbw (Ldev/inmo/tgbotapi/utils/RowBuilder;Ljava/lang/String;SLjava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;)Z
|
||||
public static synthetic fun requestUserButton-6xNxnbw$default (Ldev/inmo/tgbotapi/utils/RowBuilder;Ljava/lang/String;SLjava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;ILjava/lang/Object;)Z
|
||||
public static final fun requestUserOrBotButton-6J3sOes (Ldev/inmo/tgbotapi/utils/RowBuilder;Ljava/lang/String;SLjava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;)Z
|
||||
public static synthetic fun requestUserOrBotButton-6J3sOes$default (Ldev/inmo/tgbotapi/utils/RowBuilder;Ljava/lang/String;SLjava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;ILjava/lang/Object;)Z
|
||||
public static final fun requestUsersButton (Ldev/inmo/tgbotapi/utils/RowBuilder;Ljava/lang/String;Ldev/inmo/tgbotapi/types/buttons/KeyboardButtonRequestUsers;)Z
|
||||
public static final fun requestUsersButton-0GQog4c (Ldev/inmo/tgbotapi/utils/RowBuilder;Ljava/lang/String;SLjava/lang/Boolean;I)Z
|
||||
public static synthetic fun requestUsersButton-0GQog4c$default (Ldev/inmo/tgbotapi/utils/RowBuilder;Ljava/lang/String;SLjava/lang/Boolean;IILjava/lang/Object;)Z
|
||||
public static final fun requestUsersOrBotsButton-0GQog4c (Ldev/inmo/tgbotapi/utils/RowBuilder;Ljava/lang/String;SLjava/lang/Boolean;I)Z
|
||||
public static synthetic fun requestUsersOrBotsButton-0GQog4c$default (Ldev/inmo/tgbotapi/utils/RowBuilder;Ljava/lang/String;SLjava/lang/Boolean;IILjava/lang/Object;)Z
|
||||
public static final fun requestUsersButton-XjXd-ic (Ldev/inmo/tgbotapi/utils/RowBuilder;Ljava/lang/String;SLjava/lang/Boolean;ILjava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;)Z
|
||||
public static synthetic fun requestUsersButton-XjXd-ic$default (Ldev/inmo/tgbotapi/utils/RowBuilder;Ljava/lang/String;SLjava/lang/Boolean;ILjava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;ILjava/lang/Object;)Z
|
||||
public static final fun requestUsersOrBotsButton-XjXd-ic (Ldev/inmo/tgbotapi/utils/RowBuilder;Ljava/lang/String;SLjava/lang/Boolean;ILjava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;)Z
|
||||
public static synthetic fun requestUsersOrBotsButton-XjXd-ic$default (Ldev/inmo/tgbotapi/utils/RowBuilder;Ljava/lang/String;SLjava/lang/Boolean;ILjava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;ILjava/lang/Object;)Z
|
||||
public static final fun simpleButton (Ldev/inmo/tgbotapi/utils/RowBuilder;Ljava/lang/String;)Z
|
||||
public static final fun webAppButton (Ldev/inmo/tgbotapi/utils/RowBuilder;Ljava/lang/String;Ldev/inmo/tgbotapi/types/webapps/WebAppInfo;)Z
|
||||
public static final fun webAppButton (Ldev/inmo/tgbotapi/utils/RowBuilder;Ljava/lang/String;Ljava/lang/String;)Z
|
||||
|
||||
@@ -158,10 +158,19 @@ inline fun ReplyKeyboardRowBuilder.requestUsersButton(
|
||||
inline fun ReplyKeyboardRowBuilder.requestBotsButton(
|
||||
text: String,
|
||||
requestId: RequestId,
|
||||
maxCount: Int = keyboardButtonRequestUserLimit.first
|
||||
maxCount: Int = keyboardButtonRequestUserLimit.first,
|
||||
requestName: Boolean? = null,
|
||||
requestUsername: Boolean? = null,
|
||||
requestPhoto: Boolean? = null,
|
||||
) = requestUsersButton(
|
||||
text,
|
||||
KeyboardButtonRequestUsers.Bot(requestId, maxCount)
|
||||
KeyboardButtonRequestUsers.Bot(
|
||||
requestId = requestId,
|
||||
maxCount = maxCount,
|
||||
requestName = requestName,
|
||||
requestUsername = requestUsername,
|
||||
requestPhoto = requestPhoto
|
||||
)
|
||||
)
|
||||
|
||||
/**
|
||||
@@ -172,11 +181,17 @@ inline fun ReplyKeyboardRowBuilder.requestBotsButton(
|
||||
*/
|
||||
inline fun ReplyKeyboardRowBuilder.requestBotButton(
|
||||
text: String,
|
||||
requestId: RequestId
|
||||
requestId: RequestId,
|
||||
requestName: Boolean? = null,
|
||||
requestUsername: Boolean? = null,
|
||||
requestPhoto: Boolean? = null,
|
||||
) = requestBotsButton(
|
||||
text,
|
||||
requestId,
|
||||
maxCount = keyboardButtonRequestUserLimit.first
|
||||
maxCount = keyboardButtonRequestUserLimit.first,
|
||||
requestName = requestName,
|
||||
requestUsername = requestUsername,
|
||||
requestPhoto = requestPhoto
|
||||
)
|
||||
|
||||
/**
|
||||
@@ -189,10 +204,20 @@ inline fun ReplyKeyboardRowBuilder.requestUsersButton(
|
||||
text: String,
|
||||
requestId: RequestId,
|
||||
premiumUser: Boolean? = null,
|
||||
maxCount: Int = keyboardButtonRequestUserLimit.first
|
||||
maxCount: Int = keyboardButtonRequestUserLimit.first,
|
||||
requestName: Boolean? = null,
|
||||
requestUsername: Boolean? = null,
|
||||
requestPhoto: Boolean? = null,
|
||||
) = requestUsersButton(
|
||||
text,
|
||||
KeyboardButtonRequestUsers.Common(requestId, premiumUser, maxCount)
|
||||
KeyboardButtonRequestUsers.Common(
|
||||
requestId = requestId,
|
||||
isPremium = premiumUser,
|
||||
maxCount = maxCount,
|
||||
requestName = requestName,
|
||||
requestUsername = requestUsername,
|
||||
requestPhoto = requestPhoto
|
||||
)
|
||||
)
|
||||
|
||||
/**
|
||||
@@ -204,8 +229,19 @@ inline fun ReplyKeyboardRowBuilder.requestUsersButton(
|
||||
inline fun ReplyKeyboardRowBuilder.requestUserButton(
|
||||
text: String,
|
||||
requestId: RequestId,
|
||||
premiumUser: Boolean? = null
|
||||
) = requestUsersButton(text, requestId, premiumUser, maxCount = keyboardButtonRequestUserLimit.first)
|
||||
premiumUser: Boolean? = null,
|
||||
requestName: Boolean? = null,
|
||||
requestUsername: Boolean? = null,
|
||||
requestPhoto: Boolean? = null,
|
||||
) = requestUsersButton(
|
||||
text = text,
|
||||
requestId = requestId,
|
||||
premiumUser = premiumUser,
|
||||
maxCount = keyboardButtonRequestUserLimit.first,
|
||||
requestName = requestName,
|
||||
requestUsername = requestUsername,
|
||||
requestPhoto = requestPhoto
|
||||
)
|
||||
|
||||
/**
|
||||
* Creates and put [RequestUserKeyboardButton] with [KeyboardButtonRequestUsers.Any]
|
||||
@@ -217,10 +253,20 @@ inline fun ReplyKeyboardRowBuilder.requestUsersOrBotsButton(
|
||||
text: String,
|
||||
requestId: RequestId,
|
||||
premiumUser: Boolean? = null,
|
||||
maxCount: Int = keyboardButtonRequestUserLimit.first
|
||||
maxCount: Int = keyboardButtonRequestUserLimit.first,
|
||||
requestName: Boolean? = null,
|
||||
requestUsername: Boolean? = null,
|
||||
requestPhoto: Boolean? = null,
|
||||
) = requestUsersButton(
|
||||
text,
|
||||
KeyboardButtonRequestUsers.Any(requestId, premiumUser, maxCount)
|
||||
KeyboardButtonRequestUsers.Any(
|
||||
requestId = requestId,
|
||||
isPremium = premiumUser,
|
||||
maxCount = maxCount,
|
||||
requestName = requestName,
|
||||
requestUsername = requestUsername,
|
||||
requestPhoto = requestPhoto
|
||||
)
|
||||
)
|
||||
|
||||
/**
|
||||
@@ -231,11 +277,17 @@ inline fun ReplyKeyboardRowBuilder.requestUsersOrBotsButton(
|
||||
*/
|
||||
inline fun ReplyKeyboardRowBuilder.requestUserOrBotButton(
|
||||
text: String,
|
||||
requestId: RequestId
|
||||
requestId: RequestId,
|
||||
requestName: Boolean? = null,
|
||||
requestUsername: Boolean? = null,
|
||||
requestPhoto: Boolean? = null,
|
||||
) = requestUsersOrBotsButton(
|
||||
text,
|
||||
requestId,
|
||||
maxCount = keyboardButtonRequestUserLimit.first
|
||||
text = text,
|
||||
requestId = requestId,
|
||||
maxCount = keyboardButtonRequestUserLimit.first,
|
||||
requestName = requestName,
|
||||
requestUsername = requestUsername,
|
||||
requestPhoto = requestPhoto,
|
||||
)
|
||||
|
||||
|
||||
@@ -270,7 +322,10 @@ inline fun ReplyKeyboardRowBuilder.requestChatButton(
|
||||
isOwnedBy: Boolean? = null,
|
||||
userRightsInChat: ChatCommonAdministratorRights? = null,
|
||||
botRightsInChat: ChatCommonAdministratorRights? = null,
|
||||
botIsMember: Boolean? = null
|
||||
botIsMember: Boolean? = null,
|
||||
requestTitle: Boolean? = null,
|
||||
requestUsername: Boolean? = null,
|
||||
requestPhoto: Boolean? = null,
|
||||
) = requestChatButton(
|
||||
text,
|
||||
KeyboardButtonRequestChat(
|
||||
@@ -281,7 +336,10 @@ inline fun ReplyKeyboardRowBuilder.requestChatButton(
|
||||
isOwnedBy = isOwnedBy,
|
||||
userRightsInChat = userRightsInChat,
|
||||
botRightsInChat = botRightsInChat,
|
||||
botIsMember = botIsMember
|
||||
botIsMember = botIsMember,
|
||||
requestTitle = requestTitle,
|
||||
requestUsername = requestUsername,
|
||||
requestPhoto = requestPhoto,
|
||||
)
|
||||
)
|
||||
|
||||
@@ -298,7 +356,10 @@ inline fun ReplyKeyboardRowBuilder.requestChannelButton(
|
||||
isOwnedBy: Boolean? = null,
|
||||
userRightsInChat: ChatCommonAdministratorRights? = null,
|
||||
botRightsInChat: ChatCommonAdministratorRights? = null,
|
||||
botIsMember: Boolean? = null
|
||||
botIsMember: Boolean? = null,
|
||||
requestTitle: Boolean? = null,
|
||||
requestUsername: Boolean? = null,
|
||||
requestPhoto: Boolean? = null,
|
||||
) = requestChatButton(
|
||||
text,
|
||||
KeyboardButtonRequestChat.Channel(
|
||||
@@ -307,7 +368,10 @@ inline fun ReplyKeyboardRowBuilder.requestChannelButton(
|
||||
isOwnedBy = isOwnedBy,
|
||||
userRightsInChat = userRightsInChat,
|
||||
botRightsInChat = botRightsInChat,
|
||||
botIsMember = botIsMember
|
||||
botIsMember = botIsMember,
|
||||
requestTitle = requestTitle,
|
||||
requestUsername = requestUsername,
|
||||
requestPhoto = requestPhoto,
|
||||
)
|
||||
)
|
||||
|
||||
@@ -325,7 +389,10 @@ inline fun ReplyKeyboardRowBuilder.requestGroupButton(
|
||||
isOwnedBy: Boolean? = null,
|
||||
userRightsInChat: ChatCommonAdministratorRights? = null,
|
||||
botRightsInChat: ChatCommonAdministratorRights? = null,
|
||||
botIsMember: Boolean? = null
|
||||
botIsMember: Boolean? = null,
|
||||
requestTitle: Boolean? = null,
|
||||
requestUsername: Boolean? = null,
|
||||
requestPhoto: Boolean? = null,
|
||||
) = requestChatButton(
|
||||
text,
|
||||
KeyboardButtonRequestChat.Group(
|
||||
@@ -335,6 +402,9 @@ inline fun ReplyKeyboardRowBuilder.requestGroupButton(
|
||||
isOwnedBy = isOwnedBy,
|
||||
userRightsInChat = userRightsInChat,
|
||||
botRightsInChat = botRightsInChat,
|
||||
botIsMember = botIsMember
|
||||
botIsMember = botIsMember,
|
||||
requestTitle = requestTitle,
|
||||
requestUsername = requestUsername,
|
||||
requestPhoto = requestPhoto,
|
||||
)
|
||||
)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package dev.inmo.tgbotapi.webapps
|
||||
|
||||
import dev.inmo.tgbotapi.utils.TelegramAPIUrlsKeeper
|
||||
import dev.inmo.tgbotapi.webapps.biometric.BiometricManager
|
||||
import dev.inmo.tgbotapi.webapps.cloud.CloudStorage
|
||||
import dev.inmo.tgbotapi.webapps.haptic.HapticFeedback
|
||||
import dev.inmo.tgbotapi.webapps.invoice.InvoiceClosedInfo
|
||||
@@ -54,6 +55,9 @@ external class WebApp {
|
||||
@JsName("CloudStorage")
|
||||
val cloudStorage: CloudStorage
|
||||
|
||||
@JsName("BiometricManager")
|
||||
val biometricManager: BiometricManager
|
||||
|
||||
@JsName("SettingsButton")
|
||||
val settingsButton: SettingsButton
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package dev.inmo.tgbotapi.webapps.biometric
|
||||
|
||||
import kotlinx.serialization.json.JsonPrimitive
|
||||
import kotlinx.serialization.json.buildJsonObject
|
||||
import kotlin.js.json
|
||||
|
||||
external interface BiometricAuthenticateParams {
|
||||
val reason: String?
|
||||
}
|
||||
|
||||
fun BiometricAuthenticateParams(
|
||||
reason: String? = null
|
||||
) = buildJsonObject {
|
||||
reason ?.let { put("reason", JsonPrimitive(it)) }
|
||||
}.unsafeCast<BiometricAuthenticateParams>()
|
||||
@@ -0,0 +1,51 @@
|
||||
package dev.inmo.tgbotapi.webapps.biometric
|
||||
|
||||
import kotlinx.coroutines.CompletableDeferred
|
||||
|
||||
external interface BiometricManager {
|
||||
val isInited: Boolean
|
||||
val isBiometricAvailable: Boolean
|
||||
val isAccessRequested: Boolean
|
||||
val isAccessGranted: Boolean
|
||||
val isBiometricTokenSaved: Boolean
|
||||
val deviceId: DeviceId?
|
||||
val biometricType: BiometricType
|
||||
|
||||
fun init(callback: (() -> Unit) = definedExternally): BiometricManager
|
||||
fun requestAccess(params: BiometricRequestAccessParams, callback: ((Boolean) -> Unit) = definedExternally): BiometricManager
|
||||
fun authenticate(params: BiometricAuthenticateParams, callback: ((Boolean, String?) -> Unit) = definedExternally): BiometricManager
|
||||
fun updateBiometricToken(token: String, callback: ((Boolean) -> Unit) = definedExternally): BiometricManager
|
||||
fun openSettings(): BiometricManager
|
||||
}
|
||||
|
||||
private suspend inline fun <T> doWithAsyncJob(
|
||||
action: (CompletableDeferred<T>) -> BiometricManager
|
||||
): T {
|
||||
val async = CompletableDeferred<T>()
|
||||
action(async)
|
||||
return async.await()
|
||||
}
|
||||
|
||||
suspend fun BiometricManager.initSuspend() = doWithAsyncJob {
|
||||
init {
|
||||
it.complete(Unit)
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun BiometricManager.requestAccessSuspend(params: BiometricRequestAccessParams) = doWithAsyncJob {
|
||||
requestAccess(params) { success ->
|
||||
it.complete(success)
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun BiometricManager.authenticateSuspend(params: BiometricAuthenticateParams) = doWithAsyncJob {
|
||||
authenticate(params) { _, token ->
|
||||
it.complete(token)
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun BiometricManager.updateBiometricTokenSuspend(token: String) = doWithAsyncJob {
|
||||
updateBiometricToken(token) { success ->
|
||||
it.complete(success)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package dev.inmo.tgbotapi.webapps.biometric
|
||||
|
||||
import kotlinx.serialization.json.JsonPrimitive
|
||||
import kotlinx.serialization.json.buildJsonObject
|
||||
import kotlin.js.json
|
||||
|
||||
external interface BiometricRequestAccessParams {
|
||||
val reason: String?
|
||||
}
|
||||
|
||||
fun BiometricRequestAccessParams(
|
||||
reason: String? = null
|
||||
) = buildJsonObject {
|
||||
reason ?.let { put("reason", JsonPrimitive(it)) }
|
||||
}.unsafeCast<BiometricRequestAccessParams>()
|
||||
@@ -0,0 +1,21 @@
|
||||
package dev.inmo.tgbotapi.webapps.biometric
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
value class BiometricType(
|
||||
val title: String
|
||||
) {
|
||||
val isFinger: Boolean
|
||||
get() = title == FingerTypeTitle
|
||||
val isFace: Boolean
|
||||
get() = title == FaceTypeTitle
|
||||
val isUnknown: Boolean
|
||||
get() = title == UnknownTypeTitle
|
||||
|
||||
companion object {
|
||||
const val FingerTypeTitle = "finger"
|
||||
const val FaceTypeTitle = "face"
|
||||
const val UnknownTypeTitle = "unknown"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package dev.inmo.tgbotapi.webapps.biometric
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
value class DeviceId(
|
||||
val string: String
|
||||
)
|
||||
Reference in New Issue
Block a user