Command() returns just command even when of form /command@bot_name

pull/40/head
Abhinav Dahiya 9 years ago
parent df7ef74346
commit 2740f76222
  1. 7
      types.go

@ -167,8 +167,13 @@ func (m *Message) Command() string {
if !m.IsCommand() { if !m.IsCommand() {
return "" 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, // CommandArguments checks if the message was a command and if it was,