Marketplace
<div align="center"> <h3>Premium sponsors</h3> <p> <a href="https://id8media.com"><strong>ID8 Media</strong></a> · <a href="https://one-studio.co"><strong>One Studio</strong></a> </p> <p><sub>Support togo — <a href="https://github.com/sponsors/fadymondy">become a sponsor</a>.</sub></p> </div>
Telegram Bot
OtherTelegram bot driver (long-polling).
togo-framework
bash
togo install togo-framework/bot-telegramInstall
bash
togo install togo-framework/bot
togo install togo-framework/bot-telegramThe Telegram driver for togo's bot
subsystem, built on go-telegram-bot-api.
It long-polls Telegram and dispatches each message to the bot command/message
handlers you register once with bot.OnCommand / bot.OnMessage.
Configure
Get a token from @BotFather, then set:
bash
BOT_DRIVER=telegram
TELEGRAM_BOT_TOKEN=123456:ABC-DEF...
# TELEGRAM_POLL_TIMEOUT=30 # optional long-poll seconds
Blank-import the driver next to the base:
go
import (
_ "github.com/togo-framework/bot"
_ "github.com/togo-framework/bot-telegram"
)
Register handlers (see the bot README):
go
bot.OnCommand("ping", func(ctx context.Context, b *bot.Service, m bot.Message) (string, error) {
return "pong 🏓", nil
})
m.Channel is the numeric chat ID (as a string); Service.Send(ctx, channel, msg)
replies to it. Commands of the form /cmd@YourBot are matched as cmd.
License
MIT © togo-framework
<div align="center"> <h3>Premium sponsors</h3> <p> <a href="https://id8media.com"><strong>ID8 Media</strong></a> · <a href="https://one-studio.co"><strong>One Studio</strong></a> </p> <p><sub>Support togo — <a href="https://github.com/sponsors/fadymondy">become a sponsor</a>.</sub></p> </div>