sonicbot_matrix/essentials/on_event/
left.rs

1//use ruma::api::client::r0::sync::sync_events::*;
2use crate::{Instructions, instruction_generators::RoomTypeData, EventArgs};
3//use std::collections::BTreeMap;
4
5pub fn help() -> String {
6    String::from("Runs on all syncs that have left rooms states")
7}
8
9pub fn main(event_args: EventArgs) -> Vec<Instructions> {
10    let mut instructions: Vec<Instructions> = Vec::new();
11    if let RoomTypeData::Left(ref x) = event_args.room_data {
12        for (room_id, _left_room) in x.iter() {
13            instructions.push(Instructions::DelRoom(room_id.clone()))
14        }
15    }
16    instructions
17}