panic in random times
ellofae opened this issue · comments
Sergei Bykovskiy commented
Hi, I keep getting sometimes a panic just in random times with the following message:
goroutine 1 [running]:
github.com/go-telegram-bot-api/telegram-bot-api/v5.(*Message).IsCommand(...)
/home/ellofae/go/pkg/mod/github.com/go-telegram-bot-api/telegram-bot-api/v5@v5.5.1/types.go:633
Here is the way I process updates:
updateConfig := tgbotapi.NewUpdate(0)
updateConfig.Timeout = 30
for update := range bot.GetUpdatesChan(updateConfig) {
if update.CallbackQuery != nil {
callbacks.ProcessCallbacks(bot, update)
} else if update.Message.IsCommand() {
commands.ProcessCommands(bot, update)
}
}
How can I solve the problem and what is the reason of it?
Sergei Bykovskiy commented
I don't know if the following code resolves the problem, but I think it is the solution. Correct me if I am wrong:
for update := range bot.GetUpdatesChan(updateConfig) {
if update.CallbackQuery != nil {
callbacks.ProcessCallbacks(bot, update)
} else if update.Message != nil {
if update.Message.IsCommand() {
commands.ProcessCommands(bot, update)
}
}
}