-
-
Notifications
You must be signed in to change notification settings - Fork 38
Kemal Middleware
Chris Watson edited this page Sep 7, 2019
·
1 revision
If you're not aware, kemal is a lightweight web application framework for Crystal similar to Ruby's Sinatra. It is extremely fast, and prefect for hosting a Telegram bot, especially if you wish to also integrate a web front end, API, etc.
Using Tourmaline in your Kemal project is pretty simple:
require "kemal"
require "tourmaline/adapters/kemal"
require "./yourbot" # change this to your bot
# Add handler is a Kemal method for adding middleware
add_handler Tourmaline::KemalAdapter.new(
# pass in a new instance of your bot
bot: YourBot.new,
# set the url
url: "https://something.com",
# set the path to serve the webhook on
path: "/bot-webhook/#{ENV["TGBOT_API_KEY"]}"
)
Kemal.run
Tourmaline (and many other projects) was written by watzon. It is free software, but if you feel so inclined you could sponsor its development on Patreon. Thank you for using my projects!
- Webhooks
- Inline Actions
- Reply Keyboards
- Games (coming soon)
- Stickers (coming soon)
- Payments