#!/usr/bin/env perl use strict; use warnings; use FindBin; use lib "$FindBin::Bin"; use Getopt::Long; use SpringBot; my $nick = 'chunbot'; my $channel = '#eeee'; my $charset = 'gbk'; my $server = '10.62.164.72'; my ($account, $password); GetOptions( 'nick=s' => \$nick, 'channel=s' => \$channel, 'charset=s' => \$charset, 'server=s' => \$server, 'account=s' => \$account, 'password=s' => \$password, ) or die "Usage: springbot --nick --channel --charset --server --account --password \n"; $channel = "#$channel" unless $channel =~ /^\#/; $account || die "No --account specified.\n"; $password || die "No --password specified.\n"; sub init { eval { my $bot = SpringBot->new( server => $server, #port => $port, channels => [$channel], nick => $nick, alt_nicks => [$nick, $nick.'_', $nick . '__'], username => "bot", name => "SpringBot powered by OpenResty", charset => $charset, resty_account => $account, resty_password => $password, ); $bot->run(); }; if ($@) { warn $@; init(); } } init(); # vim: ts=4 sw=4 expandtab