A very wonderful repository! I use it for home purposes, I am very satisfied.
// If no authorized users are provided, make the bot public
if len(config.AuthorizedUserIds) > 0 {
if !util.IsIdInList(update.Message.From.ID, config.AuthorizedUserIds) {
if update.Message.Chat.Type == "private" {
bot.Reply(chat.ChatID, update.Message.MessageID, "Sorry, you do not have access to this bot.", false)
log.Printf("Unauthorized access attempt by user %d: %s %s (%s)", update.Message.From.ID, update.Message.From.FirstName, update.Message.From.LastName, update.Message.From.UserName)
// Notify the admin
if config.AdminId > 0 {
adminMessage := fmt.Sprintf("Unauthorized access attempt by user %d: %s %s (%s)", update.Message.From.ID, update.Message.From.FirstName, update.Message.From.LastName, update.Message.From.UserName)
bot.Message(adminMessage, config.AdminId, false)
}
}
continue
}
}
The application crashes when an unauthorized user writes.
I change, and all ok:
bot.Reply(chat.ChatID, update.Message.MessageID, "Sorry, you do not have access to this bot.", false)bot.Reply(chatID, update.Message.MessageID, "Sorry, you do not have access to this bot.", false)
A very wonderful repository! I use it for home purposes, I am very satisfied.
The application crashes when an unauthorized user writes. I change, and all ok:
bot.Reply(chat.ChatID, update.Message.MessageID, "Sorry, you do not have access to this bot.", false)
bot.Reply(chatID, update.Message.MessageID, "Sorry, you do not have access to this bot.", false)