go-telegram is a Go client library for accessing the Telegram API.
go-telegram is compatible with modern Go releases in module mode, with Go installed:
go get github.com/PB-Digital/go-telegram
will resolve and add the package to the current development module, along with its dependencies.
Alternatively the same can be achieved if you use import in a package:
import "github.com/PB-Digital/go-telegram"
import "github.com/PB-Digital/go-telegram"
Construct a new Telegram client, then use the various services on the client to access different parts of the Telegram API.
For example:
client := telegram.NewClient("TELEGRAM_BOT_TOKEN")
// send plain message to Telegram channel or group
client.SendMessage(telegram.Message{
ChatId: "TELEGRAM_GROUP_OR_CHANNEL_ID",
Body: "Hello there!",
})
For more sample code snippets, head over to the example directory.
This library is licensed under the MIT License. See LICENSE for the full license text.