Golang framework for developing Telegram Bots
Syfaro 3913fda2e2 Stop using gopkg for telegram-bot-api. 6 months ago
commands Stop using gopkg for telegram-bot-api. 6 months ago
.travis.yml Add .travis.yml. 2 years ago
README.md Consistent capitalization to fix Travis, move tests into same package. 6 months ago
commands.go Stop using gopkg for telegram-bot-api. 6 months ago
commands_test.go Consistent capitalization to fix Travis, move tests into same package. 6 months ago
finch.go Stop using gopkg for telegram-bot-api. 6 months ago
types.go Stop using gopkg for telegram-bot-api. 6 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.