• This repository has been archived on 06/Sep/2018
  • Stars
    star
    13
  • Rank 1,464,550 (Top 30 %)
  • Language
    Crystal
  • License
    MIT License
  • Created almost 7 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A convenient Telegram Bot framework ๐Ÿค–

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

More Repositories

1

unity-wakatime

WakaTime plugin for Unity โฑ
C#
116
star
2

crystalworld

RealWorld back-end API implementation ๐Ÿ‘
Crystal
43
star
3

migrate.cr

A database migration solution ๐Ÿšœ
Crystal
31
star
4

i18n.cr

Internationalization shard ๐ŸŒ
Crystal
24
star
5

jbuilder-json_api

Jbuilder meets jsonapi.org specifications
Ruby
23
star
6

http-multiserver.cr

Mount multiple web applications ๐Ÿšฆ
Crystal
23
star
7

http-params-serializable

The HTTP params parsing module for Crystal ๐Ÿค“
Crystal
20
star
8

tarantool.cr

The Tarantool driver (a.k.a. connector) ๐Ÿ•ท
Crystal
19
star
9

mini_redis

A light-weight low-level Redis client for Crystal โ™จ๏ธ
Crystal
18
star
10

validations.cr

Validations module for Crystal โœ…
Crystal
13
star
11

callbacks.cr

Expressive callbacks module for Crystal ๐Ÿš‰
Crystal
12
star
12

background

Fast background job processing
Crystal
11
star
13

stripe.cr

๐Ÿšง WIP ๐Ÿšง Stripe API wrapper ๐Ÿ’ณ
Crystal
7
star
14

onyx-http-deprecated

Deprecated Onyx module
Crystal
6
star
15

cake-bake

Bake Cakefile into native Crystal code ๐Ÿž
Crystal
5
star
16

time-span-humanize

Time::Span#humanize method
Crystal
5
star
17

crack

Alternative Crystal HTTP server implementation
Crystal
5
star
18

timer.cr

A versatile timer module โฒ
Crystal
4
star
19

realworld-benchmark

RealWorld Benchmark
Crystal
3
star
20

onyx-40-loc-distributed-chat

Distributed websocket chat in 40 lines of code
JavaScript
2
star
21

time_format.cr

Time spans formatting made simple โŒš๏ธ
Crystal
2
star
22

Expense-Manager-2

Java
1
star
23

attribute_enum

Rails-like enums with ease
Ruby
1
star
24

tele-broadcast.cr

Broadcasting for Tele ๐Ÿ“ข
Crystal
1
star