update some typing stuff
This commit is contained in:
parent
d501905b3d
commit
fdd6ed2df7
1 changed files with 15 additions and 4 deletions
19
src/main.rs
19
src/main.rs
|
@ -17,6 +17,7 @@ use matrix_sdk::{
|
|||
|
||||
use std::{collections::HashMap, env, process::exit, sync::Arc, time::Duration};
|
||||
use url::Url;
|
||||
//use regex::Regex;
|
||||
|
||||
// {
|
||||
// "saidobj": {
|
||||
|
@ -46,6 +47,8 @@ struct CommandBot {
|
|||
client: Client,
|
||||
}
|
||||
|
||||
//let addr_re = Regex::new('');
|
||||
|
||||
impl CommandBot {
|
||||
pub fn new(client: Client) -> Self { Self { client } }
|
||||
|
||||
|
@ -55,15 +58,23 @@ impl CommandBot {
|
|||
// we clone here to hold the lock for as little time as possible.
|
||||
let room_id = room.room_id.clone();
|
||||
|
||||
if user_name.starts_with("_discord_") {
|
||||
return;
|
||||
}
|
||||
|
||||
println!("member_count: {}", member_count);
|
||||
|
||||
let myself = self.client.user_id().await.unwrap();
|
||||
let justus = (member_count == 2) || (message.starts_with(myself.localpart()));
|
||||
|
||||
let _ = self
|
||||
.client
|
||||
.typing_notice(&room_id, &myself, Typing::Yes(Duration::from_secs(4)))
|
||||
.await;
|
||||
let addressed = justus || message.starts_with("eval");
|
||||
|
||||
if addressed {
|
||||
let _ = self
|
||||
.client
|
||||
.typing_notice(&room_id, &myself, Typing::Yes(Duration::from_secs(4)))
|
||||
.await;
|
||||
}
|
||||
|
||||
let resp = reqwest::Client::new()
|
||||
.post("http://192.168.196.2:1092/request")
|
||||
|
|
Loading…
Add table
Reference in a new issue