зеркало из
https://github.com/glebtv/telegram-bot.git
synced 2026-09-03 17:55:52 +03:00
v0.1.0
Этот коммит содержится в:
26
lib/telegram/bot/middleware.rb
Обычный файл
26
lib/telegram/bot/middleware.rb
Обычный файл
@@ -0,0 +1,26 @@
|
||||
require 'active_support/concern'
|
||||
require 'action_dispatch/http/mime_type'
|
||||
require 'action_dispatch/middleware/params_parser'
|
||||
|
||||
module Telegram
|
||||
class Bot
|
||||
class Middleware
|
||||
attr_reader :bot, :controller
|
||||
|
||||
def initialize(bot, controller)
|
||||
@bot = bot
|
||||
@controller = controller
|
||||
end
|
||||
|
||||
def call(env)
|
||||
update = env['action_dispatch.request.request_parameters']
|
||||
controller.dispatch(bot, update)
|
||||
[200, {}, '']
|
||||
end
|
||||
|
||||
def inspect
|
||||
"#<#{self.class.name}(#{controller.try!(:name)})>"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Ссылка в новой задаче
Block a user