3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-01 09:19:23 +01:00

utils, exttargets: add checks for channel presence

This commit is contained in:
James Lu 2017-08-25 02:31:26 -07:00
parent 1031aaa320
commit ba649fb8b4
2 changed files with 5 additions and 1 deletions

View File

@ -118,6 +118,10 @@ def channel(irc, host, uid):
except IndexError: # No channel given, abort.
return False
if channel not in irc.channels:
# Channel doesn't even exist...
return False
if len(groups) == 2:
# Just #channel was given as query
return uid in irc.channels[channel].users

View File

@ -277,7 +277,7 @@ class ServiceBot():
for chan in channels:
if isChannel(chan):
if u in irc.channels[chan].users:
if chan in irc.channels and u in irc.channels[chan].users:
log.debug('(%s) Skipping join of services %s to channel %s - it is already present', irc.name, self.name, chan)
continue
log.debug('(%s) Joining services %s to channel %s with modes %r', irc.name, self.name, chan, joinmodes)