mirror of
https://github.com/SpiceBot/SpiceBot.git
synced 2026-11-12 06:29:54 -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):
|
def trigger_channel_list_initial(bot, trigger):
|
||||||
bot_events_recieved(bot, trigger.event)
|
bot_events_recieved(bot, trigger.event)
|
||||||
|
|
||||||
|
ignorepartlist = []
|
||||||
|
if bot.config.SpiceBot_Logs.logging_channel:
|
||||||
|
ignorepartlist.append(bot.config.SpiceBot_Logs.logging_channel)
|
||||||
|
|
||||||
# Unkickable
|
# Unkickable
|
||||||
bot.write(('SAMODE', bot.nick, '+q'))
|
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.write(['LIST'])
|
||||||
bot.memory['SpiceBot_Channels']['ProcessLock'] = True
|
bot.memory['SpiceBot_Channels']['ProcessLock'] = True
|
||||||
|
|
||||||
@ -81,9 +89,16 @@ def trigger_channel_list_initial(bot, trigger):
|
|||||||
if "*" in bot.memory['SpiceBot_Channels']['channels']:
|
if "*" in bot.memory['SpiceBot_Channels']['channels']:
|
||||||
del 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:
|
while True:
|
||||||
try:
|
try:
|
||||||
time.sleep(1800)
|
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())
|
oldlist = list(bot.memory['SpiceBot_Channels']['channels'].keys())
|
||||||
bot.write(['LIST'])
|
bot.write(['LIST'])
|
||||||
bot.memory['SpiceBot_Channels']['ProcessLock'] = True
|
bot.memory['SpiceBot_Channels']['ProcessLock'] = True
|
||||||
@ -103,6 +118,9 @@ def trigger_channel_list_initial(bot, trigger):
|
|||||||
|
|
||||||
if "*" in bot.memory['SpiceBot_Channels']['channels']:
|
if "*" in bot.memory['SpiceBot_Channels']['channels']:
|
||||||
del 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:
|
except KeyError:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user