Skip to content

Commit

Permalink
[core]: fix
Browse files Browse the repository at this point in the history
  • Loading branch information
vkopitsa committed Jul 24, 2019
1 parent 1ac7590 commit f699b3e
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion bot.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,29 @@ func (b *bot) TelegramStart() {

for update := range updates {

log.Printf("[telegram] dfsdf")
var fromID int
var chatID int64
if update.Message != nil {
fromID = update.Message.From.ID
chatID = update.Message.Chat.ID
} else {
fromID = update.CallbackQuery.Message.ReplyToMessage.From.ID
chatID = update.CallbackQuery.Message.ReplyToMessage.Chat.ID
}

if !(b.isAdmin(fromID) || b.isChat(chatID)) {
if update.CallbackQuery != nil {
_, err = b.BotAPI.AnswerCallbackQuery(tgbotapi.CallbackConfig{
CallbackQueryID: update.CallbackQuery.ID,
Text: "Access denied",
})
if err != nil {
log.Printf("[telegram] access denied, callback answer error %s", err)
}
}

continue
}

if update.Message != nil {
log.Printf("[telegram] received a message from %d in chat %d",
Expand Down

0 comments on commit f699b3e

Please sign in to comment.