mirror of
https://github.com/SpiceBot/SpiceBot.git
synced 2026-11-10 21:50:59 -05:00
channel parting
This commit is contained in:
parent
59da3b7395
commit
4e11cc4e98
@ -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
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user