lib/elephrame/streaming/command.rb
def run_commands
      @streamer.user do |update|
        next unless update.kind_of? Mastodon::Notification and update.type == 'mention'

        # set up the status to strip html, if needed
        update.status.class
          .module_eval { alias_method :content, :strip } if @strip_html
        store_mention_data update.status

        # strip our username out of the status
        post = update.status.content.gsub(/@#{@username} /, '')

        # see if the post matches our regex, running the stored proc if it does
        matches = @cmd_regex.match(post)

        unless matches.nil?
          @cmd_hash[matches[:cmd].to_sym]
            .call(self,
                  matches[:data].strip,
                  update.status)
        else
          
          if block_given?
            yield(self, update.status)
          else
            @not_found.call(self, update.status) unless @not_found.nil?
          end
          
        end
      end
    end
def run_commands
      @streamer.user do |update|
        next unless update.kind_of? Mastodon::Notification and update.type == 'mention'

        # set up the status to strip html, if needed
        update.status.class
          .module_eval { alias_method :content, :strip } if @strip_html
        store_mention_data update.status

        # strip our username out of the status
        post = update.status.content.gsub(/@#{@username} /, '')

        # see if the post matches our regex, running the stored proc if it does
        matches = @cmd_regex.match(post)

        unless matches.nil?
          @cmd_hash[matches[:cmd].to_sym]
            .call(self,
                  matches[:data].strip,
                  update.status)
        else
          
          if block_given?
            yield(self, update.status)
          else
            @not_found.call(self, update.status) unless @not_found.nil?
          end
          
        end
      end
    end
Starts loop to process any mentions, running command procs set up earlier

 If a block is passed to this function it gets ran when no commands
 get matched. Otherwise the framework checks if +not_found+ exists
 and runs it