Added persistent join/part
This commit is contained in:
14
bot/admin.py
14
bot/admin.py
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user