Sha256: 7b5284c1178e30f115e656a2178f5dd9cb53d0117cae08492a70407017b3b9b6

Contents?: true

Size: 571 Bytes

Versions: 9

Compression:

Stored size: 571 Bytes

Contents

module MadChatter
  module Actions
    class Join < MadChatter::Actions::Base
      
      @@regex = /\/join (.+)/
      
      def handle(message)
        if message.filtered_text =~ @@regex
          username = parse_username(message.filtered_text)
          MadChatter::Users.update(message.token, username)
          send_status_message "#{username} has joined the chatroom"
          send_users_list
          stop_message_handling
        end
      end
      
      def parse_username(text)
        @@regex.match(text).captures[0]
      end
      
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
mad_chatter-0.3.1 lib/mad_chatter/actions/join.rb
mad_chatter-0.3.0 lib/mad_chatter/actions/join.rb
mad_chatter-0.2.9 lib/mad_chatter/actions/join.rb
mad_chatter-0.2.8 lib/mad_chatter/actions/join.rb
mad_chatter-0.2.7 lib/mad_chatter/actions/join.rb
mad_chatter-0.2.6 lib/mad_chatter/actions/join.rb
mad_chatter-0.2.5 lib/mad_chatter/actions/join.rb
mad_chatter-0.2.4 lib/mad_chatter/actions/join.rb
mad_chatter-0.2.3 lib/mad_chatter/actions/join.rb