src/commands/mod.rs

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

25 lines · 513 bytes

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