The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Bot::Cobalt::IRC::Message - An incoming IRC message

SYNOPSIS

  sub Bot_private_msg {
    my ($self, $core) = splice @_, 0, 2;
    my $msg = ${ $_[0] };

    my $context  = $msg->context;
    my $stripped = $msg->stripped;
    my $nickname = $msg->src_nick;
    . . .
  }

DESCRIPTION

Incoming IRC messages are broadcast to the plugin pipeline via Bot::Cobalt::IRC; this is the base class providing an easy object interface to parsed messages.

This is the most frequently used Event subclass; the methods inherited from Bot::Cobalt::IRC::Event are also documented here for convenience.

METHODS

context

Returns the server context name.

src

Returns the full source of the message in the form of nick!user@host

src_nick

The 'nick' portion of the message's "src".

src_user

The 'user' portion of the message's "src".

May be undefined if the message was "odd."

src_host

The 'host' portion of the message's "src".

May be undefined if the message was "odd."

targets

A List::Objects::WithUtils::Array containing any seen destinations for this message.

target

The first seen destination, as a string.

Same as $msg->targets->[0]

channel

Undefined if the destination for the message doesn't appear to be a properly-prefixed channel; otherwise the same value as "target".

message

The unstripped, unparsed message string we were originally given.

stripped

The color and formatting stripped "message".

message_array

A List::Objects::WithUtils::Array containing the message string split on white space.

"Extra" spaces are not preserved; see "message_array_sp".

message_array can be modified in the case of command-prefixed public messages; see "cmd" in Bot::Cobalt::IRC::Message::Public.

message_array_sp

Similar to "message_array", except all spaces are preserved, including leading spaces.

SEE ALSO

Bot::Cobalt::IRC::Message::Public -- subclass for public messages

Bot::Cobalt::IRC::Event -- base class for IRC events

Bot::Cobalt::Manual::Plugins

AUTHOR

Jon Portnoy <avenj@cobaltirc.org>

http://www.cobaltirc.org