Minor bugfixes
parent
780538cbd1
commit
6a745cfd54
|
@ -15,3 +15,4 @@ credentials.ini
|
||||||
config.ini
|
config.ini
|
||||||
list.txt
|
list.txt
|
||||||
members_database/
|
members_database/
|
||||||
|
spam_tracking_database/
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
FROM debian:stable-slim
|
FROM debian:stable-slim
|
||||||
ARG package
|
ARG package
|
||||||
ADD $package ./
|
ADD $package ./
|
||||||
COPY list.txt .
|
|
||||||
RUN chmod +x matrix-modbot
|
RUN chmod +x matrix-modbot
|
||||||
RUN touch config.ini
|
RUN touch config.ini
|
||||||
CMD ["./matrix-modbot", "config.ini"]
|
CMD ["./matrix-modbot", "config.ini"]
|
||||||
HEALTHCHECK --interval=30s --timeout=30s --start-period=30s --retries=3 CMD curl --fail http://localhost:5000/health || exit 1
|
|
||||||
|
|
|
@ -318,7 +318,7 @@ pub mod bot {
|
||||||
|
|
||||||
data_vec.push(curr_utc);
|
data_vec.push(curr_utc);
|
||||||
|
|
||||||
if data_vec.len() > 5 && author_name != self.info.user_id {
|
if data_vec.len() > 3 && author_name != self.info.user_id {
|
||||||
self.delete_message_from_room(&event.event_id, "Spamming")
|
self.delete_message_from_room(&event.event_id, "Spamming")
|
||||||
.await;
|
.await;
|
||||||
self.update_reputation_for_member(&author, -1)
|
self.update_reputation_for_member(&author, -1)
|
||||||
|
|
|
@ -113,6 +113,7 @@ pub mod utils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
counter / msg_length >= 0.8
|
(counter / msg_length) >= 0.65
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use matrix_modbot::utils::utils::detect_caps;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_caps_detection() {
|
||||||
|
assert!(detect_caps("FULL CAPSSSSSS"));
|
||||||
|
assert!(!detect_caps("Not Full Caps But There Are Some Caps"));
|
||||||
|
assert!(detect_caps("CAPs BUT N0T FuLLY"));
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,6 +8,7 @@ mod tests {
|
||||||
let creds = BotUserInfo::get_info("tests/test_creds.ini").unwrap();
|
let creds = BotUserInfo::get_info("tests/test_creds.ini").unwrap();
|
||||||
let swear_list = create_swear_list(&creds.swear_list_url).await.unwrap();
|
let swear_list = create_swear_list(&creds.swear_list_url).await.unwrap();
|
||||||
assert!(detect_swear_from_message(&swear_list, "fuck you"));
|
assert!(detect_swear_from_message(&swear_list, "fuck you"));
|
||||||
|
assert!(detect_swear_from_message(&swear_list, "FUCK YOU IN CAPS"));
|
||||||
assert!(!detect_swear_from_message(
|
assert!(!detect_swear_from_message(
|
||||||
&swear_list,
|
&swear_list,
|
||||||
"This isn't a swear"
|
"This isn't a swear"
|
||||||
|
|
Loading…
Reference in New Issue