```ruby
module Hackbot
  module Interactions
    class Gifs < Hackbot::Interactions::Channel
      def self.should_start?(event, team)
        event[:type].eql?('message') &&
          mentions_command?(event, team, 'gif')
      end

      def start(event)
        query = event_to_query event
        if query.empty?
          msg_channel copy('start.invalid')

          return :finish
        end

        try_sending_gif(query)
      end

      private

      def try_sending_gif(query)
        gif = GiphyClient.translate query

        if gif.nil?
          msg_channel copy('start.not_found')
        else
          send_gif(copy('start.valid'), gif[:url])
        end
      end

      def event_to_query(event)
        event[:text]
          .sub(/#{team[:bot_username]}/i, '')
          .sub(/<@#{team[:bot_user_id]}>/i, '')
          .sub(/gif/i, '').strip
      end

      def send_gif(text, url)
        SlackClient.rpc('chat.postMessage',
                        access_token,
                        channel: data['channel'],
                        as_user: true,
                        attachments: [
                          {
                            text: text,
                            image_url: url
                          }
                        ].to_json)
      end
    end
  end
end
```

Convert Hackbot::Interactions::Gifs to a Command
user
```ruby
module Hackbot
  module Interactions
    class Gifs < Command
      TRIGGER = /gif ?(?<query>.+)?/

      def start(event)
        query = captures(event)[:query]

        if query.present?
          try_sending_gif(query)
        else
          msg_channel copy('start.invalid')
        end
      end

      private

      def try_sending_gif(query)
        gif = GiphyClient.translate query

        if gif.nil?
          msg_channel copy('start.not_found')
        else
          send_gif(copy('start.valid'), gif[:url])
        end
      end

      def send_gif(text, url)
        SlackClient.rpc('chat.postMessage',
                        access_token,
                        channel: data['channel'],
                        as_user: true,
                        attachments: [
                          {
                            text: text,
                            image_url: url
                          }
                        ].to_json)
      end
    end
  end
end
```
assistant