Added API::IRC::ison for checking if a user is on a channel.

This commit is contained in:
Elijah Perrault committed 2011-04-21 02:08:37 -06:00
1 parent 338551b44c
commit 105e83699d
2 files changed
+13 -1

No files matched your search

+1
View File
@@ -3,6 +3,7 @@ Auto IRC Bot 3.0: Change Log
3.0 Indev
===============================================================================
* Added API::IRC::ison for checking if a user is on a channel.
* Werewolf: Fixed a bug in harlot staying home.
* Werewolf: Various bug fixes.
* Werewolf 1.06: Fixed an annoyance and added traitor transformation.
+12 -1
View File
@@ -9,7 +9,7 @@ use Exporter;
use base qw(Exporter);
our @EXPORT_OK = qw(ban cjoin cpart cmode umode kick privmsg notice quit nick names
topic who usrc match_mask);
topic who usrc match_mask ison);
# Create the on_disconnect event.
API::Std::event_add('on_disconnect');
@@ -130,6 +130,17 @@ sub act {
return 1;
}
# Check if a given nickname is on a channel.
sub ison {
my ($svr, $chan, $nick) = @_;
if (!exists $State::IRC::chanusers{$svr}) { return }
if (!exists $State::IRC::chanusers{$svr}{$chan}) { return }
if (!exists $State::IRC::chanusers{$svr}{$chan}{lc $nick}) { return }
return 1;
}
# Change bot nickname.
sub nick {
my ($svr, $newnick) = @_;