/gotgproto

A helper package for Go Telegram Client, i.e. gotd/td.

Primary LanguageGoGNU General Public License v3.0GPL-3.0

GoTGProto

GoTGProto is a helper package for gotd library, It aims to make td's raw functions easy-to-user with the help of features like using session strings, custom helper functions, storing peers and extracting chat or user ids through it etc.

You can use this package to create bots and userbots with Telegram MTProto easily in golang, for any futher help you can check out the documentations or reach us through the following:

  • Updates Channel: Channel
  • Support Chat: Chat

Go Reference GPLv3 license

Note: This library is in the beta stage yet and may not be stable for every case.

Installation

You can download the library with the help of standard go get command.

go get github.com/anonyindian/gotgproto

Usage

You can find various examples in the examples' directory, one of them i.e. authorizing as a user is as follows:

package main
import (
	"context"
	"github.com/anonyindian/gotgproto"
	"github.com/anonyindian/gotgproto/dispatcher"
	"github.com/anonyindian/gotgproto/sessionMaker"
	"github.com/gotd/td/telegram"
)
func main() {
    dp := dispatcher.MakeDispatcher()
    gotgproto.StartClient(gotgproto.ClientHelper{
		AppID: 1234567,
		ApiHash: "API_HASH_HERE",
		Session: sessionMaker.NewSession("session_name", sessionMaker.Session),
		Phone: "PHONE_NUMBER_HERE",
		Dispatcher: dp,
		TaskFunc: func(ctx context.Context, client *telegram.Client) error {
			return nil
		},
	})
}

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update examples as appropriate.

License

GPLv3
Licensed Under GNU General Public License v3