Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/syfaro/finch

A Golang Telegram Bot framework
https://github.com/syfaro/finch

bot golang telegram-bot telegram-bot-api

Last synced: about 1 month ago
JSON representation

A Golang Telegram Bot framework

Awesome Lists containing this project

README

        

# finch

A Golang Telegram Bot framework

Unlike the [Telegram Bot API](https://github.com/go-telegram-bot-api/telegram-bot-api), this is a framework for writing commands, not just low level dealings with the API directly.

You can see how to write some commands from the example commands provided in the `commands` folder.

## Example

It's fairly easy to get this bot running, it requires few lines of code.

```go
package main

import (
"github.com/Syfaro/finch"
_ "github.com/Syfaro/finch/commands/help"
_ "github.com/Syfaro/finch/commands/info"
_ "github.com/Syfaro/finch/commands/stats"
)

func main() {
f := finch.NewFinch("MyAwesomeBotToken")

f.Start()
}
```

The webhook listener code is currently untested, and requires running a `net/http` server.

```go
package main

import (
"github.com/Syfaro/finch"
_ "github.com/Syfaro/finch/commands/help"
_ "github.com/Syfaro/finch/commands/info"
_ "github.com/Syfaro/finch/commands/stats"
"net/http"
)

func main() {
f := finch.NewFinchWithClient("MyAwesomeBotToken", &http.Client{})

f.StartWebhook("/" + f.API.Token)

http.ListenAndServeTLS("0.0.0.0:8443", "cert.pem", "key.pem", nil)
}
```

A full bot example may be found at [selectionsbot](https://github.com/Syfaro/selectionsbot).