App-Devbot

 view release on metacpan or  search on metacpan

devbot  view on Meta::CPAN

devbot - IRC bot which helps development

=head1 SYNOPSIS

    # devbot will connect to OFTC with SSL, join #mychan and log everything there. Its nickname will be 'devbot'.
    devbot --channel "#mychan"

    # devbot will connect to Freenode without SSL, join #asd and #qwe, and log everything there. Its nickname will be 'loggerbot'.
    devbot --nick loggerbot --server chat.freenode.net --port 6667 --no-ssl --channel "#asd" --channel "#qwe"

    # devbot will identify to NickServ with password 'passWORD123', join #bestchan on OFTC and store files sent by channel users.
    devbot --nick mybot --password passWORD123 --channel '#bestchan' --no-log --store-files

=head1 DESCRIPTION

devbot is an IRC bot which helps developers collaborate.

Right now, it only does channel logging and file storage. It might do more in the future.

=head1 OPTIONS

=over

=item B<--nick> I<nickname>

The nickname of devbot. Defaults to devbot.

=item B<--password> I<password>

If supplied, identify to NickServ with this password

=item B<--server> I<hostname>

The server to connect to. Defaults to irc.oftc.net.

=item B<--port> I<port>

The port to connect to. Defaults to 6697.

=item B<--ssl>, B<--no-ssl>

lib/App/Devbot.pm  view on Meta::CPAN

use File::Slurp qw/append_file/;
use IRC::Utils qw/parse_user/;

use Getopt::Long;
use POSIX qw/strftime/;
use Regexp::Common qw /net/;

##################################################

my $nick='devbot';
my $password;
my $server='irc.oftc.net';
my $port=6697;
my $ssl=1;
my @channels;
my $trace=0;

my $log=1;
my $store_files=0;

GetOptions (
  "nick=s" => \$nick,
  "password=s" => \$password,
  "server=s" => \$server,
  "port=i" => \$port,
  "ssl!" => \$ssl,
  "channel=s" => \@channels,
  "log!" => \$log,
  "store-files!" => \$store_files,
  "trace!" => \$trace,
);

my $irc;

lib/App/Devbot.pm  view on Meta::CPAN

sub log_event{
  return unless $log;
  my ($channel, @strings) = @_;
  my $file=strftime '%F', localtime;
  mkdir 'logs';
  mkdir "logs/$channel";
  append_file "logs/$channel/$file.txt", strftime ('%T ', localtime), @strings, "\n";
}

sub bot_start{
  $irc->plugin_add (NickServID => POE::Component::IRC::Plugin::NickServID->new(Password => $password)) if defined $password;
  $irc->plugin_add (AutoJoin => POE::Component::IRC::Plugin::AutoJoin->new(
	Channels => \@channels,
	RejoinOnKick => 1,
	Rejoin_delay => 10,
	Retry_when_banned => 60,
  ));

  $server = $1 if $server =~ /^($RE{net}{domain})$/;
  $port   = $1 if $port =~ /^([0-9]+)$/;

lib/App/Devbot.pm  view on Meta::CPAN

Right now, it only does channel logging and file storage. It might do more in the future.

=head1 OPTIONS

=over

=item B<--nick> I<nickname>

The nickname of devbot. Defaults to devbot.

=item B<--password> I<password>

If supplied, identify to NickServ with this password

=item B<--server> I<hostname>

The server to connect to. Defaults to irc.oftc.net.

=item B<--port> I<port>

The port to connect to. Defaults to 6697.

=item B<--ssl>, B<--no-ssl>



( run in 0.743 second using v1.01-cache-2.11-cpan-49f99fa48dc )