Add !pb help/!pacbot help command
This commit is contained in:
parent
258c6dbc9a
commit
ef4c01dfb3
|
@ -45,6 +45,18 @@ impl EventHandler for Handler {
|
|||
}
|
||||
}
|
||||
|
||||
fn help(ctx: Context, msg: Message, _args: Vec<&str>) {
|
||||
let command_triggers = COMMANDS
|
||||
.iter()
|
||||
.filter(|&c| !c.trigger.contains("help"))
|
||||
.map(|c| c.trigger.clone())
|
||||
.collect::<Vec<_>>()
|
||||
.join(", ");
|
||||
send(msg.channel_id,
|
||||
&format!("Usage: `<command> <search term>`\nSupported commands: `{}`\nSource code: https://git.kageru.moe/kageru/pacbot",
|
||||
command_triggers), &ctx)
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
static ref COMMANDS: Vec<Command> = {
|
||||
let mut command_list = Vec::new();
|
||||
|
@ -52,6 +64,8 @@ lazy_static! {
|
|||
command_list.push(Command::new("apt", apt::query_apt));
|
||||
command_list.push(Command::new("nix", nix::query_nix));
|
||||
command_list.push(Command::new("dnf", dnf::query_dnf));
|
||||
command_list.push(Command::new("pacbot help", help));
|
||||
command_list.push(Command::new("pb help", help));
|
||||
command_list
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user