1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-26 03:58:44 +00:00
This commit is contained in:
InsanusMokrassar 2022-07-11 00:57:13 +06:00
parent 26306f1567
commit 3d7334dd62
2 changed files with 8 additions and 1 deletions

View File

@ -7,6 +7,7 @@
* `API`: * `API`:
* For `copyMessage` order of parameters has been changed * For `copyMessage` order of parameters has been changed
* `Utils`: * `Utils`:
* New extension `Message#sameChat`
* New extension `Message#sameMessage` * New extension `Message#sameMessage`
## 2.1.3 ## 2.1.3

View File

@ -2,9 +2,15 @@ package dev.inmo.tgbotapi.extensions.utils.extensions
import dev.inmo.tgbotapi.types.message.abstracts.Message import dev.inmo.tgbotapi.types.message.abstracts.Message
/**
* @return true in case if [this] message is placed in the same chat that [other]
*/
@Suppress("NOTHING_TO_INLINE")
inline fun Message.sameChat(other: Message) = chat.id == other.chat.id
/** /**
* @return true in case if [this] message is the same as [other]. The same here means that these messages from one chat * @return true in case if [this] message is the same as [other]. The same here means that these messages from one chat
* and have equal [Message.messageId] identifier * and have equal [Message.messageId] identifier
*/ */
@Suppress("NOTHING_TO_INLINE") @Suppress("NOTHING_TO_INLINE")
inline fun Message.sameMessage(other: Message) = chat.id == other.chat.id && messageId == other.messageId inline fun Message.sameMessage(other: Message) = sameChat(other) && messageId == other.messageId