From 0009d211bc8049322cef6727c4e9e8178df59a5f Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Mon, 18 Feb 2019 12:53:01 +0800 Subject: [PATCH] fix "equals" of Ysername --- .../TelegramBotAPI/types/ChatIdentifier.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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 36c74899cd..176f3292d3 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatIdentifier.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatIdentifier.kt @@ -29,9 +29,10 @@ data class Username( } override fun equals(other: Any?): Boolean { - return super.equals(other) || other ?.let { - super.equals("@$it") - } ?: false + return super.equals(other) || when (other) { + is String -> super.equals("@$other") + else -> false + } } }