Improve code
This commit is contained in:
parent
1b62ef11ec
commit
763c251507
1 changed files with 8 additions and 10 deletions
|
@ -26,22 +26,20 @@ private
|
||||||
record: @telegram_bot
|
record: @telegram_bot
|
||||||
end
|
end
|
||||||
|
|
||||||
def handle_message(message) # rubocop:disable Metrics/MethodLength
|
def handle_message(message)
|
||||||
return if message.blank?
|
return if message.blank?
|
||||||
|
|
||||||
telegram_chat = handle_chat message[:chat]
|
telegram_chat = handle_chat message[:chat]
|
||||||
|
|
||||||
return if @telegram_bot.username.nil?
|
return if @telegram_bot.username.nil?
|
||||||
|
|
||||||
return unless message[:text].in? [
|
case message[:text]
|
||||||
'/shrug',
|
when '/shrug', "/shrug@#{@telegram_bot.username}"
|
||||||
"/shrug@#{@telegram_bot.username}",
|
@telegram_bot.client.send_message(
|
||||||
]
|
chat_id: telegram_chat.remote_id,
|
||||||
|
text: '¯\_(ツ)_/¯',
|
||||||
@telegram_bot.client.send_message(
|
)
|
||||||
chat_id: telegram_chat.remote_id,
|
end
|
||||||
text: '¯\_(ツ)_/¯',
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def handle_chat(chat)
|
def handle_chat(chat)
|
||||||
|
|
Reference in a new issue