micha
Go Library for Telegram bot api
About micha
Micha
Client lib for Telegram bot api.
Simple echo bot
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)
}
}
}
Frequently Asked Questions
What is micha?
micha is a Bot Building library for the Go programming language. Go Library for Telegram bot api
How do I install micha?
Install micha with the Go module system using `go get onrik/micha`. Check the repository for the current installation instructions.
What category does micha belong to?
micha is listed under Bot Building, specifically Bot Building.