Browse Source

Added logging on other message types

master
parent
commit
836cb00f91
  1. 34
      inlinebotenru.go

34
inlinebotenru.go

@ -41,11 +41,37 @@ func main() { @@ -41,11 +41,37 @@ func main() {
for update := range updates {
if update.InlineQuery == nil { // if no inline query, send static help and ignore it
msg := tgbotapi.NewMessage(update.Message.Chat.ID, reply)
bot.Send(msg)
user := update.Message.From
message := update.Message.Text
fmt.Printf("User: %s send into bot directly: %s\n", user, message)
if update.Message.Photo != nil {
fmt.Printf("User: %s send into bot directly photo\n", user)
}
if update.Message.Animation != nil {
fmt.Printf("User: %s send into bot directly animation\n", user)
}
if update.Message.Audio != nil {
fmt.Printf("User: %s send into bot directly audio\n", user)
}
if update.Message.Document != nil {
fmt.Printf("User: %s send into bot directly document\n", user)
}
if update.Message.Location != nil {
fmt.Printf("User: %s send into bot directly location:%f, %f\n", user, update.Message.Location.Latitude, update.Message.Location.Longitude)
}
if update.Message.Sticker != nil {
fmt.Printf("User: %s send into bot directly sticker\n", user)
}
if update.Message.Video != nil {
fmt.Printf("User: %s send into bot directly video\n", user)
}
if update.Message.Voice != nil {
fmt.Printf("User: %s send into bot directly voice message\n", user)
}
if update.Message.Text != "" {
msg := tgbotapi.NewMessage(update.Message.Chat.ID, reply)
bot.Send(msg)
message := update.Message.Text
fmt.Printf("User: %s send into bot directly: %s\n", user, message)
}
continue
}

Loading…
Cancel
Save