command
module
Version:
v0.0.0-...-3bc3f20
Opens a new window with list of versions in this module.
Published: Nov 10, 2021
License: MIT
Opens a new window with license information.
Imports: 5
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
This example shows how to write an echo telebot for AWS Lambda and how to launch it using Terraform.
This bot is different from a typical bot in two ways:
-
It is configured with Settings.Synchronous = true. This disables asynchronous handlers to let Lambda wait for their completion:
b, _ := tb.NewBot(tb.Settings{Token: token, Synchronous: true})
-
Instead of Settings.Poller and bot.Start it calls bot.ProcessUpdate inside lambda.Start:
lambda.Start(func(req events.APIGatewayProxyRequest) (err error) {
var u tb.Update
if err = json.Unmarshal([]byte(req.Body), &u); err == nil {
b.ProcessUpdate(u)
}
return
})
To launch the bot install Terraform, run ./init.sh and then ./deploy.sh. To tear down the cloud infrastructure run terraform destroy.
Documentation
¶
There is no documentation for this package.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.