1
0
Fork 0

Improve code

This commit is contained in:
Alex Kotov 2018-12-08 03:20:58 +05:00
parent 1b62ef11ec
commit 763c251507
No known key found for this signature in database
GPG key ID: 4E831250F47DE154

View file

@ -26,22 +26,20 @@ private
record: @telegram_bot
end
def handle_message(message) # rubocop:disable Metrics/MethodLength
def handle_message(message)
return if message.blank?
telegram_chat = handle_chat message[:chat]
return if @telegram_bot.username.nil?
return unless message[:text].in? [
'/shrug',
"/shrug@#{@telegram_bot.username}",
]
@telegram_bot.client.send_message(
chat_id: telegram_chat.remote_id,
text: '¯\_(ツ)_/¯',
)
case message[:text]
when '/shrug', "/shrug@#{@telegram_bot.username}"
@telegram_bot.client.send_message(
chat_id: telegram_chat.remote_id,
text: '¯\_(ツ)_/¯',
)
end
end
def handle_chat(chat)