From 2740f762225431798f0afbb98dee7631e9c48cf5 Mon Sep 17 00:00:00 2001 From: Abhinav Dahiya Date: Mon, 14 Mar 2016 15:32:39 +0530 Subject: [PATCH] Command() returns just command even when of form /command@bot_name --- types.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/types.go b/types.go index 5dce32c..c9b7a8f 100644 --- a/types.go +++ b/types.go @@ -167,8 +167,13 @@ func (m *Message) Command() string { if !m.IsCommand() { return "" } + command := strings.SplitN(m.Text, " ", 2)[0] - return strings.SplitN(m.Text, " ", 2)[0] + if i := strings.Index(command, "@"); i != -1 { + command = command[:i] + } + + return command } // CommandArguments checks if the message was a command and if it was,