Tourmaline

Crystal Telegram Bot Framework


Quickstart

Tourmaline uses Crystal to communicate with the Telegram Bot API. Therefore to use Tourmaline you should be familiar with how Crystal works.

Once inside of a Crystal project, add Tourmaline to your shard.yml file and run shards install to install it.

For more information, see the getting started page.

require "tourmaline"

client = Tourmaline::Client.new(ENV["BOT_TOKEN"])

echo_handler = Tourmaline::CommandHandler.new("echo") do |ctx|
  text = ctx.text.to_s
    ctx.reply(text) unless text.empty?
end

client.register(echo_handler)

client.poll