1
0
зеркало из https://github.com/glebtv/telegram-bot.git synced 2026-09-04 10:15:50 +03:00

Moved Botan helpers to its namespace

Этот коммит содержится в:
Max Melentiev
2016-05-18 13:02:00 +03:00
родитель 4e539e1867
Коммит 91e0aa2096
5 изменённых файлов: 6 добавлений и 6 удалений

Просмотреть файл

@@ -1,33 +0,0 @@
module Telegram
module Bot
class UpdatesController
# Helpers for botan.io metrics.
module Botan
class MissingFrom < Error; end
protected
def botan
@botan ||= bot.try!(:botan)
end
# Track custom event for user taken from `from` field:
#
# botan_track :my_event, {data: :val}
#
def botan_track(event, data = {})
raise MissingFrom, 'Can not track without user' unless from
botan.try! { |x| x.track(event, from['id'], data) }
end
# Track current action and payload for current user. Best used with `before_action`:
#
# before_action :botan_track_action
#
def botan_track_action
botan_track(action_name, payload)
end
end
end
end
end