🐛 Fixed 'end of array' error in CommandArgument helper
This commit is contained in:
parent
780d5d366d
commit
080ead560a
|
@ -1,9 +1,6 @@
|
||||||
package telegram
|
package telegram
|
||||||
|
|
||||||
import (
|
import "time"
|
||||||
"strings"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
func (msg *Message) IsCommand() bool {
|
func (msg *Message) IsCommand() bool {
|
||||||
if len(msg.Entities) <= 0 {
|
if len(msg.Entities) <= 0 {
|
||||||
|
@ -31,10 +28,13 @@ func (msg *Message) CommandArgument() string {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
return strings.TrimLeft(
|
argument := string([]rune(msg.Text)[msg.Entities[0].Length:])
|
||||||
string([]rune(msg.Text)[(msg.Entities[0].Length):]),
|
|
||||||
" ",
|
if argument != "" {
|
||||||
)
|
return argument[1:]
|
||||||
|
}
|
||||||
|
|
||||||
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func (msg *Message) HasArgument() bool {
|
func (msg *Message) HasArgument() bool {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user