mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-30 06:49:24 +01:00
AutoMode: Add support for extra modes (add supybot.plugins.AutoMode.extra).
This commit is contained in:
parent
74273b0d84
commit
4eb674843e
@ -75,5 +75,8 @@ conf.registerChannelValue(AutoMode, 'delay',
|
||||
registry.Integer(0, _("""Determines how many seconds the bot will wait
|
||||
before applying a mode. Has no effect on bans.""")))
|
||||
|
||||
conf.registerChannelValue(AutoMode, 'extra',
|
||||
registry.SpaceSeparatedListOfStrings([], _("""Extra modes that will be
|
||||
applied to a user. Example syntax: user1+o-v user2+v user3-v""")))
|
||||
|
||||
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
|
||||
|
@ -108,6 +108,22 @@ class AutoMode(callbacks.Plugin):
|
||||
irc.queueMsg(ircmsgs.ban(channel, banmask))
|
||||
irc.queueMsg(ircmsgs.kick(channel, msg.nick))
|
||||
|
||||
user = ircdb.users.getUser(ircdb.users.getUserId(msg.prefix))
|
||||
pattern = re.compile('-\+')
|
||||
for item in self.registryValue('extra', channel):
|
||||
try:
|
||||
username, modes = pattern.split(item, maxsplit=1)
|
||||
except ValueError: # No - or + in item
|
||||
log.error('%r is not a valid item for '
|
||||
'supybot.plugins.AutoMode.extra')
|
||||
continue
|
||||
if username != user.name:
|
||||
continue
|
||||
else:
|
||||
schedule_msg(ircmsgs.mode(msg.nick, modes), lambda :True)
|
||||
break
|
||||
|
||||
|
||||
|
||||
Class = AutoMode
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user