Module: Telegruby

Defined in:
lib/telegruby.rb

Defined Under Namespace

Classes: Bot, Message, Update

Class Method Summary collapse

Class Method Details

.read_config(filename) ⇒ Object

Reads an API token from a JSON file. The result of this should be passed to Telegruby::Bot.new



303
304
305
306
307
308
309
310
311
312
313
314
315
# File 'lib/telegruby.rb', line 303

def read_config(filename)
  begin
    data = JSON.parse(File.read(filename))

    if !data.key? "token"
      return false
    end

    return data
  rescue
    return false
  end
end