diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f49c340c2..bef1bacfa6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ * For `CopyMessage` order of parameters has been changed * `API`: * For `copyMessage` order of parameters has been changed +* `Utils`: + * New extension `Message#sameMessage` ## 2.1.3 diff --git a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/extensions/SameMessage.kt b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/extensions/SameMessage.kt new file mode 100644 index 0000000000..1c1d0c916c --- /dev/null +++ b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/extensions/SameMessage.kt @@ -0,0 +1,10 @@ +package dev.inmo.tgbotapi.extensions.utils.extensions + +import dev.inmo.tgbotapi.types.message.abstracts.Message + +/** + * @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 + */ +@Suppress("NOTHING_TO_INLINE") +inline fun Message.sameMessage(other: Message) = chat.id == other.chat.id && messageId == other.messageId