From 98e8481ab894d7fc27b81617331650dc5362c37a Mon Sep 17 00:00:00 2001 From: Agatha Date: Thu, 2 Apr 2020 19:13:35 +0300 Subject: [PATCH] Fix headpat command mentions --- src/main.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index a26db34..fc44aa2 100755 --- a/src/main.rs +++ b/src/main.rs @@ -362,9 +362,15 @@ fn ship(ctx: &mut Context, message: &Message, args: Args) -> CommandResult { #[command] fn headpat(ctx: &mut Context, message: &Message, args: Args) -> CommandResult { + let name = match message.mentions.len() { + 0 => args.rest().trim(), + _ => message.mentions[0].name.as_str() + }; + + if let Err(e) = message.channel_id.send_message(&ctx.http, |m| { m.embed(|e| { - e.title(format!("Sending headpats to **{}**...", args.rest().trim())) + e.title(format!("Sending headpats to **{}**...", name)) .image( "https://i.pinimg.com/originals/83/1a/90/831a903eab6d827dcfd298b9e3196e30.jpg", )