Don't return slash in Command, strip bot name if needed.
This commit is contained in:
parent
5df7aae78f
commit
b7c9b50020
2 changed files with 18 additions and 2 deletions
|
@ -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" {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue