Class: Australium::PlayerSay

Inherits:
Event show all
Defined in:
lib/australium/events/player_say.rb

Constant Summary collapse

LOG_REGEX =
/"(?<player>.+)" say(?<team>_team)? "(?<message>.+)"/

Constants inherited from Event

Event::PROPERTY_REGEX, Event::TIMESTAMP_FORMAT, Event::TIMESTAMP_REGEX

Instance Attribute Summary collapse

Attributes inherited from Event

#raw

Instance Method Summary collapse

Methods inherited from Event

inherited, #to_s

Methods inherited from OpenStruct

#initialize_clone

Constructor Details

#initialize(data) ⇒ PlayerSay

Returns a new instance of PlayerSay


11
12
13
14
15
16
17
# File 'lib/australium/events/player_say.rb', line 11

def initialize(data)
  super(data)
  self[:team] = team.eql?('_team')

  player[:connected?, timestamp] = true
  player[:in_game?, timestamp] = true
end

Instance Attribute Details

#messageString

Returns the message spoken.

Returns:

  • (String)

    the message spoken.


11
12
13
14
15
16
17
# File 'lib/australium/events/player_say.rb', line 11

def initialize(data)
  super(data)
  self[:team] = team.eql?('_team')

  player[:connected?, timestamp] = true
  player[:in_game?, timestamp] = true
end

#playerPlayer

Returns the Australium::Player who spoke in chat.

Returns:


11
12
13
14
15
16
17
# File 'lib/australium/events/player_say.rb', line 11

def initialize(data)
  super(data)
  self[:team] = team.eql?('_team')

  player[:connected?, timestamp] = true
  player[:in_game?, timestamp] = true
end

Instance Method Details

#team?Boolean

Checks if the message was a team-only message.

Returns:

  • (Boolean)

    true if the message was a team message.


21
# File 'lib/australium/events/player_say.rb', line 21

def team? ; team end