-
Notifications
You must be signed in to change notification settings - Fork 0
/
got_surf_bot.rb
29 lines (24 loc) · 981 Bytes
/
got_surf_bot.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
require 'telegram/bot'
require_relative 'helpers/bot_helper'
require_relative 'helpers/bot_message'
require_relative 'comms/got_surf_service'
#require_relative 'helpers/config_helper'
Telegram::Bot::Client.run(ENV[:TELEGRAM_TOKEN.to_s]) do |bot|
bot.listen do |message|
ConfigHelper.log(message)
case message
when Telegram::Bot::Types::InlineQuery
items = GotSurfService.new.get_swell(message.query)
BotMessage.send_query_response(bot, message.id, items, true)
when Telegram::Bot::Types::Message
if message.text.downcase.include? "help"
BotMessage.send_bot_response(bot, message.chat.id, nil, ConfigHelper.get_text_message(:help))
end
if message.text.downcase.include? "start"
BotMessage.send_bot_response(bot, message.chat.id, BotHelper.inline_markup)
else
BotMessage.send_bot_response(bot, message.chat.id, BotHelper.inline_markup,ConfigHelper.get_bot_message(:list))
end
end
end
end