Skip to content

nasermirzaei89/telegram

Repository files navigation

Telegram Bot API

Telegram Bot API Golang implementation

Build Status Go Report Card GolangCI Codecov GoDoc license

Status

Bot API 6.0 (https://core.telegram.org/bots/api-changelog#april-16-2022)

Install

go get github.com/nasermirzaei89/telegram

Example

package main

import (
	"context"
	"github.com/nasermirzaei89/telegram"
	"log"
	"os"
)

func main() {
	bot := telegram.New(os.Getenv("TOKEN"))

	res, err := bot.GetUpdates(context.Background())
	if err != nil {
		log.Fatalln(err)
	}

	if res.IsOK() {
		log.Printf("%+v", res.GetUpdates())
	} else {
		log.Printf("%d: %s", res.GetErrorCode(), res.GetDescription())
	}
}

License

MIT License

Contributing

You can submit a new issue in GitHub issues. Or you can create a fork, hack on your fork and when you're done create a pull request, so that the code contribution can get merged into the main package.