diff --git a/README.md b/README.md index 811e91f0..eada4a5b 100644 --- a/README.md +++ b/README.md @@ -181,7 +181,7 @@ all available `TDLib` [methods](https://core.telegram.org/tdlib/docs/classtd_1_1 `TDLib` JSON interface adheres to semantic versioning and versions with the same major version number are binary and backward compatible, but the underlying `TDLib` API can be different for different minor and even patch versions. If you need to support different `TDLib` versions then you can use a value of the `version` option to find exact `TDLib` version and to use appropriate API then. -See [example/python/tdjson_example.py](https://github.com/tdlib/td/tree/master/example/python/tdjson_example.py) and [example/ruby/example.rb](https://github.com/tdlib/td/tree/master/example/ruby/example.rb) for examples of such usage. +See [example/python/tdjson_example.py](https://github.com/tdlib/td/tree/master/example/python/tdjson_example.py) for an example of such usage. ## License diff --git a/example/README.md b/example/README.md index 111dfe6f..af92f4b6 100644 --- a/example/README.md +++ b/example/README.md @@ -170,7 +170,6 @@ See [d-tdlib-service](https://github.com/Lord-Evil/d-tdlib-service) for an examp TDLib can be used from the Ruby programming language through the [JSON](https://github.com/tdlib/td#using-json) interface. See [tdlib-ruby](https://github.com/centosadmin/tdlib-ruby) for examples of Ruby bindings and a client for TDLib. -See [example/ruby](https://github.com/tdlib/td/tree/master/example/ruby) for an example of logging in to Telegram using TDLib and `tdlib-ruby` gem. ## Using TDLib in Clojure projects diff --git a/example/ruby/Gemfile b/example/ruby/Gemfile deleted file mode 100644 index 3a38ffc0..00000000 --- a/example/ruby/Gemfile +++ /dev/null @@ -1,3 +0,0 @@ -source 'https://rubygems.org' - -gem 'tdlib-ruby' diff --git a/example/ruby/Gemfile.lock b/example/ruby/Gemfile.lock deleted file mode 100644 index 4305597a..00000000 --- a/example/ruby/Gemfile.lock +++ /dev/null @@ -1,17 +0,0 @@ -GEM - remote: https://rubygems.org/ - specs: - concurrent-ruby (1.0.5) - dry-configurable (0.7.0) - concurrent-ruby (~> 1.0) - tdlib-ruby (0.2.0) - dry-configurable (~> 0.7) - -PLATFORMS - ruby - -DEPENDENCIES - tdlib-ruby - -BUNDLED WITH - 1.16.1 diff --git a/example/ruby/example.rb b/example/ruby/example.rb deleted file mode 100644 index 4b29dfd5..00000000 --- a/example/ruby/example.rb +++ /dev/null @@ -1,61 +0,0 @@ -require 'tdlib-ruby' - -TD.configure do |config| - config.lib_path = 'path/to/dir_containing_lobtdjson' - - # You should obtain your own api_id and api_hash from https://my.telegram.org/apps - config.client.api_id = 12345 - config.client.api_hash = '1234567890abcdefghigklmnopqrstuv' -end - -TD::Api.set_log_verbosity_level(1) - -client = TD::Client.new - -begin - state = nil - - client.on('updateAuthorizationState') do |update| - next unless update.dig('authorization_state', '@type') == 'authorizationStateWaitPhoneNumber' - state = :wait_phone - end - - client.on('updateAuthorizationState') do |update| - next unless update.dig('authorization_state', '@type') == 'authorizationStateWaitCode' - state = :wait_code - end - - client.on('updateAuthorizationState') do |update| - next unless update.dig('authorization_state', '@type') == 'authorizationStateReady' - state = :ready - end - - loop do - case state - when :wait_phone - p 'Please, enter your phone number:' - phone = STDIN.gets.strip - params = { - '@type' => 'setAuthenticationPhoneNumber', - 'phone_number' => phone - } - client.broadcast_and_receive(params) - when :wait_code - p 'Please, enter code from SMS:' - code = STDIN.gets.strip - params = { - '@type' => 'checkAuthenticationCode', - 'code' => code - } - client.broadcast_and_receive(params) - when :ready - @me = client.broadcast_and_receive('@type' => 'getMe') - break - end - end - -ensure - client.close -end - -p @me