You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
for update := range updates {
if update.Message != nil {
text := update.Message.Text
chatID := update.Message.Chat.ID
if text == "/start" re.MatchString(text) text == "cancel" {
match := re.FindStringSubmatch(text)
referrerID, _ := strconv.Atoi(match[1])
refral.StartHandler(bot, update, referrerID)
and ....
2024/08/03 11:33:54 Endpoint: getUpdates, params: map[allowed_updates:null offset:489227412 timeout:60]
**panic: runtime error: index out of range [1] with length 0
goroutine 1 [running]:
main.main()
C:/Users/Afra/Desktop/main.go:39 +0x868
exit status 2**
How fix that and why it happend ?
The text was updated successfully, but these errors were encountered:
Without seeing the whole code it's a bit hard to say but here:
referrerID, _ := strconv.Atoi(match[1])
and on error **panic: runtime error: index out of range [1] with length 0
=> you are trying to access slice index 1 which doesn't exist. Actually length of that slice is 0.
for update := range updates {
if update.Message != nil {
text := update.Message.Text
chatID := update.Message.Chat.ID
if text == "/start" re.MatchString(text) text == "cancel" {
match := re.FindStringSubmatch(text)
referrerID, _ := strconv.Atoi(match[1])
refral.StartHandler(bot, update, referrerID)
and ....
2024/08/03 11:33:54 Endpoint: getUpdates, params: map[allowed_updates:null offset:489227412 timeout:60]
**panic: runtime error: index out of range [1] with length 0
goroutine 1 [running]:
main.main()
C:/Users/Afra/Desktop/main.go:39 +0x868
exit status 2**
How fix that and why it happend ?
The text was updated successfully, but these errors were encountered: