Add reaction on status update success, update old error handling

This commit is contained in:
Agatha Lovelace 2020-06-13 23:18:33 +03:00
parent b95341a768
commit fbd303a9f0
1 changed files with 4 additions and 3 deletions

View File

@ -226,7 +226,7 @@ fn halt(ctx: &mut Context) -> CommandResult {
// set bot's status to input text
#[command]
#[checks(Owner)]
fn status(ctx: &mut Context, _message: &Message, mut args: Args) -> CommandResult {
fn status(ctx: &mut Context, message: &Message, mut args: Args) -> CommandResult {
use serenity::model::gateway::Activity;
if args.is_empty() {
@ -252,6 +252,7 @@ fn status(ctx: &mut Context, _message: &Message, mut args: Args) -> CommandResul
let status = OnlineStatus::Online;
ctx.set_presence(Some(activity), status);
let _ = message.react(&ctx.http, "💜");
Ok(())
}
@ -662,7 +663,7 @@ fn define(ctx: &mut Context, message: &Message, args: Args) -> CommandResult {
if !args.is_empty() {
match defs {
Err(_e) => {
let _ = message.channel_id.say(&ctx.http, "Invalid query >w<");
return Err(CommandError("Invalid query >w<".to_string()));
}
Ok(v) => {
if !v.is_empty() {
@ -679,7 +680,7 @@ fn define(ctx: &mut Context, message: &Message, args: Args) -> CommandResult {
})
});
} else {
let _ = message.channel_id.say(&ctx.http, "No results!");
return Err(CommandError("No results!".to_string()));
}
}
}