🏋️ Strongo Bots Go Framework
A Go language framework to develop bots for messengers.
Developed & shared by Sneat-co & Strongo teams with usage of dalgo library.
Reasons to use:
- Same code can work across different messenger (Telegram, Facebook Messenger, Viber, Skype, Line, Kik, WeChat, etc.)
- You can tune your code to a specific messenger's UX.
- i18n & l10n support (multilingual)
- Can be hosted in cloud or just as a standard Go HTTP server. Supports AppEngine standard environment.
- It's fast
- help with code coverage needed.
func InitBot(httpRouter HttpRouter, botHost bots.BotHost, appContext common.DebtsTrackerAppContext) {
driver := bots.NewBotDriver( // Orchestrate requests to appropriate handlers
bots.AnalyticsSettings{GaTrackingID: common.GA_TRACKING_ID}, // TODO: Refactor to list of analytics providers
appContext, // Holds User entity kind name, translator, etc.
botHost, // Defines how to create context.Context, HttpClient, DB, etc...
"Please report any issues to @DebtsTrackerGroup", // Is it wrong place? Router has similar.
)
driver.RegisterWebhookHandlers(httpRouter, "/bot",
telegram.NewTelegramWebhookHandler(
telegramBotsWithRouter, // Maps of bots by code, language, token, etc...
newTranslator, // Creates translator that gets a context.Context (for logging purpose)
),
viber.NewViberWebhookHandler(
viber.Bots,
newTranslator,
),
fbm.NewFbmWebhookHandler(
fbm.Bots,
newTranslator,
),
)
}
The best way to learn is to see examples of usage. Here is few:
- ⚫⚪ Reversi game - open source game. ( Telegram: @ReversiGameBot)
- ✖️⭕ Bidding Tic-Tac-Toe - open source game. ( Telegram: @BiddingTicTacToeBot)
- 📃✂️ Rock-Paper-Scissors - open source game. ( Telegram: @playRockPaperScissorsBot)
- 💸📝 Debtus.app — a bot & a reminder service that helps to track your debts & credits. Sends automated reminders to you & your debtors (in messenger, email, SMS).
We would be happy to place a link to your example / bot that is implemented using this framework.
You can use any Bot API library by implementing couple of simple interface but the framework comes with few buildins:
- bots-go-framework/bots-api-telegram - Go library for * Telegram* Bot API
- bots-go-framework/bots-api-fbm - Go library for Facebook Messenger Bot API
- bots-go-framework/bots-api-viber - Go library for **Viber ** Bot API
- dal-go/dalgo - Database abstraction layer (DAL) in Go language
- strongo/gamp - Golang buffered client for Google Analytics (GA) Measurement Protocol
We are building a cross-table of features supported by different bot APIs.
Thanks to dalgo library the framework can work with different databases. The Db structure is described in README-DB.md.
There are no articles about the Strongo Bots Framework just yet. Send us a link if you find such.
📜 License
Licensed under Apache 2.0 license