sonicbot_matrix/essentials/on_message/
list.rs1use crate::{Instructions, MessageArgs};
2
3pub fn main(message_args: MessageArgs) -> Vec<Instructions> {
4 let message_info = message_args.message_info;
5 let mut instructions: Vec<Instructions> = Vec::new();
6 instructions.push(Instructions::SendMessage(message_info.room_id, format!("{}: The following are my commands: {}. For help using them use the help command.", message_info.sender, get_command_list().join(", "))));
7 instructions
8}
9
10fn get_command_list() -> Vec<String> {
11 let mut command_list: Vec<String> = Vec::new();
12 for message_module in crate::essentials::on_message::get_essentials_on_message() {
13 command_list.push(message_module.name);
14 }
15 for message_module in crate::plugins::on_message::get_plugins_on_message() {
16 command_list.push(message_module.name);
17 }
18 command_list
19}
20
21pub fn help() -> String {
22 String::from("list\nLists all the commands")
23}