https://github.com/onrik/micha
Client lib for Telegram bot api
https://github.com/onrik/micha
go golang telegram telegram-bot
Last synced: 4 months ago
JSON representation
Client lib for Telegram bot api
- Host: GitHub
- URL: https://github.com/onrik/micha
- Owner: onrik
- License: mit
- Created: 2016-04-14T12:09:44.000Z (over 9 years ago)
- Default Branch: main
- Last Pushed: 2024-08-15T08:25:39.000Z (over 1 year ago)
- Last Synced: 2024-08-16T09:08:04.683Z (over 1 year ago)
- Topics: go, golang, telegram, telegram-bot
- Language: Go
- Homepage:
- Size: 156 KB
- Stars: 28
- Watchers: 5
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-go - micha - Go Library for Telegram bot api. (Bot Building)
- fucking-awesome-go - micha - Go Library for Telegram bot api. (Bot Building)
- awesome-go - micha - Client lib for Telegram bot api - ★ 8 (Third-party APIs)
- awesome-go - micha - Go Library for Telegram bot api. (Third-party APIs / Advanced Console UIs)
- awesome-go-extra - micha - 04-14T12:09:44Z|2021-05-30T07:10:13Z| (Bot Building / Free e-books)
- awesome-go-with-stars - micha - Go Library for Telegram bot api. (Bot Building)
- awesome-go-cn - micha
- awesome-go-cn - micha
- awesome-go-plus - micha - Go Library for Telegram bot api.  (Bot Building)
- awesome-go - micha - Go Library for Telegram bot api. (Bot Building)
- awesome-go - onrik/micha
- awesome-go - micha
- awesome-go - micha - Go Library for Telegram bot api. (Bot Building)
- awesome-go - micha - Go Library for Telegram bot api. (Bot Building)
- awesome-go - micha - Go Library for Telegram bot api. (Bot Building)
- awesome-Char - micha - Go Library for Telegram bot api. (Bot Building / Contents)
- awesome-go - micha - Go Library for Telegram bot api. - :arrow_down:1 - :star:0 (Bot Building)
- awesome-go-cn - micha
- awesome-go-cn - micha
- awesome-go-zh - micha
- awesome-go - micha - Go Library for Telegram bot api. (Bot Building)
- awesome-go - micha - Go Library for Telegram bot api. (<span id="第三方api-third-party-apis">第三方API Third-party APIs</span> / <span id="高级控制台用户界面-advanced-console-uis">高级控制台用户界面 Advanced Console UIs</span>)
README
# Micha
[](https://github.com/onrik/micha/actions)
[](https://coveralls.io/github/onrik/micha?branch=master)
[](https://goreportcard.com/report/github.com/onrik/micha)
[](https://pkg.go.dev/github.com/onrik/micha)
Client lib for [Telegram bot api](https://core.telegram.org/bots/api).
### Simple echo bot
```go
package main
import (
"log"
"github.com/onrik/micha"
)
func main() {
bot, err := micha.NewBot("")
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](https://github.com/tdlib/telegram-bot-api)
```go
package main
import (
"log"
"github.com/onrik/micha"
)
func main() {
bot, err := micha.NewBot(
"",
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)
}
}
}
```