update some typing stuff

This commit is contained in:
Ryan Voots 2022-02-14 16:01:19 -05:00
parent d501905b3d
commit fdd6ed2df7

View file

@ -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 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")