Added persistent join/part

This commit is contained in:
mrhanky
2017-08-22 18:02:33 +02:00
parent f33a17038a
commit e9f10db2c5
2 changed files with 32 additions and 1 deletions

View File

@@ -72,6 +72,13 @@ class Admin(Plugin):
self.bot.join(channel)
self.bot.notice(mask.nick, 'Joined channel {}'.format(channel))
conf = self.bot.load_config()
channels = conf.get('autojoins', [])
if channel not in channels:
channels.append(channel)
conf['autojoins'] = channels
self.bot.save_config(conf)
@command(permission='all_permissions')
def part(self, mask: IrcString, target: IrcString, args: Dict):
"""Let the bot part a given or the current channel
@@ -83,6 +90,13 @@ class Admin(Plugin):
self.bot.join(channel)
self.bot.notice(mask.nick, 'Parted channel {}'.format(channel))
conf = self.bot.load_config()
channels = conf.get('autojoins', [])
if channel in channels:
channels.remove(channel)
conf['autojoins'] = channels
self.bot.save_config(conf)
@command(permission='all_permissions')
def cycle(self, mask: IrcString, target: IrcString, args: Dict):
"""Let the bot part and join a given or the current channel