Client lib for Telegram bot api.
package main
import (
"log"
"github.com/onrik/micha"
)
func main() {
bot, err := micha.NewBot("<token>")
if err != nil {
log.Println(err)
return
}
go bot.Start()
for update := range bot.Updates() {
if update.Message != nil {
bot.SendMessage(update.Message.Chat.ID, update.Message.Text, nil)
}
}
}
Custom Telegram Bot API
package main
import (
"log"
"github.com/onrik/micha"
)
func main() {
bot, err := micha.NewBot(
"<token>",
micha.WithAPIServer("http://127.0.0.1:8081"),
)
if err != nil {
log.Println(err)
return
}
err = bot.Logout()
if err != nil {
log.Println(err)
return
}
go bot.Start()
for update := range bot.Updates() {
if update.Message != nil {
bot.SendMessage(update.Message.Chat.ID, update.Message.Text, nil)
}
}
}