3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-23 19:19:31 +01:00

automode: add/remove persistent channels on set/del/clearacc

This commit is contained in:
James Lu 2018-05-05 21:51:15 -07:00
parent 8aa67b93fa
commit 5a0cb9a4ff

View File

@ -230,8 +230,8 @@ def setacc(irc, source, args):
log.info('(%s) %s set modes +%s for %s on %s', ircobj.name, irc.get_hostmask(source), modes, mask, channel)
reply(irc, "Done. \x02%s\x02 now has modes \x02+%s\x02 in \x02%s\x02." % (mask, modes, channel))
# Join the Automode bot to the channel if not explicitly told to.
modebot.join(ircobj, channel)
# Join the Automode bot to the channel persistently.
modebot.add_persistent_channel(irc, 'automode', channel)
modebot.add_cmd(setacc, aliases=('setaccess', 'set'), featured=True)
@ -265,6 +265,7 @@ def delacc(irc, source, args):
if not dbentry:
log.debug("Automode: purging empty channel pair %s/%s", ircobj.name, channel)
del db[ircobj.name+channel]
modebot.remove_persistent_channel(irc, 'automode', channel)
modebot.add_cmd(delacc, aliases=('delaccess', 'del'), featured=True)
@ -344,6 +345,7 @@ def clearacc(irc, source, args):
del db[ircobj.name+channel]
log.info('(%s) %s cleared modes on %s', ircobj.name, irc.get_hostmask(source), channel)
reply(irc, "Done. Removed all Automode access entries for \x02%s\x02." % channel)
modebot.remove_persistent_channel(irc, 'automode', channel)
else:
error(irc, "No Automode access entries exist for \x02%s\x02." % channel)