channel parting

This commit is contained in:
deathbybandaid 2019-05-09 13:00:10 -04:00
parent 59da3b7395
commit 4e11cc4e98

View File

@ -53,9 +53,17 @@ def shutdown(bot):
def trigger_channel_list_initial(bot, trigger):
bot_events_recieved(bot, trigger.event)
ignorepartlist = []
if bot.config.SpiceBot_Logs.logging_channel:
ignorepartlist.append(bot.config.SpiceBot_Logs.logging_channel)
# Unkickable
bot.write(('SAMODE', bot.nick, '+q'))
for channel in bot.channels.keys():
if len(bot.channels[channel].privileges.keys()) == 1 and channel not in ignorepartlist:
bot.part(channel, "Leaving Empty Channel")
bot.write(['LIST'])
bot.memory['SpiceBot_Channels']['ProcessLock'] = True
@ -81,9 +89,16 @@ def trigger_channel_list_initial(bot, trigger):
if "*" in bot.memory['SpiceBot_Channels']['channels']:
del bot.memory['SpiceBot_Channels']['channels']["*"]
for channel in bot.channels.keys():
if len(bot.channels[channel].privileges.keys()) == 1 and channel not in ignorepartlist:
bot.part(channel, "Leaving Empty Channel")
while True:
try:
time.sleep(1800)
for channel in bot.channels.keys():
if len(bot.channels[channel].privileges.keys()) == 1 and channel not in ignorepartlist:
bot.part(channel, "Leaving Empty Channel")
oldlist = list(bot.memory['SpiceBot_Channels']['channels'].keys())
bot.write(['LIST'])
bot.memory['SpiceBot_Channels']['ProcessLock'] = True
@ -103,6 +118,9 @@ def trigger_channel_list_initial(bot, trigger):
if "*" in bot.memory['SpiceBot_Channels']['channels']:
del bot.memory['SpiceBot_Channels']['channels']["*"]
for channel in bot.channels.keys():
if len(bot.channels[channel].privileges.keys()) == 1 and channel not in ignorepartlist:
bot.part(channel, "Leaving Empty Channel")
except KeyError:
return