src/commands/mod.rs

78f0d09198d6950e8d50205bd4ac92ab5a5a0bec
weechat-matrix-rs/src/commands/mod.rs history · blame · raw

29 lines · 616 bytes

 1use crate::{config::ConfigHandle, Servers};
 2use weechat::hooks::Command;
 3
 4mod devices;
 5mod keys;
 6mod matrix;
 7
 8use devices::DevicesCommand;
 9use keys::KeysCommand;
10use matrix::MatrixCommand;
11
12pub struct Commands {
13    _matrix: Command,
14    _keys: Command,
15    _devices: Command,
16}
17
18impl Commands {
19    pub fn hook_all(
20        servers: &Servers,
21        config: &ConfigHandle,
22    ) -> Result<Commands, ()> {
23        Ok(Commands {
24            _matrix: MatrixCommand::create(servers, config)?,
25            _devices: DevicesCommand::create(servers)?,
26            _keys: KeysCommand::create(servers)?,
27        })
28    }
29}