Telego is Telegram Bot API library for Golang with full API implementation (one-to-one)

Overview

Telego • Go Telegram Bot API

Go Reference Telegram Bot API Version
Mentioned in Awesome Go Dis Telegram Chat

CI Status Quality Gate Status Go Report
Coverage Code Smells Lines of Code

Telego logo

Telego is Telegram Bot API library for Golang with full API implementation (one-to-one)

The goal of this library was to create API with same types and methods as actual telegram bot API. Every type and method have been represented in types.go and methods.go files with mostly all documentation from telegram.

Note: Telego uses fasthttp instead of net/http and jsoniter instead of encoding/json.

📋 Table Of Content

Click to show • hide

⚡️ Getting Started

How to get the library:

go get -u github.com/mymmrac/telego

Make sure you get the latest version to have all new features & fixes.

More examples can be seen here:

Click to show • hide

Note: Error handling may be missing in examples, but I strongly recommend handling all errors.

🧩 Basic setup

▲ Go Up ▲

For start, you need to create instance of your bot and specify token.

package main

import (
	"fmt"
	"os"

	"github.com/mymmrac/telego"
)

func main() {
	// Get Bot token from environment variables
	botToken := os.Getenv("TOKEN")

	// Create bot and enable debugging info
	// (more on configuration at /examples/configuration/main.go)
	bot, err := telego.NewBot(botToken, telego.DefaultLogger(true, true))
	if err != nil {
		fmt.Println(err)
		os.Exit(1)
	}

	// Call method getMe (https://core.telegram.org/bots/api#getme)
	botUser, err := bot.GetMe()
	if err != nil {
		fmt.Println("Error:", err)
	}

	// Print Bot information
	fmt.Printf("Bot user: %#v\n", botUser)
}

📩 Getting updates

▲ Go Up ▲

In order to receive updates you can use two methods:

  • using long polling (bot.UpdatesViaLongPulling)
  • using webhook (bot.UpdatesViaWebhook)

Let's start from long pulling (easier for local testing):

package main

import (
	"fmt"
	"os"
	"time"

	"github.com/mymmrac/telego"
)

func main() {
	botToken := os.Getenv("TOKEN")

	bot, err := telego.NewBot(botToken, telego.DefaultLogger(true, true))
	if err != nil {
		fmt.Println(err)
		os.Exit(1)
	}

	// Optional. Set interval of getting updates (default: 0.5s).
	// If you want to get updates as fast as possible set to 0,
	// but webhook method is recommended for this.
	bot.SetUpdateInterval(time.Second / 2)

	// Get updates channel
	updates, _ := bot.UpdatesViaLongPulling(nil)

	// Stop reviving updates from updates channel
	defer bot.StopLongPulling()

	// Loop through all updates when they came
	for update := range updates {
		fmt.Printf("Update: %#v\n", update)
	}
}

Webhook example (recommended way):

package main

import (
	"fmt"
	"os"

	"github.com/mymmrac/telego"
)

func main() {
	botToken := os.Getenv("TOKEN")

	bot, err := telego.NewBot(botToken, telego.DefaultLogger(true, true))
	if err != nil {
		fmt.Println(err)
		os.Exit(1)
	}

	// Set up a webhook on Telegram side
	_ = bot.SetWebhook(&telego.SetWebhookParams{
		URL: "https://example.com/bot" + bot.Token(),
	})

	// Receive information about webhook
	info, _ := bot.GetWebhookInfo()
	fmt.Printf("Webhook Info: %#v\n", info)

	// Get updates channel from webhook.
	// Note: For one bot only one webhook allowed.
	updates, _ := bot.UpdatesViaWebhook("/bot" + bot.Token())

	// Start server for receiving requests from Telegram
	bot.StartListeningForWebhook("localhost:443")

	// Stop reviving updates from updates channel and shutdown webhook server
	defer func() {
		_ = bot.StopWebhook()
	}()

	// Loop through all updates when they came
	for update := range updates {
		fmt.Printf("Update: %#v\n", update)
	}
}

Note: You may wish to use Let's Encrypt in order to generate your free TLS certificate.

🪁 Using Telegram methods

▲ Go Up ▲

All Telegram Bot API methods described in documentation can be used by the library. They have same names and same parameters, parameters represented by struct with name: + Params. If method don't have required parameters nil value can be used as a parameter.

Note: types.go and methods.go was automatically generated from documentation, and it's possible that they have errors or missing parts both in comments and actual code. Fell free to report such things.

package main

import (
	"fmt"
	"os"

	"github.com/mymmrac/telego"
	tu "github.com/mymmrac/telego/telegoutil"
)

func main() {
	botToken := os.Getenv("TOKEN")

	bot, err := telego.NewBot(botToken, telego.DefaultLogger(true, true))
	if err != nil {
		fmt.Println(err)
		os.Exit(1)
	}

	// Call method getMe
	botUser, _ := bot.GetMe()
	fmt.Printf("Bot User: %#v\n", botUser)

	updates, _ := bot.UpdatesViaLongPulling(nil)
	defer bot.StopLongPulling()

	for update := range updates {
		if update.Message != nil {
			// Retrieve chat ID
			chatID := update.Message.Chat.ID

			// Call method sendMessage (https://core.telegram.org/bots/api#sendmessage).
			// Sends message to sender with same text (echo bot).
			sentMessage, _ := bot.SendMessage(
				tu.Message(
					tu.ID(chatID),
					update.Message.Text,
				),
			)

			fmt.Printf("Sent Message: %v\n", sentMessage)
		}
	}
}

🧼 Utility methods

▲ Go Up ▲

In Telego even though you have all types and methods available, it's often not so convenient to use them directly. To solve this issues telegoutil package was created. It contains utility-helper function that will make your life a bit easier.

I suggest including it with alias to get cleaner code:

import tu "github.com/mymmrac/telego/telegoutil"

Package contains couple methods for creating send parameters with all required parameters like:

  • Message(chatID, text) => SendMessageParams
  • Photo(chatID, photoFile) => SendPhotoParams
  • Location(chatID, latitude, longitude) => SendLocationParams
  • ...

Or other useful methods like:

  • ID(intID) => ChatID
  • File(namedReader) => InputFile
  • ...

Utils related to methods can be found in telegoutil/methods, for types in telegoutil/types, for handlers in telegoutil/handler, for api in telegoutil/api.

Note: If you think that something can be added to telegoutil package fill free to create an issue or pull request with desired changes.

🦾 Helper With... methods

▲ Go Up ▲

Creating method parameters is sometimes bulky and not convenient, so you can use with methods in combination with utility methods.

Here is a simple example of creating a message with a keyboard that has 4 buttons with different parameters.

<- `with` method ), tu.KeyboardRow( // Row 2 tu.KeyboardButton("Contact").WithRequestContact(), // Column 1, <- `with` method tu.KeyboardButton("Location").WithRequestLocation(), // Column 2, <- `with` method ), ).WithResizeKeyboard().WithInputFieldPlaceholder("Select something") // <- multiple `with` methods // Creating message msg := tu.Message( tu.ID(123), "Hello World", ).WithReplyMarkup(keyboard).WithProtectContent() // <- multiple `with` method bot.SendMessage(msg) }">
package main

import (
	"github.com/mymmrac/telego"
	tu "github.com/mymmrac/telego/telegoutil"
)

func main() {
	// ... initializing bot

	// Creating keyboard
	keyboard := tu.Keyboard(
		tu.KeyboardRow( // Row 1
			tu.KeyboardButton("Button"), // Column 1
			tu.KeyboardButton("Poll Regular"). // Column 2
				WithRequestPoll(tu.PollTypeRegular()), // <- `with` method
		),
		tu.KeyboardRow( // Row 2
			tu.KeyboardButton("Contact").WithRequestContact(),   // Column 1, <- `with` method 
			tu.KeyboardButton("Location").WithRequestLocation(), // Column 2, <- `with` method 
		),
	).WithResizeKeyboard().WithInputFieldPlaceholder("Select something") // <- multiple `with` methods 

	// Creating message
	msg := tu.Message(
		tu.ID(123),
		"Hello World",
	).WithReplyMarkup(keyboard).WithProtectContent() // <- multiple `with` method 

	bot.SendMessage(msg)
}

Those methods allow you to modify values without directly accessing them, also as you saw with methods can be staked one to another in order to update multiple values.

⛅️ Bot handlers

▲ Go Up ▲

Processing updates just in for loop is not the most pleasing thing to do, so Telego provides net/http like handlers, but instead of the path, you provide predicates.

One update will only match to the first handler whose predicates are satisfied, predicates checked in order of handler registration (it's useful to first specify most specific predicates and then more general).

Also, all handlers (but not their predicates) are processed in parallel.

I suggest including it with alias to get cleaner code:

import th "github.com/mymmrac/telego/telegohandler"

Here is example of using handlers with long pulling updates. You can see full list of available predicates in telegohandler/pradicates, or define your own.

package main

import (
	"fmt"
	"os"

	"github.com/mymmrac/telego"
	th "github.com/mymmrac/telego/telegohandler"
	tu "github.com/mymmrac/telego/telegoutil"
)

func main() {
	botToken := os.Getenv("TOKEN")

	bot, err := telego.NewBot(botToken, telego.WithDefaultLogger(true, true))
	if err != nil {
		fmt.Println(err)
		os.Exit(1)
	}

	// Get updates channel
	updates, _ := bot.UpdatesViaLongPulling(nil)
	defer bot.StopLongPulling()

	// Create bot handler and specify from where to get updates
	bh := th.NewBotHandler(bot, updates)

	// Register new handler with match on command `/start`
	bh.Handle(func(bot *telego.Bot, update telego.Update) {
		// Send message
		_, _ = bot.SendMessage(tu.Message(
			tu.ID(update.Message.Chat.ID),
			fmt.Sprintf("Hello %s!", update.Message.From.FirstName),
		))
	}, th.CommandEqual("start"))

	// Register new handler with match on any command
	// Handlers will match only once and in order of registration, so this handler will be called on any command except
	// `/start` command
	bh.Handle(func(bot *telego.Bot, update telego.Update) {
		// Send message
		_, _ = bot.SendMessage(tu.Message(
			tu.ID(update.Message.Chat.ID),
			"Unknown command, use /start",
		))
	}, th.AnyCommand())

	// Start handling updates
	bh.Start()

	// Stop handling updates
	defer bh.Stop()
}

🎨 Contribution

Contribution guidelines listed here.

🔐 License

Telego is distributed under MIT licence.

Comments
  • ⭐️ telegohandler.HandlerWrapper

    ⭐️ telegohandler.HandlerWrapper

    ⭐️ Feature description

    It can accept multiple Handlers to return a Handler to simulate a gin-like route capability.

    This will provide more power over the original telego handler. Examples include middleware (necessary for authenticated bots), error handling, and more complex logic controls.

    If you like the idea, I can submit a PR.

    🌈 Your view

    You can see the code example.

    🧐 Code example

    package middleware
    
    import (
    	"context"
    	"github.com/mymmrac/telego"
    	"github.com/mymmrac/telego/telegohandler"
    	"github.com/mymmrac/telego/telegoutil"
    )
    
    type Ctx struct {
    	stack        []WrapperHandler
    	context      context.Context
    	indexHandler int
    	update       telego.Update
    	bot          *telego.Bot
    }
    
    func (c *Ctx) Next() error {
    	c.indexHandler++
    	if c.indexHandler == len(c.stack) {
    		return nil
    	}
    	h := c.stack[c.indexHandler]
    	return h(c)
    }
    
    func (c *Ctx) SendMessage(text string) error {
    	chatID := telegoutil.ID(c.update.Message.Chat.ID)
    	_, err := c.bot.SendMessage(telegoutil.Message(
    		chatID,
    		text))
    	return err
    }
    
    type WrapperHandlerBuilder struct {
    	ErrorHandler WrapperErrorHandler
    	stack        []WrapperHandler
    }
    
    func defaultErrorHandler(ctx *Ctx, err error) {
    	ctx.SendMessage(err.Error())
    }
    
    func (w *WrapperHandlerBuilder) Add(h ...WrapperHandler) {
    	w.stack = append(w.stack, h...)
    }
    
    func (w *WrapperHandlerBuilder) Build() telegohandler.Handler {
    	return func(bot *telego.Bot, update telego.Update) {
    		c := &Ctx{
    			context:      context.Background(),
    			indexHandler: 0,
    			update:       update,
    			bot:          bot,
    		}
    		if len(w.stack) == 0 {
    			return
    		}
    		h := w.stack[0]
    		if err := h(c); err != nil {
    			w.ErrorHandler(c, err)
    		}
    	}
    }
    
    type WrapperHandler func(ctx *Ctx) error
    type WrapperErrorHandler func(ctx *Ctx, err error)
    
    func NewWrapperHandlerBuilder() *WrapperHandlerBuilder {
    	return &WrapperHandlerBuilder{
    		ErrorHandler: defaultErrorHandler,
    	}
    }
    
    
    :fire: Enhancement :mag: Needs Investigation 
    opened by linbuxiao 3
  • `Invalid chat id` response from telegram when using Username as ChatID and sending a Photo.

    `Invalid chat id` response from telegram when using Username as ChatID and sending a Photo.

    params := &telego.SendPhotoParams{
    		ChatID:                   telego.ChatID{ Username: "@channel_name" },
    		Photo:                    telego.InputFile{ File: f},
    		Caption:                  "https://test.ru/test_url",
    	}
    _, err = g.bot.SendPhoto(params)
    

    The reason is that in the resulting request ChatID contains "extra" double quotes like "@channel_name"

    :space_invader: Bug 
    opened by foenixx 3
  • Bump github.com/valyala/fasthttp from 1.41.0 to 1.42.0

    Bump github.com/valyala/fasthttp from 1.41.0 to 1.42.0

    Bumps github.com/valyala/fasthttp from 1.41.0 to 1.42.0.

    Release notes

    Sourced from github.com/valyala/fasthttp's releases.

    v1.42.0

    • 4995135 feat: add ShutdownWithContext (#1383) (kinggo)
    • 7b3bf58 style: modify typo and remove repeated type conversions (#1437) (kinggo)
    • 8f43443 Wait for the response of pipelineWork in background and return it to pool (#1436) (Andy Pan)
    • c367454 Fix some potential pool leaks (#1433) (Andy Pan)
    • b32a3dd Use time.Until(deadline) instead of -time.Since(deadline) (#1434) (Andy Pan)
    • 8a60232 Assert with *net.TCPConn instead of *net.TCPListener in acceptConn() for TCP sockets (#1432) (Andy Pan)
    • c57a2ce Make sure nothing is nil in tmp slice (#1423) (hs son)
    • f095481 Request.SetTimeout (#1415) (brian-armstrong-discord)
    • c88dd5d fix form empty field error when used with pipe (#1417) (nick9822)
    • a468a7d feat: support mulit/range (#1398) (byene0923)
    • 3963a79 feat: add PeekKeys and PeekTrailerKeys (#1405) (kinggo)
    • eca86de fix: (#1410) (byene0923)
    • e214137 fix: ignore body should not set content-length of streaming (#1406) (byene0923)
    Commits
    • 4995135 feat: add ShutdownWithContext (#1383)
    • 7b3bf58 style: modify typo and remove repeated type conversions (#1437)
    • 8f43443 Wait for the response of pipelineWork in background and return it to pool (#1...
    • c367454 Fix some potential pool leaks (#1433)
    • b32a3dd Use time.Until(deadline) instead of -time.Since(deadline) (#1434)
    • 8a60232 Assert with *net.TCPConn instead of *net.TCPListener in acceptConn() for TCP ...
    • c57a2ce Make sure nothing is nil in tmp slice (#1423)
    • f095481 Request.SetTimeout (#1415)
    • c88dd5d fix form empty field error when used with pipe (#1417)
    • a468a7d feat: support mulit/range (#1398)
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    :shamrock: Dependencies :hamster: Go 
    opened by dependabot[bot] 1
  • Bump github.com/fasthttp/router from 1.4.13 to 1.4.14

    Bump github.com/fasthttp/router from 1.4.13 to 1.4.14

    Bumps github.com/fasthttp/router from 1.4.13 to 1.4.14.

    Release notes

    Sourced from github.com/fasthttp/router's releases.

    v1.4.14

    • 405cb38 feat: upgrade dependencies (Sergio VS)
    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    :shamrock: Dependencies :hamster: Go 
    opened by dependabot[bot] 1
  • Fixed typo in Makefile

    Fixed typo in Makefile

    :speech_balloon: Description

    Changed bit to bin in Makefile.

    :monocle_face: Type of change

    • [x] Documentation update (changes in comments, .md files or other docs)
    opened by alexandear 1
  • Bump github.com/fasthttp/router from 1.4.12 to 1.4.13

    Bump github.com/fasthttp/router from 1.4.12 to 1.4.13

    Bumps github.com/fasthttp/router from 1.4.12 to 1.4.13.

    Release notes

    Sourced from github.com/fasthttp/router's releases.

    v1.4.13

    • fec4124 chore: deprecated Go 1.15 (Sergio VS)
    • 71c8a0c feat: upgrade fasthttp to v1.41.0 (Sergio VS)
    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    :shamrock: Dependencies :hamster: Go 
    opened by dependabot[bot] 1
  • Bump github.com/valyala/fasthttp from 1.40.0 to 1.41.0

    Bump github.com/valyala/fasthttp from 1.40.0 to 1.41.0

    Bumps github.com/valyala/fasthttp from 1.40.0 to 1.41.0.

    Release notes

    Sourced from github.com/valyala/fasthttp's releases.

    v1.41.0

    • 128e9b3 optimize: adjust the behavior of PeekAll based on VisitAll (#1403) (kinggo)
    • 2c8ce3b feat: add header.PeekAll (#1394) (kinggo)
    • d404f2d make RequestCtx's userdata accept keys that are of type: interface{} (#1387) (pj)
    • bcf7e8e test: merge test in adaptor_test.go (#1381) (kinggo)
    • 31fdc79 resolve CVE-2022-27664 (#1377) (Craig O'Donnell)
    • 40eec0b byte to string unsafe conversion in fasthttpadaptor ConvertRequest method (#1375) (Emre Savcı)
    • a696949 Deprecate Go 1.15 (#1379) (Aoang)
    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    :shamrock: Dependencies :hamster: Go 
    opened by dependabot[bot] 1
  • Bump github.com/stretchr/testify from 1.8.0 to 1.8.1

    Bump github.com/stretchr/testify from 1.8.0 to 1.8.1

    Bumps github.com/stretchr/testify from 1.8.0 to 1.8.1.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    :shamrock: Dependencies :hamster: Go 
    opened by dependabot[bot] 1
  • Bump golang.org/x/text from 0.3.8 to 0.4.0

    Bump golang.org/x/text from 0.3.8 to 0.4.0

    Bumps golang.org/x/text from 0.3.8 to 0.4.0.

    Commits
    • 1bdb400 language: remove compatibility with go < 1.2
    • 252bee0 go.mod: ignore cyclic dependency for tagging
    • ecab6e5 go.mod: ignore cyclic dependency for tagging
    • 369c86b all: fix a few function names on comments
    • See full diff in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    :shamrock: Dependencies :hamster: Go 
    opened by dependabot[bot] 1
  • Bump golang.org/x/text from 0.3.7 to 0.3.8

    Bump golang.org/x/text from 0.3.7 to 0.3.8

    Bumps golang.org/x/text from 0.3.7 to 0.3.8.

    Commits
    • 434eadc language: reject excessively large Accept-Language strings
    • 23407e7 go.mod: ignore cyclic dependency for tagging
    • b18d3dd secure/precis: replace bytes.Compare with bytes.Equal
    • 795e854 all: replace io/ioutil with io and os package
    • b0ca10f internal/language: bump script types to uint16 and update registry
    • ba9b0e1 go.mod: update x/tools to HEAD
    • d03b418 A+C: delete AUTHORS and CONTRIBUTORS
    • b4bca84 language/display: fix Tag method comment
    • ea49e3e go.mod: update x/tools to HEAD
    • 78819d0 go.mod: update to golang.org/x/text v0.1.10
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    :shamrock: Dependencies :hamster: Go 
    opened by dependabot[bot] 1
  • Bump github.com/fasthttp/router from 1.4.11 to 1.4.12

    Bump github.com/fasthttp/router from 1.4.11 to 1.4.12

    Bumps github.com/fasthttp/router from 1.4.11 to 1.4.12.

    Release notes

    Sourced from github.com/fasthttp/router's releases.

    v1.4.12

    • 978f189 feat: upgrade fasthttp to v1.40.0 (Sergio VS)
    • 7e20e48 chore: add support to go v1.19 (Sergio VS)
    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    :shamrock: Dependencies :hamster: Go 
    opened by dependabot[bot] 1
  • ⭐️ Docs (mymmrac.github.io/telego-docs)

    ⭐️ Docs (mymmrac.github.io/telego-docs)

    ⭐️ Feature description

    mymmrac.github.io/telego-docs

    Populate documentation with relevant info & examples

    Docs repo: mymmrac/telego-docs

    🌈 Your view

    No response

    🧐 Code example

    No response

    :speech_balloon: Documentation :fire: Enhancement 
    opened by mymmrac 0
  • ⭐️ Update CI flow for PR

    ⭐️ Update CI flow for PR

    ⭐️ Feature description

    Make two different flows for master and PRs or fix SonarCloud not being able to run

    🌈 Your view

    No response

    🧐 Code example

    No response

    :fire: Enhancement :green_heart: Help Wanted 
    opened by mymmrac 0
Releases(v0.17.1)
  • v0.17.1(Nov 5, 2022)

    Overview

    • Updated to Telegram Bot API v6.3
    • Partially added Taskfile

    What's Changed

    • Bump github.com/fasthttp/router from 1.4.12 to 1.4.13 by @dependabot in https://github.com/mymmrac/telego/pull/64
    • Fixed typo in Makefile by @alexandear in https://github.com/mymmrac/telego/pull/65

    New Contributors

    • @alexandear made their first contribution in https://github.com/mymmrac/telego/pull/65

    Full Changelog: https://github.com/mymmrac/telego/compare/v0.17.0...v0.17.1

    Source code(tar.gz)
    Source code(zip)
  • v0.17.0(Oct 27, 2022)

    Overview

    • Updated to Go 1.19

    What's Changed

    • Bump github.com/stretchr/testify from 1.8.0 to 1.8.1 by @dependabot in https://github.com/mymmrac/telego/pull/62
    • Bump github.com/valyala/fasthttp from 1.40.0 to 1.41.0 by @dependabot in https://github.com/mymmrac/telego/pull/63

    Full Changelog: https://github.com/mymmrac/telego/compare/v0.16.2...v0.17.0

    Source code(tar.gz)
    Source code(zip)
  • v0.16.2(Oct 21, 2022)

    Overview

    • Updated example of long pulling
    • Added WithEmptyValues and WithCustomEmptyValues
    • Added WithWarnings
    • Added tu.Messagef
    • Added Telego docs badge (https://telego.ml)

    What's Changed

    • Bump github.com/valyala/fasthttp from 1.39.0 to 1.40.0 by @dependabot in https://github.com/mymmrac/telego/pull/57
    • Bump github.com/fasthttp/router from 1.4.11 to 1.4.12 by @dependabot in https://github.com/mymmrac/telego/pull/58
    • Bump golang.org/x/text from 0.3.7 to 0.3.8 by @dependabot in https://github.com/mymmrac/telego/pull/60
    • Bump golang.org/x/text from 0.3.8 to 0.4.0 by @dependabot in https://github.com/mymmrac/telego/pull/61

    Full Changelog: https://github.com/mymmrac/telego/compare/v0.16.1...v0.16.2

    Source code(tar.gz)
    Source code(zip)
  • v0.16.1(Aug 24, 2022)

    Overview

    • Added web app data validation as utility
    • Fixed shipping option utility
    • Updated dependencies

    What's Changed

    • Bump github.com/valyala/fasthttp from 1.38.0 to 1.39.0 by @dependabot in https://github.com/mymmrac/telego/pull/53
    • Bump github.com/goccy/go-json from 0.9.10 to 0.9.11 by @dependabot in https://github.com/mymmrac/telego/pull/54

    Full Changelog: https://github.com/mymmrac/telego/compare/v0.16.0...v0.16.1

    Source code(tar.gz)
    Source code(zip)
  • v0.16.0(Aug 12, 2022)

    Overview

    • Updated to Telegram Bot API v6.2
    • Added more predicates & utilities
    • Fixed bug with multi value return methods
    • Small refactorings

    What's Changed

    • Bump actions/setup-go from 2 to 3 by @dependabot in https://github.com/mymmrac/telego/pull/50
    • Bump github.com/fasthttp/router from 1.4.10 to 1.4.11 by @dependabot in https://github.com/mymmrac/telego/pull/51

    Full Changelog: https://github.com/mymmrac/telego/compare/v0.15.3...v0.16.0

    Source code(tar.gz)
    Source code(zip)
  • v0.15.3(Jul 24, 2022)

    Overview

    • Added new WithHealthCheck option
    • Added Clone method for update
    • Used Clone in bot handlers predicates & update processor utility
    • Added couple new examples
    • Updated CI dependencies

    What's Changed

    • Bump actions/upload-artifact from 1 to 3 by @dependabot in https://github.com/mymmrac/telego/pull/48
    • Bump golangci/golangci-lint-action from 2 to 3 by @dependabot in https://github.com/mymmrac/telego/pull/47
    • Bump github/codeql-action from 1 to 2 by @dependabot in https://github.com/mymmrac/telego/pull/46
    • Bump actions/checkout from 2 to 3 by @dependabot in https://github.com/mymmrac/telego/pull/45
    • Bump actions/download-artifact from 1 to 3 by @dependabot in https://github.com/mymmrac/telego/pull/44

    Full Changelog: https://github.com/mymmrac/telego/compare/v0.15.2...v0.15.3

    Source code(tar.gz)
    Source code(zip)
  • v0.15.2(Jul 20, 2022)

    Overview

    • Added telego: prefix to all methods errors
    • Added CallbackQuery utility
    • Added MessageEntity utilities

    What's Changed

    • Bump github.com/goccy/go-json from 0.9.8 to 0.9.10 by @dependabot in https://github.com/mymmrac/telego/pull/43

    Full Changelog: https://github.com/mymmrac/telego/compare/v0.15.1...v0.15.2

    Source code(tar.gz)
    Source code(zip)
  • v0.15.1(Jul 15, 2022)

    Overview

    • Added telego: prefix to all errors
    • Added router for webhook with github.com/fasthttp/router as options
    • Added basic health API for webhook as options
    • Added UpdateProcessor utility method

    Full Changelog: https://github.com/mymmrac/telego/compare/v0.15.0...v0.15.1

    Source code(tar.gz)
    Source code(zip)
  • v0.15.0(Jul 14, 2022)

    Overview

    • Redesigned long pulling & webhook helpers
    • Added options to modify long pulling & webhook helpers contexts
    • Improved test coverage
    • Improved documentation & README

    Full Changelog: https://github.com/mymmrac/telego/compare/v0.14.0...v0.15.0

    Source code(tar.gz)
    Source code(zip)
  • v0.14.0(Jul 12, 2022)

    Overview

    • Add ability to hide bot token (#33)
    • Fixed race conditions
    • Added race testing CI

    What's Changed

    • Bump github.com/stretchr/testify from 1.7.5 to 1.8.0 by @dependabot in https://github.com/mymmrac/telego/pull/34
    • Bump github.com/goccy/go-json from 0.9.7 to 0.9.8 by @dependabot in https://github.com/mymmrac/telego/pull/35
    • perf: Move the logic for determining which handler to use to the conditioalHandler to the conditional_handler.go by @linbuxiao in https://github.com/mymmrac/telego/pull/38

    New Contributors

    • @linbuxiao made their first contribution in https://github.com/mymmrac/telego/pull/38

    Full Changelog: https://github.com/mymmrac/telego/compare/v0.13.2...v0.14.0

    Source code(tar.gz)
    Source code(zip)
  • v0.13.2(Jun 29, 2022)

    Overview

    • Dependency update of fasthttp & testify
    • Added comments
    • Updated examples

    What's Changed

    • Bump github.com/stretchr/testify from 1.7.4 to 1.7.5 by @dependabot in https://github.com/mymmrac/telego/pull/29
    • Update DefaultLogger in README by @vitkarpov in https://github.com/mymmrac/telego/pull/31
    • Bump github.com/valyala/fasthttp from 1.37.0 to 1.38.0 by @dependabot in https://github.com/mymmrac/telego/pull/30

    New Contributors

    • @vitkarpov made their first contribution in https://github.com/mymmrac/telego/pull/31

    Full Changelog: https://github.com/mymmrac/telego/compare/v0.13.1...v0.13.2

    Source code(tar.gz)
    Source code(zip)
  • v0.13.1(Jun 21, 2022)

    Overview

    • Updated to Telegram Bot API v6.1
    • Updated dependency

    What's Changed

    • Bump github.com/stretchr/testify from 1.7.2 to 1.7.4 by @dependabot in https://github.com/mymmrac/telego/pull/28

    Full Changelog: https://github.com/mymmrac/telego/compare/v0.13.0...v0.13.1

    Source code(tar.gz)
    Source code(zip)
  • v0.13.0(Jun 6, 2022)

    Overview

    • Graceful shutdown for bot handlers
    • Security bug fix of YAML (gopkg.in/yaml.v3)

    Full Changelog: https://github.com/mymmrac/telego/compare/v0.12.1...v0.13.0

    Source code(tar.gz)
    Source code(zip)
  • v0.12.1(May 24, 2022)

    Overview

    • Fixed bug with sending files
    • Updated dependencies (#27)
    • Added some comments

    What's Changed

    • Bump github.com/valyala/fasthttp from 1.36.0 to 1.37.0 by @dependabot in https://github.com/mymmrac/telego/pull/27

    Full Changelog: https://github.com/mymmrac/telego/compare/v0.12.0...v0.12.1

    Source code(tar.gz)
    Source code(zip)
  • v0.12.0(May 10, 2022)

  • v0.11.1(Apr 28, 2022)

    Overview

    • Added more predicates for different types
    • Added all handlers for update values

    What's Changed

    • Bump github.com/valyala/fasthttp from 1.35.0 to 1.36.0 by @dependabot in https://github.com/mymmrac/telego/pull/26

    Full Changelog: https://github.com/mymmrac/telego/compare/v0.11.0...v0.11.1

    Source code(tar.gz)
    Source code(zip)
  • v0.11.0(Apr 26, 2022)

  • v0.10.4(Apr 26, 2022)

    Overview

    • Fixed ChatID bug (#23)
    • Added handlers and predicates for callback query (#24)
    • Updated dependencies (#25)
    • Updated linter

    What's Changed

    • Bump github.com/stretchr/testify from 1.7.0 to 1.7.1 by @dependabot in https://github.com/mymmrac/telego/pull/22
    • Bump github.com/valyala/fasthttp from 1.34.0 to 1.35.0 by @dependabot in https://github.com/mymmrac/telego/pull/25

    Full Changelog: https://github.com/mymmrac/telego/compare/v0.10.3...v0.10.4

    Source code(tar.gz)
    Source code(zip)
  • v0.10.3(Mar 13, 2022)

    Overview

    • Updated dependency
    • Fixed typo in predicates
    • Updated README & other docs

    What's Changed

    • Bump github.com/valyala/fasthttp from 1.33.0 to 1.34.0 by @dependabot in https://github.com/mymmrac/telego/pull/17

    Full Changelog: https://github.com/mymmrac/telego/compare/v0.10.2...v0.10.3

    Source code(tar.gz)
    Source code(zip)
  • v0.10.2(Feb 6, 2022)

  • v0.10.1(Feb 5, 2022)

    Overview

    • Updated predicates
    • Added Bot handlers to README
    • Added example

    Full Changelog: https://github.com/mymmrac/telego/compare/v0.10.0...v0.10.1

    Source code(tar.gz)
    Source code(zip)
  • v0.10.0(Feb 4, 2022)

    Overview

    • Added With methods
    • Added more utility methods
    • Updated examples

    What's Changed

    • With like methods by @mymmrac in https://github.com/mymmrac/telego/pull/16

    Full Changelog: https://github.com/mymmrac/telego/compare/v0.9.3...v0.10.0

    Source code(tar.gz)
    Source code(zip)
  • v0.9.3(Feb 1, 2022)

    Overview

    • Updated to Telegram Bot API v5.7

    What's Changed

    • Bump github.com/valyala/fasthttp from 1.32.0 to 1.33.0 by @dependabot in https://github.com/mymmrac/telego/pull/15

    Full Changelog: https://github.com/mymmrac/telego/compare/v0.9.2...v0.9.3

    Source code(tar.gz)
    Source code(zip)
  • v0.9.2(Jan 15, 2022)

    Overview

    • Updated linters
    • Removed legacy generator
    • Improved Makefile

    What's Changed

    • Bump github.com/valyala/fasthttp from 1.31.0 to 1.32.0 by @dependabot in https://github.com/mymmrac/telego/pull/13
    • Linters by @mymmrac in https://github.com/mymmrac/telego/pull/14

    Full Changelog: https://github.com/mymmrac/telego/compare/v0.9.1...v0.9.2

    Source code(tar.gz)
    Source code(zip)
  • v0.9.1(Jan 9, 2022)

    Overview

    • Updated handlers
    • Divided CI jobs
    • Updated README
    • Added issue and pull request templates
    • Improved docs

    What's Changed

    • Updated issue templates & contribution guidelines [PR Template Test] by @mymmrac in https://github.com/mymmrac/telego/pull/11

    Full Changelog: https://github.com/mymmrac/telego/compare/v0.9.0...v0.9.1

    Source code(tar.gz)
    Source code(zip)
  • v0.9.0(Jan 1, 2022)

    Overview

    • Updated to Telegram Bot API v.5.6
    • New generator (much, much more readable code)
    • Added more unit tests

    Full Changelog: https://github.com/mymmrac/telego/compare/v0.8.1...v0.9.0

    Source code(tar.gz)
    Source code(zip)
  • v0.8.1(Dec 27, 2021)

  • v0.8.0(Dec 27, 2021)

  • v0.7.2(Dec 9, 2021)

  • v0.7.1(Nov 25, 2021)

    Overview

    • Added doc.go
    • Fixed some comments
    • Added example
    • Moved test & generator into internal package

    Full Changelog: https://github.com/mymmrac/telego/compare/v0.7.0...v0.7.1

    Source code(tar.gz)
    Source code(zip)
Owner
Artem Yadelskyi
Developer of Telego (Telegram Bot API library for Golang), part of Gopher Team
Artem Yadelskyi
Pro-bot - A telegram bot to play around with the community telegram channels

pro-bot ?? Pro Bot A Telegram Bot to Play Around With The Community Telegram Cha

TechProber 1 Jan 24, 2022
Full-native go implementation of Telegram API

MTProto Full-native implementation of MTProto protocol on Golang! english русский 简体中文 Features Full native implementation All code, from sending requ

Xelaj technologies 947 Nov 20, 2022
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
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 22 Oct 30, 2022
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
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 331 Nov 11, 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
Telegram bot written in Golang using gotgbot library

go_tgbot Telegram bot written in Golang using gotgbot library. How to run go get -u github.com/itsLuuke/go_tgbot rename sample.env to .env and fill in

Luke 10 Nov 4, 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
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.1k Nov 23, 2022
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
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
Our library to interact with a telegram bot.

gotelegrambot Here you can find our library for telegram bot's. We develop the API endpoints according to our demand and need. You are welcome to help

J&J Ideenschmiede GmbH 0 Dec 18, 2021
A Telegram bot hook for Logrus logging library in Go

logrus2telegram logrus2telegram is a Telegram bot hook for Logrus logging librar

Dmytro Krasun 6 Nov 15, 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
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
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 17 Nov 25, 2022
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