Golang framework for developing Telegram Bots

Syfaro 3913fda2e2 Stop using gopkg for telegram-bot-api. 2 months ago
commands 3913fda2e2 Stop using gopkg for telegram-bot-api. 2 months ago
.travis.yml 20b8ffe09f Add .travis.yml. 2 years ago
README.md 33bec5ece2 Consistent capitalization to fix Travis, move tests into same package. 2 months ago
commands.go 3913fda2e2 Stop using gopkg for telegram-bot-api. 2 months ago
commands_test.go 33bec5ece2 Consistent capitalization to fix Travis, move tests into same package. 2 months ago
finch.go 3913fda2e2 Stop using gopkg for telegram-bot-api. 2 months ago
types.go 3913fda2e2 Stop using gopkg for telegram-bot-api. 2 months ago

README.md

finch

A Golang Telegram Bot framework

Unlike the 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.

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.

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.