From bdd1b9638a08f385224d66db59cfebd7031c847e Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sun, 2 Jun 2019 22:59:24 +0800 Subject: [PATCH] toChatId extensions adding --- CHANGELOG.md | 1 + .../insanusmokrassar/TelegramBotAPI/types/ChatIdentifier.kt | 2 ++ 2 files changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 399724d00a..3174454390 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ * `SwitchInlineQueryCurrentChatInlineKeyboardButton#switchInlineQueryCurrentChat` field fixed * `InlineKeyboardButton` now is sealed class and all its possible realisations are inside of its class file * `String#asUsername` method renamed to `String#toUsername` +* Several `toChatId` extensions added ## 0.15.0 diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatIdentifier.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatIdentifier.kt index 7877fe3fcd..c1d5928304 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatIdentifier.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatIdentifier.kt @@ -20,6 +20,8 @@ val ChatId.link: String typealias UserId = ChatId fun Identifier.toChatId(): ChatId = ChatId(this) +fun Int.toChatId(): ChatId = toLong().toChatId() +fun Byte.toChatId(): ChatId = toLong().toChatId() @Serializable(ChatIdentifierSerializer::class) data class Username(