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 22f3ccd72f
commit 5ead7e570c
No known key found for this signature in database
GPG Key ID: 2DB18BA2E0A80BC3
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 // set bot's status to input text
#[command] #[command]
#[checks(Owner)] #[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; use serenity::model::gateway::Activity;
if args.is_empty() { if args.is_empty() {
@ -252,6 +252,7 @@ fn status(ctx: &mut Context, _message: &Message, mut args: Args) -> CommandResul
let status = OnlineStatus::Online; let status = OnlineStatus::Online;
ctx.set_presence(Some(activity), status); ctx.set_presence(Some(activity), status);
let _ = message.react(&ctx.http, "💜");
Ok(()) Ok(())
} }
@ -662,7 +663,7 @@ fn define(ctx: &mut Context, message: &Message, args: Args) -> CommandResult {
if !args.is_empty() { if !args.is_empty() {
match defs { match defs {
Err(_e) => { Err(_e) => {
let _ = message.channel_id.say(&ctx.http, "Invalid query >w<"); return Err(CommandError("Invalid query >w<".to_string()));
} }
Ok(v) => { Ok(v) => {
if !v.is_empty() { if !v.is_empty() {
@ -679,7 +680,7 @@ fn define(ctx: &mut Context, message: &Message, args: Args) -> CommandResult {
}) })
}); });
} else { } else {
let _ = message.channel_id.say(&ctx.http, "No results!"); return Err(CommandError("No results!".to_string()));
} }
} }
} }