diff --git a/app/controllers/telegram_bot_updates_controller.rb b/app/controllers/telegram_bot_updates_controller.rb index ca2601e..5ccaa3d 100644 --- a/app/controllers/telegram_bot_updates_controller.rb +++ b/app/controllers/telegram_bot_updates_controller.rb @@ -23,21 +23,9 @@ private raise NotAuthorizedError unless params[:secret] == @telegram_bot.secret end - # rubocop:disable AbcSize, CyclomaticComplexity, PerceivedComplexity def handle_message(message) handle_user message[:from] if message[:from] - - return if message[:chat].nil? - - (message[:entities] || []).each do |message_entity| - next unless message_entity[:type] == 'bot_command' && - message_entity[:offset].zero? && - message_entity[:length] == message[:text].length - - handle_command message[:chat][:id], message[:text] if message[:chat] - end end - # rubocop:enable AbcSize, CyclomaticComplexity, PerceivedComplexity def handle_user(user) telegram_user = @@ -51,12 +39,4 @@ private telegram_user.save! end - - def handle_command(chat_id, command) - RestClient.post( - "https://api.telegram.org/bot#{@telegram_bot.api_token}/sendMessage", - chat_id: chat_id, - text: "Command: #{command}", - ) - end end