From 696219df242389b5d9466e7d48baa593dbcc9f8e Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sun, 8 Dec 2024 12:51:16 +0600 Subject: [PATCH] add api methods for setUserEmojiStatus --- tgbotapi.api/api/tgbotapi.api.api | 13 ++++- .../api/send/payments/CreateInvoiceLink.kt | 2 - .../extensions/api/set/SetUserEmojiStatus.kt | 50 +++++++++++++++++++ .../inmo/tgbotapi/requests/gifts/SendGift.kt | 2 +- 4 files changed, 62 insertions(+), 5 deletions(-) create mode 100644 tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/set/SetUserEmojiStatus.kt diff --git a/tgbotapi.api/api/tgbotapi.api.api b/tgbotapi.api/api/tgbotapi.api.api index 0eaede4382d..411a87a9ed5 100644 --- a/tgbotapi.api/api/tgbotapi.api.api +++ b/tgbotapi.api/api/tgbotapi.api.api @@ -2151,10 +2151,10 @@ public final class dev/inmo/tgbotapi/extensions/api/send/media/SendVoiceKt { } public final class dev/inmo/tgbotapi/extensions/api/send/payments/CreateInvoiceLinkKt { + public static final fun createInvoiceLink (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/util/List;Ljava/lang/Integer;Ljava/util/List;Ljava/lang/String;ZZZZZZZLkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun createInvoiceLink$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/util/List;Ljava/lang/Integer;Ljava/util/List;Ljava/lang/String;ZZZZZZZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; public static final fun createInvoiceLink-1vVIECE (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/util/List;Ljava/lang/String;Lkotlin/time/Duration;Ljava/lang/Integer;Ljava/util/List;Ljava/lang/String;ZZZZZZZLkotlin/coroutines/Continuation;)Ljava/lang/Object; public static synthetic fun createInvoiceLink-1vVIECE$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/util/List;Ljava/lang/String;Lkotlin/time/Duration;Ljava/lang/Integer;Ljava/util/List;Ljava/lang/String;ZZZZZZZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; - public static final fun createInvoiceLink-B82mBWQ (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/util/List;Ljava/lang/String;Ljava/lang/Integer;Ljava/util/List;Ljava/lang/String;ZZZZZZZLkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static synthetic fun createInvoiceLink-B82mBWQ$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/util/List;Ljava/lang/String;Ljava/lang/Integer;Ljava/util/List;Ljava/lang/String;ZZZZZZZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; } public final class dev/inmo/tgbotapi/extensions/api/send/payments/RefundStarPaymentKt { @@ -2203,6 +2203,15 @@ public final class dev/inmo/tgbotapi/extensions/api/send/polls/SendRegularPollKt public static synthetic fun sendRegularPoll-smr50Sk$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/ChatIdentifier;Ljava/util/List;Ljava/util/List;Ldev/inmo/tgbotapi/types/polls/ScheduledCloseInfo;ZZZLdev/inmo/tgbotapi/types/MessageThreadId;Ljava/lang/String;ZZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; } +public final class dev/inmo/tgbotapi/extensions/api/set/SetUserEmojiStatusKt { + public static final fun setUserEmojiStatus-8OHYyMQ (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLjava/lang/String;DLkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static final fun setUserEmojiStatus-OZgzbMQ (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/User;Ljava/lang/String;DLkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static final fun setUserEmojiStatus-SrqJ0BM (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/User;Ljava/lang/String;Ldev/inmo/tgbotapi/types/TelegramDate;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun setUserEmojiStatus-SrqJ0BM$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/User;Ljava/lang/String;Ldev/inmo/tgbotapi/types/TelegramDate;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public static final fun setUserEmojiStatus-bic5Y5o (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLjava/lang/String;Ldev/inmo/tgbotapi/types/TelegramDate;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun setUserEmojiStatus-bic5Y5o$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLjava/lang/String;Ldev/inmo/tgbotapi/types/TelegramDate;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; +} + 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;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; diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/payments/CreateInvoiceLink.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/payments/CreateInvoiceLink.kt index 911497aa920..6aaa6b1fe0e 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/payments/CreateInvoiceLink.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/payments/CreateInvoiceLink.kt @@ -15,7 +15,6 @@ public suspend fun TelegramBot.createInvoiceLink( providerToken: String, currency: Currency, prices: List, - businessConnectionId: BusinessConnectionId? = null, maxTipAmount: Int? = null, suggestedTipAmounts: List? = null, providerData: String? = null, @@ -33,7 +32,6 @@ public suspend fun TelegramBot.createInvoiceLink( payload = payload, providerToken = providerToken, currency = currency, - businessConnectionId = businessConnectionId, prices = prices, subscriptionPeriod = null, maxTipAmount = maxTipAmount, diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/set/SetUserEmojiStatus.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/set/SetUserEmojiStatus.kt new file mode 100644 index 00000000000..bc507bdbed1 --- /dev/null +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/set/SetUserEmojiStatus.kt @@ -0,0 +1,50 @@ +package dev.inmo.tgbotapi.extensions.api.set + +import dev.inmo.tgbotapi.bot.TelegramBot +import dev.inmo.tgbotapi.requests.set.SetUserEmojiStatus +import dev.inmo.tgbotapi.types.* +import dev.inmo.tgbotapi.types.chat.User +import korlibs.time.DateTime + +public suspend fun TelegramBot.setUserEmojiStatus( + userId: UserId, + customEmojiId: CustomEmojiId, + expirationDate: TelegramDate? = null +): Boolean = execute( + SetUserEmojiStatus( + userId = userId, + customEmojiId = customEmojiId, + expirationDate = expirationDate + ) +) + +public suspend fun TelegramBot.setUserEmojiStatus( + user: User, + customEmojiId: CustomEmojiId, + expirationDate: TelegramDate? = null +): Boolean = setUserEmojiStatus( + user.id, + customEmojiId, + expirationDate +) + + +public suspend fun TelegramBot.setUserEmojiStatus( + userId: UserId, + customEmojiId: CustomEmojiId, + expirationDate: DateTime +): Boolean = setUserEmojiStatus( + userId, + customEmojiId, + expirationDate.toTelegramDate() +) + +public suspend fun TelegramBot.setUserEmojiStatus( + user: User, + customEmojiId: CustomEmojiId, + expirationDate: DateTime +): Boolean = setUserEmojiStatus( + user.id, + customEmojiId, + expirationDate +) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/gifts/SendGift.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/gifts/SendGift.kt index 5f5369e3bd4..b411fd8c0c1 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/gifts/SendGift.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/gifts/SendGift.kt @@ -26,7 +26,7 @@ data class SendGift internal constructor( override val text: String, @SerialName(textParseModeField) override val parseMode: ParseMode?, - @SerialName(entitiesField) + @SerialName(textEntitiesField) private val rawEntities: List? = null, ) : SimpleRequest, TextedOutput { override val textSources: TextSourcesList? by lazy {