Why not adopt me?
NAME
POE::Component::IRC::Plugin::OutputToPastebin - easily pastebin output from your bot
SYNOPSIS
use strict;
use warnings;
use POE qw(Component::IRC Component::IRC::Plugin::OutputToPastebin);
my $irc = POE::Component::IRC->spawn(
nick => 'PasterBot',
server => 'irc.freenode.net',
port => 6667,
ircname => 'Paster BOT',
);
POE::Session->create(
package_states => [
main => [ qw(_start irc_001 irc_public) ],
],
);
$poe_kernel->run;
sub _start {
$irc->yield( register => 'all' );
$irc->plugin_add(
'Paster' =>
POE::Component::IRC::Plugin::OutputToPastebin->new
);
$irc->yield( connect => {} );
}
sub irc_001 { $irc->yield( join => '#zofbot' ) }
sub irc_public {
$irc->yield( privmsg => '#zofbot' =>
'OH HAI! [irc_to_pastebin]this text to pastebin'
);
$irc->yield( notice => 'Zoffix' =>
'BLEH! [irc_to_pastebin]this text to pastebin as well'
);
}
<Zoffix> foos
<PasterBot> OH HAI! http://erxz.com/pb/8028
-PasterBot- BLEH! http://p3m.org/pfn/714
DESCRIPTION
The module provides means to pastebin the output from your bot (by output is ment privmsg
and notice
messages) by inserting special "trigger" into the message.
CONSTRUCTOR
new
$irc->plugin_add(
'PasterPlain' =>
POE::Component::IRC::Plugin::OutputToPastebin->new
);
$irc->plugin_add(
'PasterJuicy' =>
POE::Component::IRC::Plugin::OutputToPastebin->new(
max_tries => 3,
timeout => 20,
trigger => '[irc_to_pastebin]',
pastebins => [ qw(http://p3m.org/pfn) ],
debug => 1,
)
);
Contructs a plugin object suitable to be fed to the everhungry POE::Component::IRC's plugin_add()
method. Takes a bunch of arguments in key/value pairs but all of them are optional. Possible arguments are as follows:
trigger
->new( trigger => '[send_stuff_after_this_to_pastebin]', );
Optional. Any privmsg
or notice
messages sent by the bot which contain trigger
in them will be split on the trigger
and anything after the trigger
will be pasted into the pastebin and replaced by the URI pointing to the pasted content. In other words if your trigger
is (trigger)
and your do $irc->yield( privmsg => '#zofbot' => 'blah (trigger) foos' );
then the actual message sent to channel #zofbot
will be blah http://erxz.com/pb/8028
where the URI will be pointing to the pastebin page containing pasted text foos
. Defaults to: [irc_to_pastebin]
(note the square brackets)
pastebins
->new( pastebins => [ qw(http://p3m.org/pfn http://erxz.com/pb) ], );
Optional. The pastebins
argument takes an arrayref of URIs each pointing to pastebin sites powered by Bot::Pastebot. Plugin will automatically iterate over specified list of pastebins on every paste request. Defaults to: [ qw(http://p3m.org/pfn) ]
max_tries
->new( max_tries => 3 )
Optional. If while pasting the content an error occured plugin will retry pasting into the next pastebin specified in pastebins
argument. It will be retrying until it succeeds or until it tried max_tries
times. If max_tries
limit is reached and plugin still could not paste your content instead of pastebin's URI you'll get [paster error]
in output message. Defaults to: 3
timeout
->new( timeout => 20 );
Optional. The timeout
argument specifies LWP::UserAgent timeout
setting to use for pasting. Defaults to: 20
seconds.
debug
->new( debug => 1 );
Optional. When debug
argument is set to true value plugin will carp()
out some debugging information. Defaults to: 0
AUTHOR
Zoffix Znet, <zoffix at cpan.org>
(http://zoffix.com, http://haslayout.net)
BUGS
Please report any bugs or feature requests to bug-poe-component-irc-plugin-outputtopastebin at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=POE-Component-IRC-Plugin-OutputToPastebin. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc POE::Component::IRC::Plugin::OutputToPastebin
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=POE-Component-IRC-Plugin-OutputToPastebin
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/POE-Component-IRC-Plugin-OutputToPastebin
CPAN Ratings
http://cpanratings.perl.org/d/POE-Component-IRC-Plugin-OutputToPastebin
Search CPAN
http://search.cpan.org/dist/POE-Component-IRC-Plugin-OutputToPastebin
COPYRIGHT & LICENSE
Copyright 2008 Zoffix Znet, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.