More tabs = gone.
This commit is contained in:
1 parent
ea775d4c98
commit
3cfe22e5c1
7 files changed
+46
-40
No files matched your search
+2
-2
@@ -13,8 +13,8 @@ sub _init
|
||||
{
|
||||
# Check for required configuration values.
|
||||
if (!conf_get('badwords')) {
|
||||
err(2, 'Please verify that you have a badwords block with word entries defined in your configuration file.', 0);
|
||||
return;
|
||||
err(2, 'Please verify that you have a badwords block with word entries defined in your configuration file.', 0);
|
||||
return;
|
||||
}
|
||||
# Create the act_on_badword hook.
|
||||
hook_add('on_cprivmsg', 'act_on_badword', \&M::Badwords::actonbadword) or return;
|
||||
|
||||
+6
-6
@@ -14,8 +14,8 @@ sub _init
|
||||
{
|
||||
# Check for required configuration values.
|
||||
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);
|
||||
return;
|
||||
err(2, 'Please verify that you have bitly_user and bitly_key defined in your configuration file.', 0);
|
||||
return;
|
||||
}
|
||||
# Create the SHORTEN and REVERSE commands.
|
||||
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 successful, decode the content.
|
||||
my $d = $response->decoded_content;
|
||||
chomp $d;
|
||||
chomp $d;
|
||||
# And send to channel.
|
||||
privmsg($src->{svr}, $src->{chan}, "URL: ".$d);
|
||||
privmsg($src->{svr}, $src->{chan}, "URL: ".$d);
|
||||
}
|
||||
else {
|
||||
# Otherwise, send an error message.
|
||||
@@ -104,13 +104,13 @@ sub reverse
|
||||
if ($response->is_success) {
|
||||
# If successful, decode the content.
|
||||
my $d = $response->decoded_content;
|
||||
chomp $d;
|
||||
chomp $d;
|
||||
# And send it to channel.
|
||||
privmsg($src->{svr}, $src->{chan}, "URL: ".$d);
|
||||
}
|
||||
else {
|
||||
# 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;
|
||||
|
||||
+7
-7
@@ -58,20 +58,20 @@ sub calc
|
||||
|
||||
if ($response->is_success) {
|
||||
# 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
|
||||
privmsg($src->{svr}, $src->{chan}, "Result: ".$d->{lhs}." = ".$d->{rhs});
|
||||
}
|
||||
else {
|
||||
}
|
||||
else {
|
||||
# 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 {
|
||||
# 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;
|
||||
|
||||
+2
-2
@@ -49,14 +49,14 @@ sub fml
|
||||
if ($rp->is_success) {
|
||||
# If successful, decode the content.
|
||||
my $d = $rp->decoded_content;
|
||||
$d =~ s/(\n|\r)//g;
|
||||
$d =~ s/(\n|\r)//g;
|
||||
|
||||
# Get the FML.
|
||||
my (undef, $dfa) = split('Text: ', $d);
|
||||
my ($fml, undef) = split('Agree:', $dfa);
|
||||
|
||||
# And send to channel.
|
||||
privmsg($src->{svr}, $src->{chan}, "\002Random FML:\002 ".$fml);
|
||||
privmsg($src->{svr}, $src->{chan}, "\002Random FML:\002 ".$fml);
|
||||
}
|
||||
else {
|
||||
# Otherwise, send an error message.
|
||||
|
||||
+7
-7
@@ -44,25 +44,25 @@ sub check
|
||||
$ua->timeout(2);
|
||||
# Do we have enough parameters?
|
||||
if (!defined $argv[0]) {
|
||||
notice($src->{svr}, $src->{nick}, trans('Not enough parameters').q{.});
|
||||
return;
|
||||
notice($src->{svr}, $src->{nick}, trans('Not enough parameters').q{.});
|
||||
return;
|
||||
}
|
||||
my $curl = $argv[0];
|
||||
# Does the URL start with http(s)?
|
||||
if ($curl !~ m/^http/) {
|
||||
$curl = 'http://'.$curl;
|
||||
$curl = 'http://'.$curl;
|
||||
}
|
||||
|
||||
# Get the response via HTTP.
|
||||
my $response = $ua->get($curl);
|
||||
|
||||
if ($response->is_success) {
|
||||
# If successful, it's up.
|
||||
privmsg($src->{svr}, $src->{chan}, $curl.' appears to be up from here.');
|
||||
# If successful, it's up.
|
||||
privmsg($src->{svr}, $src->{chan}, $curl.' appears to be up from here.');
|
||||
}
|
||||
else {
|
||||
# Otherwise, it's down.
|
||||
privmsg($src->{svr}, $src->{chan}, $curl.' appears to be down from here.');
|
||||
# Otherwise, it's down.
|
||||
privmsg($src->{svr}, $src->{chan}, $curl.' appears to be down from here.');
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
||||
+14
-14
@@ -45,8 +45,8 @@ sub weather
|
||||
$ua->timeout(2);
|
||||
# Put together the call to the Wunderground API.
|
||||
if (!defined $args[0]) {
|
||||
notice($src->{svr}, $src->{nick}, trans('Not enough parameters').".");
|
||||
return;
|
||||
notice($src->{svr}, $src->{nick}, trans('Not enough parameters').".");
|
||||
return;
|
||||
}
|
||||
my $loc = join(' ', @args);
|
||||
$loc =~ s/ /%20/g;
|
||||
@@ -56,22 +56,22 @@ sub weather
|
||||
|
||||
if ($response->is_success) {
|
||||
# If successful, decode the content.
|
||||
my $d = XMLin($response->decoded_content);
|
||||
my $d = XMLin($response->decoded_content);
|
||||
# And send to channel
|
||||
if (!ref($d->{observation_location}->{country})) {
|
||||
my $windc = $d->{wind_string};
|
||||
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}, "\2Heat index:\2 ".$d->{heat_index_string}." \2Humidity:\2 ".$d->{relative_humidity}." \2Pressure:\2 ".$d->{pressure_string}." - ".$d->{observation_time});
|
||||
}
|
||||
else {
|
||||
# Otherwise, send an error message.
|
||||
privmsg($src->{svr}, $src->{chan}, 'Location not found.');
|
||||
}
|
||||
if (!ref($d->{observation_location}->{country})) {
|
||||
my $windc = $d->{wind_string};
|
||||
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}, "\2Heat index:\2 ".$d->{heat_index_string}." \2Humidity:\2 ".$d->{relative_humidity}." \2Pressure:\2 ".$d->{pressure_string}." - ".$d->{observation_time});
|
||||
}
|
||||
else {
|
||||
# Otherwise, send an error message.
|
||||
privmsg($src->{svr}, $src->{chan}, 'Location not found.');
|
||||
}
|
||||
}
|
||||
else {
|
||||
# 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;
|
||||
|
||||
@@ -200,8 +200,8 @@ sub cmd_uno {
|
||||
|
||||
# Check for at least two players.
|
||||
if (keys %PLAYERS < 2) {
|
||||
notice($src->{svr}, $src->{nick}, 'Two players are required to play.');
|
||||
return;
|
||||
# Not found, join the bot.
|
||||
_botjoin();
|
||||
}
|
||||
|
||||
# Deal the cards.
|
||||
@@ -1166,6 +1166,12 @@ sub _delplyr {
|
||||
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.
|
||||
sub _gameover {
|
||||
my ($player) = @_;
|
||||
|
||||
Reference in new issue
Block a user