More tabs = gone.

This commit is contained in:
Elijah Perrault committed 2011-03-21 14:20:19 -06:00
1 parent ea775d4c98
commit 3cfe22e5c1
7 files changed
+46 -40

No files matched your search

+2 -2
View File
@@ -13,8 +13,8 @@ sub _init
{ {
# Check for required configuration values. # Check for required configuration values.
if (!conf_get('badwords')) { if (!conf_get('badwords')) {
err(2, 'Please verify that you have a badwords block with word entries defined in your configuration file.', 0); err(2, 'Please verify that you have a badwords block with word entries defined in your configuration file.', 0);
return; return;
} }
# Create the act_on_badword hook. # Create the act_on_badword hook.
hook_add('on_cprivmsg', 'act_on_badword', \&M::Badwords::actonbadword) or return; hook_add('on_cprivmsg', 'act_on_badword', \&M::Badwords::actonbadword) or return;
+6 -6
View File
@@ -14,8 +14,8 @@ sub _init
{ {
# Check for required configuration values. # Check for required configuration values.
if (!(conf_get('bitly:user'))[0][0] or !(conf_get('bitly:key'))[0][0]) { if (!(conf_get('bitly:user'))[0][0] or !(conf_get('bitly:key'))[0][0]) {
err(2, 'Please verify that you have bitly_user and bitly_key defined in your configuration file.', 0); err(2, 'Please verify that you have bitly_user and bitly_key defined in your configuration file.', 0);
return; return;
} }
# Create the SHORTEN and REVERSE commands. # Create the SHORTEN and REVERSE commands.
cmd_add('SHORTEN', 0, 0, \%M::Bitly::HELP_SHORTEN, \&M::Bitly::shorten) or return; cmd_add('SHORTEN', 0, 0, \%M::Bitly::HELP_SHORTEN, \&M::Bitly::shorten) or return;
@@ -68,9 +68,9 @@ sub shorten
if ($response->is_success) { if ($response->is_success) {
# If successful, decode the content. # If successful, decode the content.
my $d = $response->decoded_content; my $d = $response->decoded_content;
chomp $d; chomp $d;
# And send to channel. # And send to channel.
privmsg($src->{svr}, $src->{chan}, "URL: ".$d); privmsg($src->{svr}, $src->{chan}, "URL: ".$d);
} }
else { else {
# Otherwise, send an error message. # Otherwise, send an error message.
@@ -104,13 +104,13 @@ sub reverse
if ($response->is_success) { if ($response->is_success) {
# If successful, decode the content. # If successful, decode the content.
my $d = $response->decoded_content; my $d = $response->decoded_content;
chomp $d; chomp $d;
# And send it to channel. # And send it to channel.
privmsg($src->{svr}, $src->{chan}, "URL: ".$d); privmsg($src->{svr}, $src->{chan}, "URL: ".$d);
} }
else { else {
# Otherwise, send an error message. # Otherwise, send an error message.
privmsg($src->{svr}, $src->{chan}, 'An error occurred while reversing your URL.'); privmsg($src->{svr}, $src->{chan}, 'An error occurred while reversing your URL.');
} }
return 1; return 1;
+7 -7
View File
@@ -58,20 +58,20 @@ sub calc
if ($response->is_success) { if ($response->is_success) {
# If successful, decode the content. # If successful, decode the content.
my $d = $json->allow_nonref->relaxed->escape_slash->loose->allow_singlequote->allow_barekey->decode($response->decoded_content); my $d = $json->allow_nonref->relaxed->escape_slash->loose->allow_singlequote->allow_barekey->decode($response->decoded_content);
if ($d->{error} eq "" or $d->{error} == 0) { if ($d->{error} eq "" or $d->{error} == 0) {
# And send to channel # And send to channel
privmsg($src->{svr}, $src->{chan}, "Result: ".$d->{lhs}." = ".$d->{rhs}); privmsg($src->{svr}, $src->{chan}, "Result: ".$d->{lhs}." = ".$d->{rhs});
} }
else { else {
# Otherwise, send an error message. # Otherwise, send an error message.
privmsg($src->{svr}, $src->{chan}, "Google Calculator sent an error."); privmsg($src->{svr}, $src->{chan}, "Google Calculator sent an error.");
} }
} }
else { else {
# Otherwise, send an error message. # Otherwise, send an error message.
privmsg($src->{svr}, $src->{chan}, "An error occurred while sending your expression to Google Calculator."); privmsg($src->{svr}, $src->{chan}, "An error occurred while sending your expression to Google Calculator.");
} }
return 1; return 1;
+2 -2
View File
@@ -49,14 +49,14 @@ sub fml
if ($rp->is_success) { if ($rp->is_success) {
# If successful, decode the content. # If successful, decode the content.
my $d = $rp->decoded_content; my $d = $rp->decoded_content;
$d =~ s/(\n|\r)//g; $d =~ s/(\n|\r)//g;
# Get the FML. # Get the FML.
my (undef, $dfa) = split('Text: ', $d); my (undef, $dfa) = split('Text: ', $d);
my ($fml, undef) = split('Agree:', $dfa); my ($fml, undef) = split('Agree:', $dfa);
# And send to channel. # And send to channel.
privmsg($src->{svr}, $src->{chan}, "\002Random FML:\002 ".$fml); privmsg($src->{svr}, $src->{chan}, "\002Random FML:\002 ".$fml);
} }
else { else {
# Otherwise, send an error message. # Otherwise, send an error message.
+7 -7
View File
@@ -44,25 +44,25 @@ sub check
$ua->timeout(2); $ua->timeout(2);
# Do we have enough parameters? # Do we have enough parameters?
if (!defined $argv[0]) { if (!defined $argv[0]) {
notice($src->{svr}, $src->{nick}, trans('Not enough parameters').q{.}); notice($src->{svr}, $src->{nick}, trans('Not enough parameters').q{.});
return; return;
} }
my $curl = $argv[0]; my $curl = $argv[0];
# Does the URL start with http(s)? # Does the URL start with http(s)?
if ($curl !~ m/^http/) { if ($curl !~ m/^http/) {
$curl = 'http://'.$curl; $curl = 'http://'.$curl;
} }
# Get the response via HTTP. # Get the response via HTTP.
my $response = $ua->get($curl); my $response = $ua->get($curl);
if ($response->is_success) { if ($response->is_success) {
# If successful, it's up. # If successful, it's up.
privmsg($src->{svr}, $src->{chan}, $curl.' appears to be up from here.'); privmsg($src->{svr}, $src->{chan}, $curl.' appears to be up from here.');
} }
else { else {
# Otherwise, it's down. # Otherwise, it's down.
privmsg($src->{svr}, $src->{chan}, $curl.' appears to be down from here.'); privmsg($src->{svr}, $src->{chan}, $curl.' appears to be down from here.');
} }
return 1; return 1;
+14 -14
View File
@@ -45,8 +45,8 @@ sub weather
$ua->timeout(2); $ua->timeout(2);
# Put together the call to the Wunderground API. # Put together the call to the Wunderground API.
if (!defined $args[0]) { if (!defined $args[0]) {
notice($src->{svr}, $src->{nick}, trans('Not enough parameters')."."); notice($src->{svr}, $src->{nick}, trans('Not enough parameters').".");
return; return;
} }
my $loc = join(' ', @args); my $loc = join(' ', @args);
$loc =~ s/ /%20/g; $loc =~ s/ /%20/g;
@@ -56,22 +56,22 @@ sub weather
if ($response->is_success) { if ($response->is_success) {
# If successful, decode the content. # If successful, decode the content.
my $d = XMLin($response->decoded_content); my $d = XMLin($response->decoded_content);
# And send to channel # And send to channel
if (!ref($d->{observation_location}->{country})) { if (!ref($d->{observation_location}->{country})) {
my $windc = $d->{wind_string}; my $windc = $d->{wind_string};
if (substr($windc, length($windc) - 1, 1) eq " ") { $windc = substr($windc, 0, length($windc) - 1) } if (substr($windc, length($windc) - 1, 1) eq " ") { $windc = substr($windc, 0, length($windc) - 1) }
privmsg($src->{svr}, $src->{chan}, "Results for \2".$d->{observation_location}->{full}."\2 - \2Temperature:\2 ".$d->{temperature_string}." \2Wind Conditions:\2 ".$windc." \2Conditions:\2 ".$d->{weather}); privmsg($src->{svr}, $src->{chan}, "Results for \2".$d->{observation_location}->{full}."\2 - \2Temperature:\2 ".$d->{temperature_string}." \2Wind Conditions:\2 ".$windc." \2Conditions:\2 ".$d->{weather});
privmsg($src->{svr}, $src->{chan}, "\2Heat index:\2 ".$d->{heat_index_string}." \2Humidity:\2 ".$d->{relative_humidity}." \2Pressure:\2 ".$d->{pressure_string}." - ".$d->{observation_time}); privmsg($src->{svr}, $src->{chan}, "\2Heat index:\2 ".$d->{heat_index_string}." \2Humidity:\2 ".$d->{relative_humidity}." \2Pressure:\2 ".$d->{pressure_string}." - ".$d->{observation_time});
} }
else { else {
# Otherwise, send an error message. # Otherwise, send an error message.
privmsg($src->{svr}, $src->{chan}, 'Location not found.'); privmsg($src->{svr}, $src->{chan}, 'Location not found.');
} }
} }
else { else {
# Otherwise, send an error message. # Otherwise, send an error message.
privmsg($src->{svr}, $src->{chan}, 'An error occurred while retrieving your weather.'); privmsg($src->{svr}, $src->{chan}, 'An error occurred while retrieving your weather.');
} }
return 1; return 1;
+8 -2
View File
@@ -200,8 +200,8 @@ sub cmd_uno {
# Check for at least two players. # Check for at least two players.
if (keys %PLAYERS < 2) { if (keys %PLAYERS < 2) {
notice($src->{svr}, $src->{nick}, 'Two players are required to play.'); # Not found, join the bot.
return; _botjoin();
} }
# Deal the cards. # Deal the cards.
@@ -1166,6 +1166,12 @@ sub _delplyr {
return 1; return 1;
} }
# Join the bot to a game.
sub _botjoin {
$PLAYERS{lc $src->{nick}} = [];
$NICKS{lc $src->{nick}} = $src->{nick};
}
# For when a player has won. # For when a player has won.
sub _gameover { sub _gameover {
my ($player) = @_; my ($player) = @_;