{"id":13512331,"url":"https://github.com/southbridgeio/tdlib-ruby","last_synced_at":"2025-03-30T22:32:34.788Z","repository":{"id":45572057,"uuid":"120422052","full_name":"southbridgeio/tdlib-ruby","owner":"southbridgeio","description":"Ruby bindings and client for TDLib","archived":false,"fork":false,"pushed_at":"2024-12-25T13:44:40.000Z","size":419,"stargazers_count":100,"open_issues_count":1,"forks_count":47,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-13T12:38:02.042Z","etag":null,"topics":["libtdjson","tdlib","tdlib-ruby","telegram","telegram-api","telegram-client"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/southbridgeio.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-02-06T08:08:36.000Z","updated_at":"2025-03-10T01:27:26.000Z","dependencies_parsed_at":"2024-09-06T12:22:21.985Z","dependency_job_id":"7196bf45-f9d8-4bc5-b483-1f9a9d7900ca","html_url":"https://github.com/southbridgeio/tdlib-ruby","commit_stats":null,"previous_names":["centosadmin/tdlib-ruby"],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/southbridgeio%2Ftdlib-ruby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/southbridgeio%2Ftdlib-ruby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/southbridgeio%2Ftdlib-ruby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/southbridgeio%2Ftdlib-ruby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/southbridgeio","download_url":"https://codeload.github.com/southbridgeio/tdlib-ruby/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246390880,"owners_count":20769476,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["libtdjson","tdlib","tdlib-ruby","telegram","telegram-api","telegram-client"],"created_at":"2024-08-01T03:01:44.197Z","updated_at":"2025-03-30T22:32:29.777Z","avatar_url":"https://github.com/southbridgeio.png","language":"Ruby","readme":"# tdlib-ruby\n\n[![Maintainability](https://api.codeclimate.com/v1/badges/9362ca2682b7edbae205/maintainability)](https://codeclimate.com/github/centosadmin/tdlib-ruby/maintainability) [![Build Status](https://travis-ci.org/southbridgeio/tdlib-ruby.svg?branch=master)](https://travis-ci.org/centosadmin/tdlib-ruby)\n\n## Description\n\nRuby bindings and client for TDLib (Telegram database library).\n\n## Requirements\n\n* Ruby 2.4+\n* Compiled [tdlib](https://github.com/tdlib/td)\n\nWe have precompiled versions for CentOS 6 \u0026 7 in our repositories:\n\nhttp://rpms.southbridge.ru/rhel7/stable/x86_64/\n\nhttp://rpms.southbridge.ru/rhel6/stable/x86_64/\n\nAnd also SRPMS:\n\nhttp://rpms.southbridge.ru/rhel7/stable/SRPMS/\n\nhttp://rpms.southbridge.ru/rhel6/stable/SRPMS/\n\n## Compatibility table\n\n| Gem Version   |   | tdlib version |\n|:-------------:|:-:| :-----------: |\n| 1.x           | → | 1.0 - 1.2     |\n| 2.0           | → | 1.3           |\n| 2.1           | → | 1.5           |\n| 2.2           | → | 1.6           |\n\nIMPORTANT: From version 3.0 types schema is extracted to a separate gem: https://github.com/southbridgeio/tdlib-schema\nIf you want to support specific tdlib version, just set a dependency in your Gemfile:\n\n```ruby\ngem 'tdlib-schema', '~\u003e 1.7.0'\n```\n\n## Install\n\nAdd to your gemfile:\n\n```ruby\ngem 'tdlib-ruby'\n```\nand run *bundle install*.\n\n\nOr just run *gem install tdlib-ruby*\n\n## Basic authentication example\n\n```ruby\nrequire 'tdlib-ruby'\n\nTD.configure do |config|\n  config.lib_path = 'path_to_dir_containing_tdlibjson'\n\n  config.client.api_id = your_api_id\n  config.client.api_hash = 'your_api_hash'\nend\n\nTD::Api.set_log_verbosity_level(1)\n\nclient = TD::Client.new\n\nbegin\n  state = nil\n\n  client.on(TD::Types::Update::AuthorizationState) do |update|\n    state = case update.authorization_state\n            when TD::Types::AuthorizationState::WaitPhoneNumber\n              :wait_phone_number\n            when TD::Types::AuthorizationState::WaitCode\n              :wait_code\n            when TD::Types::AuthorizationState::WaitPassword\n              :wait_password\n            when TD::Types::AuthorizationState::Ready\n              :ready\n            else\n              nil\n            end\n  end\n  \n  client.connect\n\n  loop do\n    case state\n    when :wait_phone_number\n      puts 'Please, enter your phone number:'\n      phone = STDIN.gets.strip\n      client.set_authentication_phone_number(phone_number: phone, settings: nil).wait\n    when :wait_code\n      puts 'Please, enter code from SMS:'\n      code = STDIN.gets.strip\n      client.check_authentication_code(code: code).wait\n    when :wait_password\n      puts 'Please, enter 2FA password:'\n      password = STDIN.gets.strip\n      client.check_authentication_password(password: password).wait\n    when :ready\n      client.get_me.then { |user| @me = user }.rescue { |err| puts \"error: #{err}\" }.wait\n      break\n    end\n    sleep 0.1\n  end\n\nensure\n  client.dispose\nend\n\np @me\n```\n\nClient methods are being executed asynchronously and return Concurrent::Promises::Future (see: https://github.com/ruby-concurrency/concurrent-ruby/blob/master/docs-source/promises.in.md).\n\n## Configuration\n\n```ruby\nTD.configure do |config|\n  config.lib_path = 'path/to/dir_containing_libtdjson' # libtdjson will be searched in this directory (*.so, *.dylib, *.dll are valid extensions). For Rails projects, if not set, will be considered as project_root_path/vendor. If not set and file doesn't exist in vendor, it will try to find lib by ldconfig (only on Linux).\n  config.encryption_key = 'your_encryption_key' # it's not required\n\n  config.client.api_id = 12345\n  config.client.api_hash = 'your_api_hash'\n  config.client.use_test_dc = true # default: false\n  config.client.database_directory = 'path/to/db/dir' # default: \"#{Dir.home}/.tdlib-ruby/db\"\n  config.client.files_directory = 'path/to/files/dir' # default: \"#{Dir.home}/.tdlib-ruby/files\"\n  config.client.use_file_database = true # default: true\n  config.client.use_chat_info_database = true # default: true\n  config.client.use_secret_chats = true # default: true\n  config.client.use_message_database = true # default: true\n  config.client.system_language_code = 'ru' # default: 'en'\n  config.client.device_model = 'Some device model' # default: 'Ruby TD client'\n  config.client.system_version = '42' # default: 'Unknown'\n  config.client.application_version = '1.0' # default: '1.0'\n  config.client.enable_storage_optimizer = true # default: true\n  config.client.ignore_file_names = true # default: false\nend\n```\n\n## Advanced\n\nYou can get rid of large tdlib log with\n\n```ruby\nTD::Api.set_log_verbosity_level(1)\n```\n\nYou can also set log file path:\n\n```ruby\nTD::Api.set_log_file_path('path/to/log_file')\n```\n\nAdditional options can be passed to client:\n\n```ruby\nTD::Client.new(database_directory: 'will override value from config',\n               files_directory: 'will override value from config')\n```\n\nIf the tdlib schema changes, then `./bin/parse` can be run to\nsynchronize the Ruby types with the new schema. Please look through\n`lib/tdlib/client_methods.rb` carefully, especially the set_password\nmethod!\n\n\n## License\n\n[MIT](https://github.com/centosadmin/tdlib-ruby/blob/master/LICENSE.txt)\n\n## Authors\n\nThe gem is designed by [Southbridge](https://southbridge.io)\n\nTypeization made by [Yuri Mikhaylov](https://github.com/yurijmi) \n","funding_links":[],"categories":["Ruby"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsouthbridgeio%2Ftdlib-ruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsouthbridgeio%2Ftdlib-ruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsouthbridgeio%2Ftdlib-ruby/lists"}