fix the chatspam problem

This commit is contained in:
core 2023-07-21 23:43:04 -04:00
parent 35574fa76a
commit 48a1a69575
Signed by: core
GPG Key ID: FDBF740DADDCEECF
2 changed files with 5 additions and 5 deletions

View File

@ -278,11 +278,10 @@ async fn handle_packet(e: Event, config: &Config, client: &mut Client, ws_stream
Event::Init => {}
Event::Login => {}
Event::Chat(pkt) => {
if pkt.content().starts_with("/skill") {
return Ok(());
}
if !pkt.content().starts_with("/skill") {
info!("<{} ({})> {}", pkt.username().unwrap_or("SYSTEM".to_string()), pkt.uuid().map(|u| u.to_string()).unwrap_or("SYSTEM".to_string()), pkt.message());
handle_message(pkt.clone(), client, config).await;
}
let re = Regex::new(r"@[a-z0-9_-]+:").unwrap();
if !(re.is_match(&pkt.content()) && pkt.uuid() == Some(config.server.uuid)) {
@ -295,7 +294,7 @@ async fn handle_packet(e: Event, config: &Config, client: &mut Client, ws_stream
}})?)).await?;
}
handle_message(pkt.clone(), client, config).await;
/*

View File

@ -80,6 +80,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
return Err("Disconnected by server")?;
}
GatewayPacketS2C::Relayed { msg } => {
if msg.message.contains("/skill") { continue; } // fix chatspam problem
info!("msg: {:?}", msg);
if matches!(msg.source, Discord) { continue; }
for wh in &config.websockets {