class Telegram::BotManager::Controller
Public Class Methods
new(bot, controller, **options)
click to toggle source
Calls superclass method
# File lib/telegram/bot_manager/controller.rb, line 15 def initialize(bot, controller, **options) super(bot, controller, **options) rescue => exception rescue_with_handler(exception) end
Private Instance Methods
log_action() { || ... }
click to toggle source
# File lib/telegram/bot_manager/controller.rb, line 23 def log_action(&block) if Telegram::BotManager.configuration.controller_logging timer_start = Time.now payload_data = payload['text'] || payload['data'] logger.info "\nProcessing '#{payload_data.to_s.bold.cyan}' from user #{from['id'].to_s.bold.magenta} for chat id #{chat['id']}" logger.info "* Recognized action #{self.action_name.to_s.bold.green}" yield logger.info "Processing completed in #{Time.now - timer_start} sec\n" else yield end end
logger()
click to toggle source
# File lib/telegram/bot_manager/controller.rb, line 45 def logger unless Telegram::BotManager.configuration.controller_logging raise 'Implement logger method in controller' end end
rescue_with_handler(exception)
click to toggle source
# File lib/telegram/bot_manager/controller.rb, line 38 def rescue_with_handler(exception) logger.error "\nException caught...".bold.red logger.error exception.full_message raise exception end