Sjoerd Swenzon
Sjoerd Swenzon

Reputation: 11

How do I send a raw IRC message when using Bot::BasicBot

Bot::BasicBot provides a method for fetching the handle of the underlying POE::Component::IRC::State object, pocoirc(). Using this object handle, it seems like it should be possible to send a raw message like this:

sub said {
  my ($self, $message) = @_;
  $self->pocoirc()->yield('raw_events' => 1);
  $self->pocoirc()->yield('irc_raw_out' => 'RAW message');

However, this gives the error "Can't call method "yield" without a package or object reference" - the returned object doesn't seem to export the expected method. Have I misunderstood what kind of object I'm getting back, or how to trigger sending of a raw message?

Upvotes: 1

Views: 222

Answers (1)

Sjoerd Swenzon
Sjoerd Swenzon

Reputation: 11

Thanks to the tip about Data::Printer, it turns out that the POE::Kernel is available as self->{kernel}. To enqueue a raw command,

$self->{kernel}->post( $self->{IRCNAME}, 'quote', 'your raw command');

Upvotes: 0

Related Questions