Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/onrik/micha
Client lib for Telegram bot api
https://github.com/onrik/micha
go golang telegram telegram-bot
Last synced: 10 days 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 8 years ago)
- Default Branch: main
- Last Pushed: 2024-08-15T08:25:39.000Z (3 months ago)
- Last Synced: 2024-08-16T09:08:04.683Z (3 months 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)
- awesome-Char - micha - Go Library for Telegram bot api. (Bot Building / Contents)
- 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 - Go Library for Telegram bot api. (Bot Building)
- awesome-go - micha
- awesome-go - micha - Go Library for Telegram bot api. (Bot Building)
- awesome-go - micha - Go Library for Telegram bot api. - :arrow_down:1 - :star:0 (Bot Building)
- awesome-go - micha - Client lib for Telegram bot api - ★ 8 (Third-party APIs)
- awesome-go-cn - micha
- 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-plus - micha - Go Library for Telegram bot api. (Bot Building)
- awesome-go-plus - micha - Go Library for Telegram bot api. (Bot Building)
README
# Micha
[![Tests](https://github.com/onrik/micha/workflows/Tests/badge.svg)](https://github.com/onrik/micha/actions)
[![Coverage Status](https://coveralls.io/repos/github/onrik/micha/badge.svg?branch=master)](https://coveralls.io/github/onrik/micha?branch=master)
[![Go Report Card](https://goreportcard.com/badge/github.com/onrik/micha)](https://goreportcard.com/report/github.com/onrik/micha)
[![PkgGoDev](https://pkg.go.dev/badge/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 mainimport (
"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 mainimport (
"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)
}
}
}```