You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Go to file
Ilya Kowalewski 418934be9c Fix for a stupid arch solution 9 years ago
.gitignore Initial commit 9 years ago
LICENSE Initial commit 9 years ago
README.md Update README.md 9 years ago
api.go Message forwarding 9 years ago
bot.go Fix for a stupid arch solution 9 years ago
errors.go A little more documentation, code cleanup 9 years ago
message.go Message forwarding 9 years ago
telebot.go A little more documentation, code cleanup 9 years ago
telebot_test.go All message types and replying/forwarding from API covered. 9 years ago
types.go Message forwarding 9 years ago

README.md

Telebot

Telebot is a convenient wrapper to Telegram Bots API, written in Golang.

GoDoc

Bots are special Telegram accounts designed to handle messages automatically. Users can interact with bots by sending them command messages in private or group chats. These accounts serve as an interface for code running somewhere on your server.

Telebot offers a convenient wrapper to Bots API, so you shouldn't even care about networking at all.

import (
    "time"
    "github.com/tucnak/telebot"
)

func main() {
    bot, err := telebot.Create("SECRET TOKEN")
    if err != nil {
        return
    }

    messages := make(chan telebot.Message)
    bot.Listen(messages, 1*time.Second)

    for message := range messages {
        if message.Text == "/hi" {
            bot.SendMessage(message.Chat,
                "Hello, "+message.Sender.FirstName+"!")
        }
    }
}