mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-27 21:19:31 +01:00
utils: don't crash when mode target is invalid
This commit is contained in:
parent
d12e70d5e5
commit
0fd093644c
10
utils.py
10
utils.py
@ -200,12 +200,18 @@ def parseModes(irc, target, args):
|
|||||||
args = args[1:]
|
args = args[1:]
|
||||||
if usermodes:
|
if usermodes:
|
||||||
log.debug('(%s) Using irc.umodes for this query: %s', irc.name, irc.umodes)
|
log.debug('(%s) Using irc.umodes for this query: %s', irc.name, irc.umodes)
|
||||||
assert target in irc.users, "Unknown user %r." % target
|
|
||||||
|
if target not in irc.users:
|
||||||
|
log.warning('(%s) Possible desync! Mode target %s is not in the users index.', irc.name, target)
|
||||||
|
|
||||||
supported_modes = irc.umodes
|
supported_modes = irc.umodes
|
||||||
oldmodes = irc.users[target].modes
|
oldmodes = irc.users[target].modes
|
||||||
else:
|
else:
|
||||||
log.debug('(%s) Using irc.cmodes for this query: %s', irc.name, irc.cmodes)
|
log.debug('(%s) Using irc.cmodes for this query: %s', irc.name, irc.cmodes)
|
||||||
assert target in irc.channels, "Unknown channel %r." % target
|
|
||||||
|
if target not in irc.channels:
|
||||||
|
log.warning('(%s) Possible desync! Mode target %s is not in the channels index.', irc.name, target)
|
||||||
|
|
||||||
supported_modes = irc.cmodes
|
supported_modes = irc.cmodes
|
||||||
oldmodes = irc.channels[target].modes
|
oldmodes = irc.channels[target].modes
|
||||||
res = []
|
res = []
|
||||||
|
Loading…
Reference in New Issue
Block a user