Class: EurekaBot::Tg::Controller
- Inherits:
-
Controller
- Object
- Controller
- EurekaBot::Tg::Controller
show all
- Extended by:
- ActiveSupport::Autoload
- Includes:
- RepliesConcern
- Defined in:
- lib/eureka_bot/tg/controller.rb
Defined Under Namespace
Modules: RepliesConcern
Classes: Response, SystemController
Instance Method Summary
collapse
#global_reply_markup, #reply_markup
Instance Method Details
#answer(params = {}) ⇒ Object
11
12
13
|
# File 'lib/eureka_bot/tg/controller.rb', line 11
def answer(params={})
super({params: {chat_id: chat_id}}.deep_merge(params))
end
|
#chat ⇒ Object
19
20
21
|
# File 'lib/eureka_bot/tg/controller.rb', line 19
def chat
message.dig('message', 'chat') || message.dig('callback_query', 'message', 'chat') || raise("Cant find chat in #{message}")
end
|
#chat_id ⇒ Object
27
28
29
|
# File 'lib/eureka_bot/tg/controller.rb', line 27
def chat_id
chat['id']
end
|
#client ⇒ Object
39
40
41
|
# File 'lib/eureka_bot/tg/controller.rb', line 39
def client
EurekaBot::Tg.client
end
|
#from ⇒ Object
23
24
25
|
# File 'lib/eureka_bot/tg/controller.rb', line 23
def from
message.dig('message', 'from') || message.dig('callback_query', 'from') || raise("Cant find from in #{message}")
end
|
#message_id ⇒ Object
31
32
33
|
# File 'lib/eureka_bot/tg/controller.rb', line 31
def message_id
message.dig('message', 'message_id') || message.dig('callback_query', 'message', 'message_id') || raise("Cant find message_id in #{message}")
end
|
#reply(params = {}) ⇒ Object
15
16
17
|
# File 'lib/eureka_bot/tg/controller.rb', line 15
def reply(params={})
answer(params.deep_merge({params: {reply_to_message_id: message_id}}))
end
|
#response_class ⇒ Object
35
36
37
|
# File 'lib/eureka_bot/tg/controller.rb', line 35
def response_class
EurekaBot::Tg::Controller::Response
end
|