🚑 Fixed panic by loop in command argument helpers
This commit is contained in:
parent
2dc679a0a1
commit
3eb4ddaed9
|
@ -1,6 +1,9 @@
|
|||
package telegram
|
||||
|
||||
import "time"
|
||||
import (
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
func (msg *Message) IsCommand() bool {
|
||||
if len(msg.Entities) <= 0 {
|
||||
|
@ -28,11 +31,10 @@ func (msg *Message) CommandArgument() string {
|
|||
return ""
|
||||
}
|
||||
|
||||
if !msg.HasArgument() {
|
||||
return ""
|
||||
}
|
||||
|
||||
return string([]rune(msg.Text)[(msg.Entities[0].Length + 1):])
|
||||
return strings.TrimLeft(
|
||||
string([]rune(msg.Text)[(msg.Entities[0].Length):]),
|
||||
" ",
|
||||
)
|
||||
}
|
||||
|
||||
func (msg *Message) HasArgument() bool {
|
||||
|
|
Loading…
Reference in New Issue
Block a user