auth_bot

command
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 8, 2022 License: MIT Imports: 7 Imported by: 0

README

Example of using Mtproto for Telegram bot

Mtproto lib can be used with Telegram bot, that can access to full Telegram API, not just the simplified Telegram Bot API.

First, you need to create your telegram bot, like you did this in any another case. Don't know how? Read this official guide

Next we must register our app as usual and obtain all data that we need to run any other examples in this package.

Then fill this code in:

const (
	// from https://my.telegram.org/apps
	TgAppID       = XXXXX                // integer value from "App api_id" field
	TgAppHash     = "XXXXXXXXXXXX"       // string value from "App api_hash" field
	TgTestServer  = "149.154.167.40:443" // string value from "Test configuration" field
	TgProdServer  = "149.154.167.50:443" // string value from "Production configuration" field

	// from https://t.me/BotFather
	TgBotToken    = "XXXXX"  // bot token from BotFather
	TgBotUserName = "YourBotUserName" // username of the bot
)

Okay, you've got bot token, appID, appHash, saved your app public keys, added test and prod ip addresses. What next?

just run in this folder:

go run main.go

And done! That's full example of how to run bot api under mtproto! Easy-peasy!

Documentation

Overview

Example of using Mtproto for Telegram bot

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL