mirror of
https://github.com/flibusta-apps/book_bot.git
synced 2025-12-08 09:30:45 +01:00
Add helper to skip redundant message edits
This commit is contained in:
18
src/bots/approved_bot/modules/utils/message_text.rs
Normal file
18
src/bots/approved_bot/modules/utils/message_text.rs
Normal file
@@ -0,0 +1,18 @@
|
||||
use teloxide::types::*;
|
||||
|
||||
pub fn is_message_text_equals(message: Option<MaybeInaccessibleMessage>, text: &str) -> bool {
|
||||
let message = match message {
|
||||
Some(v) => v,
|
||||
None => return false,
|
||||
};
|
||||
|
||||
let message = match message {
|
||||
MaybeInaccessibleMessage::Inaccessible(_) => return false,
|
||||
MaybeInaccessibleMessage::Regular(v) => v,
|
||||
};
|
||||
|
||||
match message.text() {
|
||||
Some(msg_text) => text == msg_text,
|
||||
None => false,
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
pub mod errors;
|
||||
pub mod filter_command;
|
||||
pub mod message_text;
|
||||
pub mod pagination;
|
||||
pub mod split_text;
|
||||
|
||||
Reference in New Issue
Block a user