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

NAME

Bot::Cobalt::IRC::Message::Public - Public message subclass

SYNOPSIS

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

    if ($msg->highlight) {
      . . .
    }
  }

DESCRIPTION

This is a subclass of Bot::Cobalt::IRC::Message -- most methods are documented there.

When an incoming message is a public (channel) message, the provided $msg object has the following extra methods available:

myself

The 'myself' attribute can be tweaked to change how "highlight" behaves. By default it will query the Bot::Cobalt::Core instance for an IRC object that can return the bot's current nickname.

highlight

If the bot appears to have been highlighted (ie, the message is prefixed with "myself"), this method will return boolean true.

Used to see if someone is "talking to" the bot.

cmd

If the message appears to actually be a command and some arguments, cmd will return the specified command and automatically shift the message_array leftwards to drop the command from message_array.

Normally this isn't used directly by plugins other than Bot::Cobalt::IRC; a Message object handed off by a Bot_public_cmd_* event has this done for you already, for example.

AUTHOR

Jon Portnoy <avenj@cobaltirc.org>

http://www.cobaltirc.org