Add allowed rooms
This commit is contained in:
parent
7c16eaec98
commit
c0472b53e4
1 changed files with 4 additions and 10 deletions
14
src/main.rs
14
src/main.rs
|
@ -214,7 +214,7 @@ async fn on_room_message(event: OriginalSyncRoomMessageEvent, room: Room) {
|
||||||
room.send(reaction, None).await.unwrap();
|
room.send(reaction, None).await.unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
if {let mut rng = rand::thread_rng(); rng.gen_range(0..2)} == 0 {
|
if {let mut rng = rand::thread_rng(); rng.gen_range(0..3)} == 0 {
|
||||||
let msg = text_content.body
|
let msg = text_content.body
|
||||||
.split_whitespace()
|
.split_whitespace()
|
||||||
.map(|x| schmfy(String::from(x.to_lowercase())))
|
.map(|x| schmfy(String::from(x.to_lowercase())))
|
||||||
|
@ -231,15 +231,8 @@ async fn on_room_message(event: OriginalSyncRoomMessageEvent, room: Room) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_allowed_user(user: &str) -> bool {
|
fn is_allowed_user(user: &str) -> bool {
|
||||||
println!("User: {}, bool: {}", user, !(
|
|
||||||
user.contains("bot_jonathan")
|
|
||||||
|| user.contains("bot_jan")
|
|
||||||
|| user.contains("bot_")
|
|
||||||
));
|
|
||||||
return !(
|
return !(
|
||||||
user.contains("bot_jonathan")
|
user.contains("bot_")
|
||||||
|| user.contains("bot_jan")
|
|
||||||
|| user.contains("bot_")
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,7 +246,8 @@ fn is_allowed_room(name: Option<String>) -> bool {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if room_name.to_lowercase().contains("spam") {
|
if room_name.to_lowercase().contains("spam")
|
||||||
|
|| room_name.to_lowercase().contains("bot") {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue