mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-26 20:14:20 +01:00
AutoMode: Fix commit 4eb674843e
(extra modes).
This commit is contained in:
parent
0267f15a45
commit
a8415c8d75
@ -28,8 +28,10 @@
|
|||||||
# POSSIBILITY OF SUCH DAMAGE.
|
# POSSIBILITY OF SUCH DAMAGE.
|
||||||
###
|
###
|
||||||
|
|
||||||
|
import re
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
import supybot.log as log
|
||||||
import supybot.conf as conf
|
import supybot.conf as conf
|
||||||
import supybot.ircdb as ircdb
|
import supybot.ircdb as ircdb
|
||||||
import supybot.ircmsgs as ircmsgs
|
import supybot.ircmsgs as ircmsgs
|
||||||
@ -92,6 +94,26 @@ class AutoMode(callbacks.Plugin):
|
|||||||
do('voice')
|
do('voice')
|
||||||
except Continue:
|
except Continue:
|
||||||
return
|
return
|
||||||
|
finally:
|
||||||
|
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)
|
||||||
|
modes = item[len(username)] + modes
|
||||||
|
except ValueError: # No - or + in item
|
||||||
|
log.error(('%r is not a valid item for '
|
||||||
|
'supybot.plugins.AutoMode.extra') % item)
|
||||||
|
continue
|
||||||
|
if username != user.name:
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
self.log.info('Scheduling auto-modes %s of %s in %s.',
|
||||||
|
modes, msg.prefix, channel)
|
||||||
|
modes = [modes] + \
|
||||||
|
([msg.nick]*len(pattern.sub('', modes)))
|
||||||
|
schedule_msg(ircmsgs.mode(channel, modes), lambda :False)
|
||||||
|
break
|
||||||
c = ircdb.channels.getChannel(channel)
|
c = ircdb.channels.getChannel(channel)
|
||||||
if c.checkBan(msg.prefix) and self.registryValue('ban', channel):
|
if c.checkBan(msg.prefix) and self.registryValue('ban', channel):
|
||||||
period = self.registryValue('ban.period', channel)
|
period = self.registryValue('ban.period', channel)
|
||||||
@ -108,20 +130,6 @@ class AutoMode(callbacks.Plugin):
|
|||||||
irc.queueMsg(ircmsgs.ban(channel, banmask))
|
irc.queueMsg(ircmsgs.ban(channel, banmask))
|
||||||
irc.queueMsg(ircmsgs.kick(channel, msg.nick))
|
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
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user