Class: ActionBot::Controller
- Inherits:
-
Object
- Object
- ActionBot::Controller
- Defined in:
- lib/action_bot/controller.rb
Instance Attribute Summary collapse
-
#params ⇒ Object
Returns the value of attribute params.
Instance Method Summary collapse
- #api ⇒ Object
- #bot ⇒ Object
- #mention(id, name) ⇒ Object
- #notify(tg_chat_id, text, mode = nil) ⇒ Object
- #t(*args) ⇒ Object
Instance Attribute Details
#params ⇒ Object
Returns the value of attribute params.
3 4 5 |
# File 'lib/action_bot/controller.rb', line 3 def params @params end |
Instance Method Details
#api ⇒ Object
23 24 25 |
# File 'lib/action_bot/controller.rb', line 23 def api ActionBot::Base.config.api || bot.api end |
#bot ⇒ Object
27 28 29 |
# File 'lib/action_bot/controller.rb', line 27 def bot ActionBot::Base.config.bot end |
#mention(id, name) ⇒ Object
14 15 16 |
# File 'lib/action_bot/controller.rb', line 14 def mention(id, name) "[#{name}](tg://user?id=#{id})" end |
#notify(tg_chat_id, text, mode = nil) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/action_bot/controller.rb', line 5 def notify(tg_chat_id, text, mode = nil) return notify_chat(tg_chat_id, text, mode) unless text.respond_to?(:each) text.each do || sleep(0.5) notify_chat(tg_chat_id, , mode) end end |
#t(*args) ⇒ Object
18 19 20 21 |
# File 'lib/action_bot/controller.rb', line 18 def t(*args) I18n.locale = load_chat.locale I18n.t(*args) end |