Module: TeleRb::ActionsMethods

Included in:
TelegramBot
Defined in:
lib/telerb/methods/actions_methods.rb

Overview

Message Methods

Instance Method Summary collapse

Instance Method Details

#get_commandsObject



6
7
8
9
10
11
12
# File 'lib/telerb/methods/actions_methods.rb', line 6

def get_commands
  response = CLIENT.get(@config.base_uri("getMyCommands"))
  response.parsed_response["result"]
rescue StandardError => e
  puts "Error getting list of defined commands: #{e.message}"
  nil
end

#set_commands(commands) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/telerb/methods/actions_methods.rb', line 14

def set_commands(commands)
  CLIENT.post(@config.base_uri("setMyCommands"), { commands: commands }.to_json,
              { "Content-Type" => "application/json" })
  "Commands set successfully"
rescue StandardError => e
  puts "Error defining command list: #{e.message}"
  nil
end