1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2026-09-26 11:54:37 +00:00

Add EphemeralChatId and identifier-sourced ephemeral defaults

New EphemeralChatId inheritor of IdChatIdentifier carrying receiverUser and
ephemeralMessageId (mirroring ChatIdWithThreadId), with ChatIdentifier.receiverUser/
ephemeralMessageId extensions like ChatIdentifier.threadId. Every send/reply/edit/
delete method that takes receiverUserId/ephemeralMessageId now defaults them from
the chat identifier, so passing an EphemeralChatId auto-fills them the same way a
ChatIdWithThreadId fills threadId.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-20 12:05:18 +06:00
parent bc52be7b40
commit a1d2ebb4dc
48 changed files with 560 additions and 388 deletions

View File

@@ -1439,6 +1439,8 @@ public final class dev/inmo/tgbotapi/extensions/utils/ClassCastsNewKt {
public static final fun encryptedPassportElementWithTranslatableIDDocumentOrThrow (Ldev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElement;)Ldev/inmo/tgbotapi/types/passport/encrypted/EncryptedPassportElementWithTranslatableIDDocument;
public static final fun encryptedPersonalDetailsOrNull (Ldev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElement;)Ldev/inmo/tgbotapi/types/passport/encrypted/EncryptedPersonalDetails;
public static final fun encryptedPersonalDetailsOrThrow (Ldev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElement;)Ldev/inmo/tgbotapi/types/passport/encrypted/EncryptedPersonalDetails;
public static final fun ephemeralChatIdOrNull (Ldev/inmo/tgbotapi/types/ChatIdentifier;)Lkotlin/Triple;
public static final fun ephemeralChatIdOrThrow (Ldev/inmo/tgbotapi/types/ChatIdentifier;)Lkotlin/Triple;
public static final fun exactScheduledCloseInfoOrNull (Ldev/inmo/tgbotapi/types/polls/ScheduledCloseInfo;)Ldev/inmo/tgbotapi/types/polls/ExactScheduledCloseInfo;
public static final fun exactScheduledCloseInfoOrThrow (Ldev/inmo/tgbotapi/types/polls/ScheduledCloseInfo;)Ldev/inmo/tgbotapi/types/polls/ExactScheduledCloseInfo;
public static final fun expandableBlockquoteTextSourceOrNull (Ldev/inmo/tgbotapi/types/message/textsources/TextSource;)Ldev/inmo/tgbotapi/types/message/textsources/ExpandableBlockquoteTextSource;
@@ -1794,6 +1796,7 @@ public final class dev/inmo/tgbotapi/extensions/utils/ClassCastsNewKt {
public static final fun ifEncryptedPassportElementWithTranslatableFilesCollection (Ldev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElement;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifEncryptedPassportElementWithTranslatableIDDocument (Ldev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElement;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifEncryptedPersonalDetails (Ldev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElement;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifEphemeralChatId (Ldev/inmo/tgbotapi/types/ChatIdentifier;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifExactScheduledCloseInfo (Ldev/inmo/tgbotapi/types/polls/ScheduledCloseInfo;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifExpandableBlockquoteTextSource (Ldev/inmo/tgbotapi/types/message/textsources/TextSource;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifExtendedBot (Ldev/inmo/tgbotapi/types/chat/Chat;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;

View File

@@ -43,6 +43,7 @@ import dev.inmo.tgbotapi.types.ChatInviteLinkUnlimited
import dev.inmo.tgbotapi.types.ChatInviteLinkWithJoinRequest
import dev.inmo.tgbotapi.types.ChatInviteLinkWithLimitedMembers
import dev.inmo.tgbotapi.types.DirectMessagesConfigurationChanged
import dev.inmo.tgbotapi.types.EphemeralChatId
import dev.inmo.tgbotapi.types.IdChatIdentifier
import dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult.BaseChosenInlineResult
import dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult.ChosenInlineResult
@@ -3126,6 +3127,12 @@ public inline fun ChatIdentifier.businessChatIdOrThrow(): BusinessChatId = this
public inline fun <T> ChatIdentifier.ifBusinessChatId(block: (BusinessChatId) -> T): T? = businessChatIdOrNull() ?.let(block)
public inline fun ChatIdentifier.ephemeralChatIdOrNull(): EphemeralChatId? = this as? dev.inmo.tgbotapi.types.EphemeralChatId
public inline fun ChatIdentifier.ephemeralChatIdOrThrow(): EphemeralChatId = this as dev.inmo.tgbotapi.types.EphemeralChatId
public inline fun <T> ChatIdentifier.ifEphemeralChatId(block: (EphemeralChatId) -> T): T? = ephemeralChatIdOrNull() ?.let(block)
public inline fun ChatIdentifier.usernameOrNull(): Username? = this as? dev.inmo.tgbotapi.types.Username
public inline fun ChatIdentifier.usernameOrThrow(): Username = this as dev.inmo.tgbotapi.types.Username