Don't return slash in Command, strip bot name if needed.

This commit is contained in:
Syfaro 2016-01-04 11:45:46 -06:00
parent 5df7aae78f
commit b7c9b50020
2 changed files with 18 additions and 2 deletions

View file

@ -58,7 +58,7 @@ func TestIsCommandWithEmptyText(t *testing.T) {
func TestCommandWithCommand(t *testing.T) {
message := tgbotapi.Message{Text: "/command"}
if message.Command() != "/command" {
if message.Command() != "command" {
t.Fail()
}
}
@ -79,6 +79,14 @@ func TestCommandWithNonCommand(t *testing.T) {
}
}
func TestCommandWithBotName(t *testing.T) {
message := tgbotapi.Message{Text: "/command@testbot"}
if message.Command() != "command" {
t.Fail()
}
}
func TestMessageCommandArgumentsWithArguments(t *testing.T) {
message := tgbotapi.Message{Text: "/command with arguments"}
if message.CommandArguments() != "with arguments" {