Class: ModSpox::Messages::Outgoing::Privmsg

Inherits:
Object
  • Object
show all
Defined in:
lib/mod_spox/messages/outgoing/Privmsg.rb

Direct Known Subclasses

Notice

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(target, message, action = false, ctcp = false, ctcp_type = nil) ⇒ Privmsg

target

target for the message

message

message to be sent

Send a message to user or channel. Setting action to true is a shortcut to setting ctcp parameters. The action parameter will override the ctcp parameters if all are set



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/mod_spox/messages/outgoing/Privmsg.rb', line 16

def initialize(target, message, action=false, ctcp=false, ctcp_type=nil)
    @target = target
    @message = message
    @action = action
    @ctcp = ctcp
    @ctcp_type = ctcp_type.upcase unless ctcp_type.nil?
    if(@action)
        @ctcp = true
        @ctcp_type = 'ACTION'
    end
    if(!@action && !@ctcp_type.nil?)
        @action = true if @ctcp_type == 'ACTION'
    end
end

Instance Attribute Details

#ctcp_typeObject (readonly)

type of CTCP message



10
11
12
# File 'lib/mod_spox/messages/outgoing/Privmsg.rb', line 10

def ctcp_type
  @ctcp_type
end

#messageObject (readonly)

the message



8
9
10
# File 'lib/mod_spox/messages/outgoing/Privmsg.rb', line 8

def message
  @message
end

#targetObject (readonly)

target for the message



6
7
8
# File 'lib/mod_spox/messages/outgoing/Privmsg.rb', line 6

def target
  @target
end

Instance Method Details

#is_action?Boolean

is message an action

Returns:

  • (Boolean)


32
33
34
# File 'lib/mod_spox/messages/outgoing/Privmsg.rb', line 32

def is_action?
    return @action
end

#is_ctcp?Boolean

is message CTCP

Returns:

  • (Boolean)


37
38
39
# File 'lib/mod_spox/messages/outgoing/Privmsg.rb', line 37

def is_ctcp?
    return @ctcp
end