huskies: merge 927
This commit is contained in:
@@ -37,6 +37,7 @@ pub fn mentions_bot(body: &str, formatted_body: Option<&str>, bot_user_id: &Owne
|
||||
}
|
||||
|
||||
/// Returns `true` if `haystack` contains `needle` at a word boundary.
|
||||
#[allow(clippy::string_slice)] // all indices from find() or abs+needle.len() → always char boundaries
|
||||
pub(super) fn contains_word(haystack: &str, needle: &str) -> bool {
|
||||
let mut start = 0;
|
||||
while let Some(rel) = haystack[start..].find(needle) {
|
||||
@@ -87,6 +88,7 @@ pub(super) async fn is_reply_to_bot(
|
||||
///
|
||||
/// Used in ambient mode to suppress responses when a message is clearly
|
||||
/// directed at a different participant (e.g. another bot in the same room).
|
||||
#[allow(clippy::string_slice)] // word_end and colon_pos from find() → always char boundaries
|
||||
pub fn is_addressed_to_other(body: &str, bot_user_id: &OwnedUserId, bot_name: &str) -> bool {
|
||||
let trimmed = body.trim_start();
|
||||
let lower = trimmed.to_lowercase();
|
||||
|
||||
Reference in New Issue
Block a user