mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-30 14:49:28 +01:00
utils: also don't crash in applyModes for bad mode targets
This commit is contained in:
parent
e70dfb0811
commit
305db9f754
6
utils.py
6
utils.py
@ -285,12 +285,18 @@ def applyModes(irc, target, changedmodes):
|
||||
The target can be either a channel or a user; this is handled automatically."""
|
||||
usermodes = not isChannel(target)
|
||||
log.debug('(%s) Using usermodes for this query? %s', irc.name, usermodes)
|
||||
|
||||
try:
|
||||
if usermodes:
|
||||
old_modelist = irc.users[target].modes
|
||||
supported_modes = irc.umodes
|
||||
else:
|
||||
old_modelist = irc.channels[target].modes
|
||||
supported_modes = irc.cmodes
|
||||
except KeyError:
|
||||
log.warning('(%s) Possible desync? Mode target %s is unknown.', irc.name, target)
|
||||
return
|
||||
|
||||
modelist = set(old_modelist)
|
||||
log.debug('(%s) Applying modes %r on %s (initial modelist: %s)', irc.name, changedmodes, target, modelist)
|
||||
for mode in changedmodes:
|
||||
|
Loading…
Reference in New Issue
Block a user