Categorygithub.com/bots-go-framework/bots-fw-telegram
modulepackage
0.13.6
Repository: https://github.com/bots-go-framework/bots-fw-telegram.git
Documentation: pkg.go.dev

# README

bots-fw-telegram

Telegram module for Strongo bots framework

Structure & key concepts

The tgWebhookHandler struct is implementing botsfw.WebhookHandler interface and is an entry point for all incoming requests from Telegram. To create it you need to call NewTgWebhookHandler() function.

Registering records maker

Setting up dev environment for Telegram bots development

Tunneling to local development environment

To expose local server to the Internet we use ngrok.

ngrok http 4300

Make sure that you have started local GAE server & Firestore emulators - follow instructions from README.md.

After ngrok started you will see something like:

Forwarding    https://****-***-**.ngrok-free.app -> http://localhost:4300

You would need to register the forwarding URL for bot you are testing with Telegram by calling this url:

https://****-***-**.ngrok-free.app/bot/tg/set-webhook?code=BOT_CODE

where ****-***-** is the forwarding URL from ngrok output and BOT_CODE is the code of the bot you are testing.

The bot will be registered using secret tokens that you should set using environment variables:

TELEGRAM_BOT_TOKEN_<BOT_CODE>=<TELEGRAM_BOT_TOKEN>

You can create a personal bot for testing purposes using BotFather.

The bot with the given code should be registered in your app and the value is CASE SENSITIVE.

# Packages

No description provided by the author

# Functions

No description provided by the author
No description provided by the author
EditMessageOnCallbackQuery creates edit message.
No description provided by the author
NewChatMessageUID create new ChatMessageUID.
NewInlineMessageUID creates new inline message UID.
NewTelegramBot creates definition of new telegram bot.
NewTelegramWebhookHandler creates new Telegram webhooks handler.
NewTelegramWebhookInput maps telegram update struct to bots framework interface.

# Constants

PlatformID is 'telegram'.
TgMessageTypeChannelPost is 'channel_post'.
TgMessageTypeEdited is 'edited_message'.
TgMessageTypeEditedChannelPost is 'edited_channel_post'.
TgMessageTypeRegular is 'message'.

# Variables

CallbackCurrent is what?.
Platform is a bots platform descriptor (in this case - for Telegram).

# Structs

ChatMessageUID is what?.
InlineMessageUID is inline message UID.
TgWebhookCallbackQuery is wrapper on callback query.
TgWebhookChat is wrapper for Telegram chat.
TgWebhookInlineQuery is wrapper.

# Interfaces

No description provided by the author
TgChatInstanceDal is Data Access Layer for telegram chat instance Data.
TgWebhookInput is a wrapper of telegram update struct to bots framework interface.

# Type aliases

CallbackAnswer is callback answer message.
ExportChatInviteLink is TG message.
InlineBotMessage is wrapper for Telegram bot message.
LeaveChat is leave chat message from bot.
TgMessageType represents tpye of Telegram message.