Go bindings for Telegram Bot API.
Supports most Bot APIs in version 4.9, except:
import (
"github.com/deadblue/telegram-bot"
"github.com/deadblue/telegram-bot/parameters"
"github.com/deadblue/telegram-bot/parameters/keyboard"
"github.com/deadblue/telegram-bot/parameters/text"
)
// Create a bot instance
bot := telegram.New("your_bot_token")
// Get bot information
me, err := bot.GetMe()
if err != nil {
panic(err)
}
// Prepare text message parameters
params := new(parameters.SendMessageParams)
params.ChatId(1234)
params.Text(text.MarkdownV2("*Hello, world*"))
params.InlineKeyboard( (&keyboard.InlineBuilder{}).
AddUrlButton("URL", "https://dead.blue").
Build() )
// Send message
msg, err := bot.SendMessage(params)
if err != nil {
panic(err)
}
MIT