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:
parent
1031aaa320
commit
ba649fb8b4
@ -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
|
||||
|
2
utils.py
2
utils.py
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user