Golang bindings for the Telegram Bot API

Overview

Golang bindings for the Telegram Bot API

GoDoc Travis

All methods are fairly self explanatory, and reading the godoc page should explain everything. If something isn't clear, open an issue or submit a pull request.

The scope of this project is just to provide a wrapper around the API without any additional features. There are other projects for creating something with plugins and command handlers without having to design all that yourself.

Join the development group if you want to ask questions or discuss development.

Example

First, ensure the library is installed and up to date by running go get -u github.com/go-telegram-bot-api/telegram-bot-api.

This is a very simple bot that just displays any gotten updates, then replies it to that chat.

package main

import (
	"log"

	"github.com/go-telegram-bot-api/telegram-bot-api"
)

func main() {
	bot, err := tgbotapi.NewBotAPI("MyAwesomeBotToken")
	if err != nil {
		log.Panic(err)
	}

	bot.Debug = true

	log.Printf("Authorized on account %s", bot.Self.UserName)

	u := tgbotapi.NewUpdate(0)
	u.Timeout = 60

	updates, err := bot.GetUpdatesChan(u)

	for update := range updates {
		if update.Message == nil { // ignore any non-Message Updates
			continue
		}

		log.Printf("[%s] %s", update.Message.From.UserName, update.Message.Text)

		msg := tgbotapi.NewMessage(update.Message.Chat.ID, update.Message.Text)
		msg.ReplyToMessageID = update.Message.MessageID

		bot.Send(msg)
	}
}

There are more examples on the wiki with detailed information on how to do many different kinds of things. It's a great place to get started on using keyboards, commands, or other kinds of reply markup.

If you need to use webhooks (if you wish to run on Google App Engine), you may use a slightly different method.

package main

import (
	"log"
	"net/http"

	"github.com/go-telegram-bot-api/telegram-bot-api"
)

func main() {
	bot, err := tgbotapi.NewBotAPI("MyAwesomeBotToken")
	if err != nil {
		log.Fatal(err)
	}

	bot.Debug = true

	log.Printf("Authorized on account %s", bot.Self.UserName)

	_, err = bot.SetWebhook(tgbotapi.NewWebhookWithCert("https://www.google.com:8443/"+bot.Token, "cert.pem"))
	if err != nil {
		log.Fatal(err)
	}
	info, err := bot.GetWebhookInfo()
	if err != nil {
		log.Fatal(err)
	}
	if info.LastErrorDate != 0 {
		log.Printf("Telegram callback failed: %s", info.LastErrorMessage)
	}
	updates := bot.ListenForWebhook("/" + bot.Token)
	go http.ListenAndServeTLS("0.0.0.0:8443", "cert.pem", "key.pem", nil)

	for update := range updates {
		log.Printf("%+v\n", update)
	}
}

If you need, you may generate a self signed certficate, as this requires HTTPS / TLS. The above example tells Telegram that this is your certificate and that it should be trusted, even though it is not properly signed.

openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 3560 -subj "//O=Org\CN=Test" -nodes

Now that Let's Encrypt is available, you may wish to generate your free TLS certificate there.

Comments
  • Multi-thread safe?

    Multi-thread safe?

    Just wondering if I need to protect the bot object with a mutex when calling bot.Send() from multiple go routines. I don't think I do, but just want to be sure.

    opened by utdrmac 12
  • cannot access some methods when using with go.mod

    cannot access some methods when using with go.mod

    It works fine when not using go.mod

    my go.mod

    module github.com/phanirithvij/stickerbot
    
    go 1.13
    
    require (
    	github.com/cavaliercoder/grab v2.0.0+incompatible
    	github.com/go-telegram-bot-api/telegram-bot-api v4.6.4+incompatible
    	github.com/spf13/viper v1.6.3
    	github.com/technoweenie/multipartstreamer v1.0.1 // indirect
    )
    

    my go.sum file

    //...
    github.com/go-telegram-bot-api/telegram-bot-api v4.6.4+incompatible h1:2cauKuaELYAEARXRkq2LrJ0yDDv1rW7+wrTEdVL3uaU=
    github.com/go-telegram-bot-api/telegram-bot-api v4.6.4+incompatible/go.mod h1:qf9acutJ8cwBUhm1bqgz6Bei9/C/c93FPDljKWwsOgM=
    

    Code:

    //...
    config := tgbotapi.GetStickerSetConfig{Name: stickerSet}
    data, err := bot.GetStickerSet(config)
    //...
    

    Error:

    # command-line-arguments
    .\bot.go:76:14: undefined: tgbotapi.GetStickerSetConfig
    .\bot.go:77:20: bot.GetStickerSet undefined (type *tgbotapi.BotAPI has no field or method GetStickerSet)
    
    opened by phanirithvij 10
  • BUTTON_TYPE_INVALID

    BUTTON_TYPE_INVALID

    Bad Request: BUTTON_TYPE_INVALID if I try remove InlineKeyboard in message by this code:

    edit := tgbotapi.NewEditMessageReplyMarkup(
        callback.Message.Chat.ID,
        callback.Message.MessageID,
        tgbotapi.InlineKeyboardMarkup{},
    )
    bot.Send(edit)
    

    P.S.: Also, as and with this variant:

    var markup tgbotapi.InlineKeyboardMarkup
    edit := tgbotapi.NewEditMessageText(
        callback.Message.Chat.ID,
        callback.Message.MessageID,
        "sample text",
    )
    edit.ReplyMarkup = &markup
    bot.Send(edit)
    
    opened by toby3d 10
  • Panic when sending Photo by URL

    Panic when sending Photo by URL

    Trying to send a Photo by URL results in nil pointer dereference

    This is the panic:

    panic: runtime error: invalid memory address or nil pointer dereference
    [signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x476208]
    
    goroutine 52 [running]:
    panic(0x6224a0, 0xc42000c0d0)
            /usr/lib/go/src/runtime/panic.go:500 +0x1a1
    io.(*multiReader).Read(0xc42023c1a0, 0xc4204572e7, 0x44, 0xd19, 0x1cc, 0x0, 0x0)
            /usr/lib/go/src/io/multi.go:20 +0x98
    io/ioutil.(*nopCloser).Read(0xc42022a270, 0xc4204572e7, 0x44, 0xd19, 0x1cc, 0x0, 0x0)
            <autogenerated>:4 +0x6b
    io.(*LimitedReader).Read(0xc420376640, 0xc4204572e7, 0xd19, 0xd19, 0x1cc, 0x0, 0x0)
            /usr/lib/go/src/io/io.go:436 +0x6c
    bufio.(*Writer).ReadFrom(0xc420322f80, 0x75f9e0, 0xc420376640, 0xc4200fcbb8, 0x1, 0x18)
            /usr/lib/go/src/bufio/bufio.go:693 +0xcc
    io.copyBuffer(0x75f660, 0xc420322f80, 0x75f9e0, 0xc420376640, 0x0, 0x0, 0x0, 0x631bc0, 0x1, 0xc420376640)
            /usr/lib/go/src/io/io.go:384 +0x323
    io.Copy(0x75f660, 0xc420322f80, 0x75f9e0, 0xc420376640, 0xf, 0xc420379100, 0x581d02)
            /usr/lib/go/src/io/io.go:360 +0x68
    net/http.(*transferWriter).WriteBody(0xc4202fa7e0, 0x75f660, 0xc420322f80, 0x2, 0x2)
            /usr/lib/go/src/net/http/transfer.go:227 +0x677
    net/http.(*Request).write(0xc4200c01e0, 0x75f660, 0xc420322f80, 0x0, 0xc420365890, 0x0, 0x0, 0x0)
            /usr/lib/go/src/net/http/request.go:565 +0x778
    net/http.(*persistConn).writeLoop(0xc420474300)
            /usr/lib/go/src/net/http/transport.go:1649 +0x1ac
    created by net/http.(*Transport).dialConn
            /usr/lib/go/src/net/http/transport.go:1063 +0x50e
    exit status 2
    

    This is my code:

    package main
    
    import (
            "log"
            "github.com/go-telegram-bot-api/telegram-bot-api"
            "net/url"
    )
    
    func main() {
            bot, err := tgbotapi.NewBotAPI("pls enter some token here")
            if err != nil {
                    log.Panic(err)
            }
            bot.Debug = true
            log.Printf("Authorized on account %s", bot.Self.UserName)
    
            u := tgbotapi.NewUpdate(0)
            u.Timeout = 60
            updates, err := bot.GetUpdatesChan(u)
    
            url_ptr, _ := url.Parse("https://assets-cdn.github.com/images/modules/site/home-ill-platform.png")
            url := *url_ptr
    
            for update := range updates {
                    if update.Message == nil {
                            continue
                    }
                    log.Printf("[%s] %s", update.Message.From.UserName, update.Message.Text)
                    msg := tgbotapi.NewPhotoUpload(update.Message.Chat.ID, url)
                    bot.Send(msg);
            }
    }
    

    The panic is caused by this line: https://github.com/go-telegram-bot-api/telegram-bot-api/blob/99170e2de436c1be90d2ef23dcf533b55a973e56/bot.go#L171

    The panic only happens when sending a Photo via URL, if NewPhotoUpload is called with file path, no panic happens and the Photo is sent correctly.

    question 
    opened by teamalpha5441 10
  • Provide users with more customization when creating a new bot.

    Provide users with more customization when creating a new bot.

    User are now able to create a bot with debug enabled by default.

    The debug part is use full when NewBotAPI() is failing with the message

    http.2.0bttrvjk5f4e@linuxkit-025000000001    | 2018/11/12 12:15:38 created msg
    http.2.0bttrvjk5f4e@linuxkit-025000000001    | 2018/11/12 12:15:38 getting bot
    http.2.0bttrvjk5f4e@linuxkit-025000000001    | 2018/11/12 12:15:38 error is about to happen
    http.2.0bttrvjk5f4e@linuxkit-025000000001    | 2018/11/12 12:15:38 Not Found (this one 🤷🏾‍♂️)
    

    By being able to enale debug when creating the bot user are able to debug the following code:

    		b, err := tgbotapi.NewBotAPI(os.Getenv("TELEGRAM_BOT_TOKEN"))
    
    		if err != nil {
    			log.Print("error is about to happen")
    			log.Fatal(err)
    		}
    
    opened by OGKevin 8
  • answering inline query

    answering inline query

    I think that we need an example of answering inline-query, I'm having a little problem making one myself, so hopefully the following code will demonstrate a question/example to be used in README.md

    package main
    
    import (
        "log"
    
        "gopkg.in/telegram-bot-api.v1"
    )
    
    func main() {
        bot, err := tgbotapi.NewBotAPI("MyAwesomeBotToken")
        if err != nil {
            log.Panic(err)
        }
    
        log.Printf("Authorized on account %s", bot.Self.UserName)
    
        u := tgbotapi.NewUpdate(0)
        u.Timeout = 60
    
        updates, err := bot.GetUpdatesChan(u)
    
        for update := range updates {
            if update.InlineQuery.Query == "" {
                continue
            }
    
            answer := tgbotapi.InlineQueryResultArticle{
                InlineQueryResult: tgbotapi.InlineQueryResult{ // ??
                    Type: "article",
                    ID:   update.InlineQuery.ID,
                },
    
                Title:       "Echo",
                MessageText: update.InlineQuery.Query,
            }
    
            inlineConf := tgbotapi.InlineConfig{
                InlineQueryID: update.InlineQuery.Query,
                Results:       []tgbotapi.InlineQueryResult{answer.InlineQueryResult}, // ??
            }
    
            if _, err := bot.AnswerInlineQuery(inlineConf); err != nil {
                log.Println(err)
            }
    
        }
    }
    

    I'm not sure how to deal with InlineQueryResult, this example will hit this error: [Error]: Bad request: Can't find field "message_text"

    opened by pyed 8
  • Hi, there not really PR, but new vision of tgbotapi with new API

    Hi, there not really PR, but new vision of tgbotapi with new API

    Many refactorings and DRYing, all Send* functions replaces with one Send(), Some other small changes. Tests added, 85% coverage. Everything works. Travis added.

    Please, check my code. I know, that public API is changed, but it's really useful. It will be great if it possible to merge my code to upstream, but i can rename project and develop it as my own.

    Package Syfaro/telegram-bot-api in my fork changed to zhulik/telegram-bot-api. I will change it back if you will merge my code.

    Thanks!

    ps: I want to develop some Bot framework based on it, with commands support, sessions, middlewares and so on

    opened by zhulik 8
  • Answering inline query with a sticker

    Answering inline query with a sticker

    I want to use InlineQueryResultCachedSticker/NewInlineQueryResultCachedSticker in my project. As far as i understand, it is not available in current release. So, i'd like to know, if there is any way to use it now or when it will be available.

    opened by yshym 7
  • How to use payments

    How to use payments

    Couldn't quite figure out how to make payments with your library. I found the AnswerPreCheckoutQuery and AnswerShippingQuery methods, however, how do I sendInvoice? There's Pay field in InlineKeyboard button, but I don't think it does anything. Where do I enter my payment provider token and other info?

    question 
    opened by qoops-1 7
  • implement a feature that allows stopping the update loop of the bot

    implement a feature that allows stopping the update loop of the bot

    This is a PR following the improvement proposal I've posted in issue #84

    The code in the PR implements an option to stop the update loop that is generated on a call to GetUpdatesChan

    opened by sandler31 7
  • More flexible logging options

    More flexible logging options

    At the moment this library does not allow a developer to replace the golang default log package to capture logs to redirect to say syslog as is common with services.

    This is mainly apparent in the UpdatesChan goroutine when an error occurs during the poll.

    opened by nvx 7
  • If you get more than 2 videos, FileID will repeat the bug.

    If you get more than 2 videos, FileID will repeat the bug.

    If you get more than 2 videos, FileID will repeat the bug.

    telegram version: 5.5.1 code:

    if update.Message.Video != nil { //Only the last id can be obtained here, and all ids are duplicate. log.Printf(update.Message.Video.FileID) }

    opened by hbycwp 0
  • Delete message error

    Delete message error

    I'm using delete message API:

    import (
    	telegram "github.com/go-telegram-bot-api/telegram-bot-api/v5"
    )
    
    // api *telegram.BotAPI
    msg := telegram.NewDeleteMessage(int64(chatID), msgID)
    if _, err := api.Send(msg); err != nil {
    	return errors.Wrap(err, "delete message")
    }
    

    When I call this API, Telegram deletes this message successfully, but telegram-bot library returns error: json: cannot unmarshal bool into Go value of type tgbotapi.Message.

    Debug logs for this call:

    2022/12/03 23:05:37 Endpoint: deleteMessage, params: map[chat_id:****** message_id:****]
    2022/12/03 23:05:38 Endpoint: deleteMessage, response: {"ok":true,"result":true}
    

    It looks like this library is trying to decode "result": true response from Telegram API into message struct.

    It's not a very critical issue, but because of it, I need to ignore errors from delete.

    Version is: github.com/go-telegram-bot-api/telegram-bot-api/v5 v5.5.1

    opened by g4s8 0
  • why remove KickChatMember function from BotAPI in v5?

    why remove KickChatMember function from BotAPI in v5?

    v5 documentation: https://pkg.go.dev/github.com/go-telegram-bot-api/telegram-bot-api/v5#BotAPI v4.6.4 documentation: https://pkg.go.dev/github.com/go-telegram-bot-api/telegram-bot-api#BotAPI.KickChatMember

    why remove KickChatMember function from BotAPI in v5?

    opened by jenningszheng 1
Releases(v5.5.1)
  • v5.5.1(Dec 13, 2021)

    What's Changed

    • 🚑 Fix ChatJoinRequest.From json tag by @zigmund in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/500

    New Contributors

    • @zigmund made their first contribution in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/500

    Full Changelog: https://github.com/go-telegram-bot-api/telegram-bot-api/compare/v5.5.0...v5.5.1

    Source code(tar.gz)
    Source code(zip)
  • v5.5.0(Dec 8, 2021)

    • :sparkles: Add support for Bot API 5.5 https://github.com/go-telegram-bot-api/telegram-bot-api/commit/3f07c5f67644dfc8a9c37210de2b95cfdb060515
    • :ambulance: Fix a bug in ListenForWebhook where the channel would immediately be closed https://github.com/go-telegram-bot-api/telegram-bot-api/commit/fde58e56ae1e2629ee6b4a77a7feb0ddf38340ee
    • :pencil2: Rename KickChatMember to BanChatMember as part of missed Bot API 5.3 change https://github.com/go-telegram-bot-api/telegram-bot-api/commit/f2ef2729ab6c83b860cde5326e70b3c143b00ec3
    Source code(tar.gz)
    Source code(zip)
  • v5.4.0(Dec 4, 2021)

    See the site for information about upgrading from v4

    What's Changed

    • Bot API 4.6: Polls 2.0, misc. changes by @tjhorner in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/302
    • Resolve develop conflicts by @zhuharev in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/307
    • Add FileUniqueID to ChatAnimation by @AlessandroPomponio in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/305
    • Create helper function WriteToHTTPResponse by @CNA-Bld in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/312
    • Added omitempty tag for clean JSON marshaling by @biodranik in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/336
    • fix add sticker to stickerset uploads by url and fileId by @overplumbum in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/210
    • Uploading a new photo to a channel functionality added. by @zergon321 in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/261
    • Cleanup bot test by @ErrorBoi in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/321
    • Add API type docks pack one by @ilyakaznacheev in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/383
    • Add API type docks pack two by @ilyakaznacheev in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/384
    • Add API type docks pack three by @ilyakaznacheev in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/385
    • Attempt to use GitHub Actions by @Syfaro in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/359
    • Escape Telegram formatting symbols by @ErikPelli in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/388
    • Updates for Bot API 5.0 and 5.1 by @Syfaro in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/392
    • Add support for uploading multiple files by @Syfaro in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/356
    • Change UserID to int64 by @Syfaro in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/431
    • Handle error in NewWebhook and NewWebhookWithCert by @Eivel in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/375
    • Add helper for InlineKeyboardButtonLoginURL by @antsupovsa in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/267
    • Updates for Bot API 5.2, other small fixes by @Syfaro in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/443
    • Add improved documentation by @Syfaro in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/434
    • Updates for Bot API 5.3 by @Syfaro in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/460
    • Updates for Bot API 5.4 by @Syfaro in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/486
    • Create interface for file data by @Syfaro in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/469
    • Deduplicate code, improve response accuracy. by @Syfaro in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/202
    • [FEAT]: Add SentFrom method to Update type by @quenbyako in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/416
    • Fix bug with update channel closing, add ListenForWebhookRespReqFormat method by @farit2000 in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/395
    • Fix typos and grammar issues in comments by @alexandear in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/483
    • Fix comment format for functions and constants by @alexandear in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/487

    New Contributors

    • @AlessandroPomponio made their first contribution in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/305
    • @CNA-Bld made their first contribution in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/312
    • @biodranik made their first contribution in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/336
    • @zergon321 made their first contribution in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/261
    • @ErrorBoi made their first contribution in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/321
    • @ErikPelli made their first contribution in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/388
    • @Eivel made their first contribution in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/375
    • @antsupovsa made their first contribution in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/267
    • @quenbyako made their first contribution in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/416
    • @farit2000 made their first contribution in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/395
    • @alexandear made their first contribution in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/483
    Source code(tar.gz)
    Source code(zip)
  • v5.4.0-beta.0(Nov 8, 2021)

    What's Changed

    • Bot API 4.6: Polls 2.0, misc. changes by @tjhorner in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/302
    • Resolve develop conflicts by @zhuharev in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/307
    • Add FileUniqueID to ChatAnimation by @AlessandroPomponio in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/305
    • Create helper function WriteToHTTPResponse by @CNA-Bld in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/312
    • Added omitempty tag for clean JSON marshaling by @biodranik in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/336
    • fix add sticker to stickerset uploads by url and fileId by @overplumbum in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/210
    • Uploading a new photo to a channel functionality added. by @zergon321 in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/261
    • Cleanup bot test by @ErrorBoi in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/321
    • Add API type docks pack one by @ilyakaznacheev in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/383
    • Add API type docks pack two by @ilyakaznacheev in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/384
    • Add API type docks pack three by @ilyakaznacheev in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/385
    • Attempt to use GitHub Actions by @Syfaro in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/359
    • Escape Telegram formatting symbols by @ErikPelli in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/388
    • Updates for Bot API 5.0 and 5.1 by @Syfaro in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/392
    • Add support for uploading multiple files by @Syfaro in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/356
    • Change UserID to int64 by @Syfaro in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/431
    • Handle error in NewWebhook and NewWebhookWithCert by @Eivel in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/375
    • Add helper for InlineKeyboardButtonLoginURL by @antsupovsa in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/267
    • Updates for Bot API 5.2, other small fixes by @Syfaro in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/443
    • Add improved documentation by @Syfaro in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/434
    • Updates for Bot API 5.3 by @Syfaro in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/460
    • Updates for Bot API 5.4 by @Syfaro in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/486
    • Create interface for file data by @Syfaro in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/469
    • Deduplicate code, improve response accuracy. by @Syfaro in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/202

    New Contributors

    • @AlessandroPomponio made their first contribution in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/305
    • @CNA-Bld made their first contribution in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/312
    • @biodranik made their first contribution in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/336
    • @zergon321 made their first contribution in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/261
    • @ErrorBoi made their first contribution in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/321
    • @ErikPelli made their first contribution in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/388
    • @Eivel made their first contribution in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/375
    • @antsupovsa made their first contribution in https://github.com/go-telegram-bot-api/telegram-bot-api/pull/267

    Full Changelog: https://github.com/go-telegram-bot-api/telegram-bot-api/compare/v5.0.1...v5.4.0-beta.0

    Source code(tar.gz)
    Source code(zip)
  • v4.6(Nov 25, 2016)

    This release adds the new features and changes from the Telegram Bot API 2.3.

    Please note that Telegram is deprecating the hide_keyboard field in favor of remove_keyboard.

    Source code(tar.gz)
    Source code(zip)
  • v4.5.1(Aug 1, 2016)

    chat_id and message_id should be sent only if there is no inline_message_id (and vice versa), according to documentation. Without this change it is impossible to edit a message by InlineMessageID, because chat_id and message_id are always presented in a query and the Telegram server tries to use them instead of InlineMessageID

    https://github.com/go-telegram-bot-api/telegram-bot-api/pull/55

    Source code(tar.gz)
    Source code(zip)
  • v4.5.0(Jul 27, 2016)

    This release adds the following new helper methods.

    • NewInlineQueryResultArticleMarkdown(id, title, messageText string)
    • NewInlineQueryResultArticleHTML(id, title, messageText string)
    • NewInlineQueryResultPhotoWithThumb(id, url, thumb string)

    It also fixes a bug where update offsets could not be negative, which is a valid value.

    Source code(tar.gz)
    Source code(zip)
  • v4.4.0(May 22, 2016)

  • v4.3.0(May 21, 2016)

  • v4.2.1(May 3, 2016)

  • v4.2.0(Apr 23, 2016)

  • v4.1.0(Apr 15, 2016)

  • v4.0.0(Apr 14, 2016)

  • v3.0.0(Mar 24, 2016)

  • v2.2.1(Feb 28, 2016)

  • v2.1.0(Jan 18, 2016)

  • v2.0.0(Jan 4, 2016)

    This version removes previously deprecated functions and values, prefixes all error constants with Err, removes a string error and replaces it with a constant, makes Message.Command return just the command without slash or bot name if specified, and removes the http.Handler returned by ListenForWebhook.

    Source code(tar.gz)
    Source code(zip)
  • v1.0.0(Jan 4, 2016)

    All documention is now less than 80 characters wide. Old methods now show deprecated warnings. The Values/Params/Method functions are now private. Types and configs have required and optional comments on them. Simplified some function logic.

    Source code(tar.gz)
    Source code(zip)
Owner
Golang library for the Telegram Bot API
null
Golang bindings for the Telegram Bot API

Golang bindings for the Telegram Bot API All methods are fairly self explanatory, and reading the godoc page should explain everything. If something i

null 4.3k Jan 6, 2023
Golang bindings for the Telegram Bot API

Golang bindings for the Telegram Bot API All methods are fairly self explanatory, and reading the godoc page should explain everything. If something i

null 0 Nov 18, 2021
A bot based on Telegram Bot API written in Golang allows users to download public Instagram photos, videos, and albums without receiving the user's credentials.

InstagramRobot InstagramRobot is a bot based on Telegram Bot API written in Golang that allows users to download public Instagram photos, videos, and

FTC Team 8 Dec 16, 2021
Bot - Telegram Music Bot in Go

Telegram Music Bot in Go An example bot using gotgcalls. Setup Install the serve

null 9 Jun 28, 2022
Telego is Telegram Bot API library for Golang with full API implementation (one-to-one)

Telego • Go Telegram Bot API Telego is Telegram Bot API library for Golang with full API implementation (one-to-one) The goal of this library was to c

Artem Yadelskyi 135 Jan 5, 2023
Bot-template - A simple bot template for creating a bot which includes a config, postgresql database

bot-template This is a simple bot template for creating a bot which includes a c

Disgo 2 Sep 9, 2022
Golang telegram bot API wrapper, session-based router and middleware

go-tgbot Pure Golang telegram bot API wrapper generated from swagger definition, session-based routing and middlewares. Usage benefits No need to lear

Oleg Lebedev 118 Nov 16, 2022
Client lib for Telegram bot api

Micha Client lib for Telegram bot api. Supports Bot API v2.3.1 (of 4th Dec 2016). Simple echo bot example: package main import ( "log" "git

Andrey 23 Nov 10, 2022
Go library for Telegram Bot API

tbot - Telegram Bot Server Features Full Telegram Bot API 4.7 support Zero dependency Type-safe API client with functional options Capture messages by

Alexey Grachov 332 Nov 30, 2022
Bot that polls activity API for Github organisation and pushes updates to Telegram.

git-telegram-bot Telegram bot for notifying org events Requirements (for building) Go version 1.16.x Setup If you don't have a telegram bot token yet,

Skycoin 4 Apr 8, 2022
Flexible message router add-on for go-telegram-bot-api library.

telemux Flexible message router add-on for go-telegram-bot-api library. Table of contents Motivation Features Minimal example Documentation Changelog

Andrew Dunai 24 Oct 24, 2022
WIP Telegram Bot API server in Go

botapi The telegram-bot-api, but in go. WIP. Reference: https://core.telegram.org/bots/api Reference implementation: https://github.com/tdlib/telegram

gotd 19 Jan 2, 2023
UcodeQrTelebot ver2 - Easy way to get QR and U-code using Utopia API in telegram bot

UcodeQrTelebot Easy way to get QR and U-code using Utopia API in telegram bot Us

null 1 Dec 30, 2021
The serverless OTP telegram service use telegram as OTP service, and send OTP through webhook

Setup OTP First thing, you need prepare API(webhook) with POST method, the payload format as below { "first_name": "Nolan", "last_name": "Nguyen",

Dong Nguyen 3 Jul 24, 2022
Golang Based Account Generator Telegram Bot

Account Generator Bot Account Generator Bot, written in GoLang via gotgbot library. Variables Env Vars - BOT_TOKEN - Get it from @BotFather CHANNEL_ID

Anonymous Indian 37 Nov 21, 2022
Library for working with golang telegram client + bot based on tdlib. This library was taken from the user Arman92 and changed for the current version of tdlib.

go-tdlib Golang Telegram TdLib JSON bindings Install To install, you need to run inside a docker container (it is given below) go get -u github.com/ka

Rostislav Krivets 24 Dec 2, 2022
Crypto Telegram Bot For Golang

BITCOIN-TELEGRAM-BOT Table of Contents Getting Started What you will need Installation Add BTB to your Telegram Channel Usage Getting started What you

Matias I 1 Jun 6, 2022
A telegram bot to ban the chat spammers by channel, made with Golang.

ChannelBot A telegram bot to ban channels spamming chat. Vars TOKEN - Your Telegram Bot Token (@BotFather) More Information With the latest update of

Reeshu 5 Nov 8, 2022
Simple Telegram Service Bot For Golang

Simple Telegram Service Bot Features Delete and ban channel messages Delete and

Project S 11 Oct 19, 2022