Updated prefix and added help command
This commit is contained in:
+24
-2
@@ -1,10 +1,11 @@
|
||||
use serenity::framework::standard::macros::{command, group};
|
||||
use serenity::framework::standard::{Args, CommandResult};
|
||||
use serenity::framework::standard::{Args, CommandResult, HelpOptions, CommandGroup, help_commands};
|
||||
use serenity::framework::StandardFramework;
|
||||
use serenity::model::id::ChannelId;
|
||||
use serenity::model::prelude::{Message, UserId};
|
||||
use serenity::prelude::Context;
|
||||
use serenity::utils::MessageBuilder;
|
||||
use serenity::framework::standard::macros::help;
|
||||
|
||||
use crate::data::{GlobalData, MessageSource, Phase};
|
||||
use crate::helper;
|
||||
@@ -12,6 +13,7 @@ use crate::helper::{
|
||||
build_system_message, clear_game_state, get_phase_end_timestamp, print_game_status,
|
||||
save_game_state, send_msg_to_player_channels,
|
||||
};
|
||||
use std::collections::HashSet;
|
||||
|
||||
#[group]
|
||||
#[commands(start, say, end, broadcast, next_phase, terminate, add_time)]
|
||||
@@ -412,9 +414,29 @@ async fn players(ctx: &Context, msg: &Message, _args: Args) -> CommandResult {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[help]
|
||||
#[individual_command_tip = "If you want more information about a specific command, just pass the command as argument."]
|
||||
#[command_not_found_text = "Could not find: `{}`."]
|
||||
#[max_levenshtein_distance(3)]
|
||||
#[indention_prefix = "+"]
|
||||
#[lacking_role = "Nothing"]
|
||||
#[wrong_channel = "Strike"]
|
||||
async fn help(
|
||||
context: &Context,
|
||||
msg: &Message,
|
||||
args: Args,
|
||||
help_options: &'static HelpOptions,
|
||||
groups: &[&'static CommandGroup],
|
||||
owners: HashSet<UserId>,
|
||||
) -> CommandResult {
|
||||
let _ = help_commands::with_embeds(context, msg, args, help_options, groups, owners).await;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn command_framework() -> StandardFramework {
|
||||
StandardFramework::new()
|
||||
.configure(|c| c.prefix("!"))
|
||||
.configure(|c| c.prefix('$'))
|
||||
.group(&HOST_GROUP)
|
||||
.group(&PLAYER_GROUP)
|
||||
.help(&HELP)
|
||||
}
|
||||
|
||||
@@ -172,6 +172,8 @@ pub async fn add_user_to_game(
|
||||
.push_line("You will also use this terminal for choosing one of your fellow subjects for termination.")
|
||||
.push_line("Happy testing :)")
|
||||
.push_line("")
|
||||
.push_line("Do $help to see all commands.")
|
||||
.push_line("")
|
||||
.push("SUBJECT CODENAME: ")
|
||||
.push_line(&codename)
|
||||
.push(print_game_status(&global_data.game_state))
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ impl EventHandler for Handler {
|
||||
return;
|
||||
}
|
||||
|
||||
if msg.content.starts_with('!') {
|
||||
if msg.content.starts_with('$') {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user