From f3d84931b13019b1433f0a464510ead57f05df0e Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Sat, 12 Aug 2017 01:28:23 -0700 Subject: [PATCH] Add ability to check if a nick is present in any channels --- PBot/NickList.pm | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/PBot/NickList.pm b/PBot/NickList.pm index 41f02839..0aa733fc 100644 --- a/PBot/NickList.pm +++ b/PBot/NickList.pm @@ -103,6 +103,19 @@ sub get_channels { return \@channels; } +sub is_present_any_channel { + my ($self, $nick) = @_; + + $nick = lc $nick; + + foreach my $channel (keys %{ $self->{nicklist} }) { + if (exists $self->{nicklist}->{$channel}->{$nick}) { + return $self->{nicklist}->{$channel}->{$nick}->{nick}; + } + } + return 0; +} + sub is_present { my ($self, $channel, $nick) = @_;