Add echo command

This commit is contained in:
Agatha Rose 2020-05-04 22:38:48 +03:00
parent 836542d317
commit 01afc915a8
1 changed files with 15 additions and 7 deletions

View File

@ -50,7 +50,7 @@ impl EventHandler for Handler {
#[group]
#[commands(
init, ping, halt, list_srv, host, ship, bottom_rng, headpat, uwu, gayculator, sausage, help,
embed, define, owo, info
embed, define, owo, info, echo
)]
struct General;
@ -171,6 +171,20 @@ fn ping(ctx: &mut Context, message: &Message) -> CommandResult {
Ok(())
}
#[command]
#[checks(Owner)]
fn echo(ctx: &mut Context, message: &Message, args: Args) -> CommandResult {
let input: String = args.rest().trim().to_string();
if args.is_empty() {
let _ = message.channel_id.say(&ctx.http, "Error: called without input!");
return Err(CommandError("Called without input".to_string()));
}
let _ = message.channel_id.say(&ctx.http, input);
Ok(())
}
#[command]
#[checks(Owner)]
fn halt(ctx: &mut Context) -> CommandResult {
@ -495,15 +509,9 @@ fn help(ctx: &mut Context, message: &Message) -> CommandResult {
.fields(vec![
("owo init", "Introduce me", false),
("owo ping", "Pong", false),
/*("owo waffle", "stroopwafel owo", false),*/
("owo sausage", "sosig", false),
("owo help", "Help the fellow humanz!", false),
("owo info", "Show information about me!", false),
/*(
"owo compare_bot ``bot's name``",
"Compare me to other robots!",
false,
), */
(
"owo what's this ``word``",
"Find a definition of word",