Skip to content

Instantly share code, notes, and snippets.

@Cibernomadas Cibernomadas/main.go
Created May 20, 2018

Embed
What would you like to do?
package main
import (
"log"
"gopkg.in/telegram-bot-api.v4"
)
func main() {
bot, err := tgbotapi.NewBotAPI("** bot token **")
if err != nil {
log.Panic(err)
}
bot.Debug = true
log.Printf("Authorized on account %s", bot.Self.UserName)
u := tgbotapi.NewUpdate(0)
u.Timeout = 60
updates, err := bot.GetUpdatesChan(u)
for update := range updates {
if update.Message == nil {
continue
}
log.Printf("[%s] %s", update.Message.From.UserName, update.Message.Text)
msg := tgbotapi.NewMessage(update.Message.Chat.ID, update.Message.Text)
msg.ReplyToMessageID = update.Message.MessageID
bot.Send(msg)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.