Skip to content
This repository has been archived by the owner. It is now read-only.
A convenient Telegram Bot framework 🤖
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
example
spec
src
.editorconfig
.gitignore
.travis.yml
LICENSE
README.md
shard.yml

README.md

Tele

A convenient Telegram Bot API framework.

Build Status Docs Dependency Status GitHub release

Installation

Add this to your application's shard.yml:

dependencies:
  tele:
    github: vladfaust/tele.cr
    version: ~> 0.1.4

Usage

require "tele"

class Start < Tele::Handlers::Message
  def call
    send_message(
      text: "Hello, <b>#{message.from.not_nil!.first_name}</b>!",
      parse_mode: "HTML",
    )
  end
end

class ExampleBot < Tele::Bot
  @@name = "ExampleBot"

  def handle(update)
    if message = update.message
      Start
    end
  end
end

bot = ExampleBot.new("BOT_API_TOKEN", 5000, Logger.new(STDOUT))
bot.set_webhook(URI.new(scheme: "https", host: "example.com"))
bot.listen

# => ExampleBot @ using Tele v0.1.0 by @vladfaust
# => ExampleBot @ webhook set to https://example.com
# => ExampleBot @ listening on port 5000
# => ExampleBot @ incoming text message from user @vladfaust (id 42): "/start"
# => ExampleBot @ handled in 594.0µs

See example/ for a full-featured example implementation.

Development

I love Crystal because if it compiles it means the program will definitely work. This reduces the amount of tests to be written. I personally write tests for SQL queries only. 😄

So there are no any tests for Tele at the moment.

Roadmap

  • Inline queries
  • Sending files
  • Downloading files
  • Multiple requests in one handler
  • Broadcasting with Tele::Broadcast
  • HTTP Client pooling
  • Asynchronous requests
  • User state
  • I18n
  • getUpdates

Request groups to implement

Projects using Tele

Contributing

  1. Create an issue
  2. Fork it https://github.com/vladfaust/tele/fork
  3. Make it git checkout -b issue-42
  4. Do it git commit -am "feat: my feature\n\nFixes #42" (see Commit Message Conventions*)
  5. Makes us git push origin issue-42
  6. Better create a new Pull Request

* Please use these types: feat for new features, fix for bugfixes, ref for code refactoring, doc for documentation improvements, typo for fixing typos. Refer to this commit for a good example.

Contributors

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.