2022-06-04 11:58:21 +00:00
|
|
|
use async_trait::async_trait;
|
|
|
|
|
2022-06-05 14:08:13 +00:00
|
|
|
use crate::{
|
|
|
|
plugins::{Command, CommandManagerType},
|
|
|
|
tcp::Client,
|
|
|
|
};
|
2022-06-04 11:58:21 +00:00
|
|
|
|
|
|
|
pub struct CommandHelp;
|
|
|
|
|
|
|
|
#[async_trait]
|
|
|
|
impl Command for CommandHelp {
|
|
|
|
fn name(&self) -> &'static str {
|
|
|
|
"/help"
|
|
|
|
}
|
|
|
|
|
|
|
|
fn help(&self) -> &'static str {
|
|
|
|
"show help"
|
|
|
|
}
|
|
|
|
|
2022-06-05 14:08:13 +00:00
|
|
|
async fn execute(
|
|
|
|
&self,
|
|
|
|
client: &mut Client,
|
|
|
|
_args: Vec<&str>,
|
|
|
|
command_manager: &CommandManagerType,
|
|
|
|
) {
|
|
|
|
for command in command_manager.commands.iter() {
|
2022-06-04 11:58:21 +00:00
|
|
|
client
|
|
|
|
.send(&format!("{} - {}", command.name(), command.help()))
|
|
|
|
.expect("send message");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|