Class: IRCSupport::Message::Message

Inherits:
IRCSupport::Message show all
Defined in:
lib/ircsupport/message.rb

Direct Known Subclasses

CTCP

Instance Attribute Summary collapse

Attributes inherited from IRCSupport::Message

#args, #command, #prefix

Instance Method Summary collapse

Methods inherited from IRCSupport::Message

#type

Constructor Details

#initialize(args) ⇒ Message

Returns a new instance of Message.



560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
# File 'lib/ircsupport/message.rb', line 560

def initialize(args)
  super(args)
  @sender = args[:prefix]
  @message = args[:args][1]
  @is_action = args[:is_action] || false
  @is_notice = args[:is_notice] || false

  if args[:is_public]
    # broadcast messages are so 90s
    @channel = args[:args][0].split(/,/).first
  end

  if args[:capabilities].include?('identify-msg')
    @identified = args[:identified]
    def self.identified?; @identified; end
  end
end

Instance Attribute Details

#channelString

Returns The name of the channel this message was sent to, if any.

Returns:

  • (String)

    The name of the channel this message was sent to, if any.



557
558
559
# File 'lib/ircsupport/message.rb', line 557

def channel
  @channel
end

#messageString

Returns The text of the message.

Returns:

  • (String)

    The text of the message.



553
554
555
# File 'lib/ircsupport/message.rb', line 553

def message
  @message
end

#senderString

Returns The user who sent the message.

Returns:

  • (String)

    The user who sent the message.



550
551
552
# File 'lib/ircsupport/message.rb', line 550

def sender
  @sender
end

Instance Method Details

#is_action?Boolean

Returns Will be true if this message is an action.

Returns:

  • (Boolean)

    Will be true if this message is an action.



579
# File 'lib/ircsupport/message.rb', line 579

def is_action?; @is_action; end

#is_notice?Boolean

Returns Will be true if this message is a notice.

Returns:

  • (Boolean)

    Will be true if this message is a notice.



582
# File 'lib/ircsupport/message.rb', line 582

def is_notice?; @is_notice; end