Module: Telegruby
- Defined in:
- lib/telegruby.rb
Defined Under Namespace
Class Method Summary collapse
-
.collect_msgs(update) ⇒ Object
Given an Update object, gets messages as structs.
-
.read_config(filename) ⇒ Object
Reads an API token from a JSON file.
Class Method Details
.collect_msgs(update) ⇒ Object
Given an Update object, gets messages as structs.
257 258 259 260 261 |
# File 'lib/telegruby.rb', line 257 def collect_msgs(update) update.result.map { |msg| Message.new(msg) } end |
.read_config(filename) ⇒ Object
Reads an API token from a JSON file. The result of this should be passed to Telegruby::Bot.new
242 243 244 245 246 247 248 249 250 251 252 253 254 |
# File 'lib/telegruby.rb', line 242 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 |