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