Sha256: d65789b52ebb0a69946d4e2276fa73185c6f45c393020df25bf7a6e463142655

Contents?: true

Size: 614 Bytes

Versions: 1

Compression:

Stored size: 614 Bytes

Contents

module MadChatter
  
  module Actions
    
    class Join < MadChatter::Actions::Base
      
      @@command = '/join'
      
      def process
        username = parse_username_from_message
        MadChatter::Users.update(@user_token, username)
        MadChatter::Server.send_users_list
        MadChatter::Server.send_status("#{username} has joined the chatroom")
      end
      
      def parse_username_from_message
        # clear the command from the message string
        # the rest will be the new username
        username = @message.sub("#{@@command} ", '')
      end
      
    end
    
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mad_chatter-0.0.7 lib/mad_chatter/actions/join.rb