proton

Version, currently master branch1 version
  • master branchlatestDec 11, 2021

github.com/protoncr/proton

TDLib wrapper for Crystal

12 stars
1 dependent
License: MIT

Installation

# Add this to your shard.yml
dependencies:
  proton:
    github: protoncr/proton
    branch: master

master is a branch, not a release, so this tracks it rather than pinning a version.

Then run:

shards install

shard.yml

Crystal
0.31.1
License
MIT
Author
Chris Watson

Dependencies

Runtime Dependencies

  • magic*github: dscottboggs/magic.cr, branch: master
  • markd*github: icyleaf/markd
  • tl_parser*github: protoncr/tl_parser, branch: master

README

Proton

Chat on Telegram

Proton is a client library for Telegram. It uses tdlib as a backbone, and builds on top of it by adding several convenience classes and methods. The overarching goal is to have something as friendly as Telethon, with the tdlib bindings eventually being replaced by a pure Crystal alternative.

Installation

  1. Clone tdlib from here, build it, and make sure it's installed and available in your library path. Typically this should be either /usr/lib or /usr/local/lib.

  2. Add the dependency to your shard.yml:

    dependencies:
      proton:
        github: protoncr/proton
        branch: master
  3. Run shards install

  4. Profit

Usage

Check the example directory for a simple userbot example.

Authenticating

require "proton"

class Userbot < Proton::Client
  # Stuff
end

auth_flow = Proton::TerminalAuthFlow.new(encryption_key: "SOME_DB_ENCRYPTION_KEY")

userbot = Userbot.new(
  api_id: 12345,
  api_hash: "0123456789abcdef0123456789abcdef",
  auth_flow: auth_flow,
  verbosity_level: 0 # This is the tdlib verbosity
)

Userbot.start

Contributing

  1. Fork it (https://github.com/protoncr/proton/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors