mirror of
https://github.com/SpiceBot/SpiceBot.git
synced 2026-11-11 14:10:58 -05:00
channel parting
This commit is contained in:
parent
4e11cc4e98
commit
b3857cd96e
@ -53,16 +53,10 @@ 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():
|
bot_part_empty(bot)
|
||||||
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
|
||||||
@ -89,16 +83,12 @@ 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():
|
bot_part_empty(bot)
|
||||||
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():
|
bot_part_empty(bot)
|
||||||
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
|
||||||
@ -118,13 +108,20 @@ 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():
|
bot_part_empty(bot)
|
||||||
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
|
||||||
|
|
||||||
|
|
||||||
|
def bot_part_empty(bot):
|
||||||
|
ignorepartlist = []
|
||||||
|
if bot.config.SpiceBot_Logs.logging_channel:
|
||||||
|
ignorepartlist.append(bot.config.SpiceBot_Logs.logging_channel)
|
||||||
|
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")
|
||||||
|
|
||||||
|
|
||||||
@sopel.module.event('2001')
|
@sopel.module.event('2001')
|
||||||
@sopel.module.rule('.*')
|
@sopel.module.rule('.*')
|
||||||
def bot_events_setup(bot, trigger):
|
def bot_events_setup(bot, trigger):
|
||||||
|
|||||||
@ -11,6 +11,7 @@ from sopel_modules.SpiceBot_SBTools import (
|
|||||||
sopel_triggerargs, inlist, channel_privs,
|
sopel_triggerargs, inlist, channel_privs,
|
||||||
join_all_channels, channel_list_current,
|
join_all_channels, channel_list_current,
|
||||||
)
|
)
|
||||||
|
from .Channels import bot_part_empty
|
||||||
|
|
||||||
|
|
||||||
@sopel.module.nickname_commands('channels', 'channel')
|
@sopel.module.nickname_commands('channels', 'channel')
|
||||||
@ -56,6 +57,7 @@ def nickname_comand_channels(bot, trigger):
|
|||||||
if not trigger.admin:
|
if not trigger.admin:
|
||||||
bot.osd("You do not have permission to update the channel listing.")
|
bot.osd("You do not have permission to update the channel listing.")
|
||||||
return
|
return
|
||||||
|
bot_part_empty(bot)
|
||||||
bot.write(['LIST'])
|
bot.write(['LIST'])
|
||||||
bot.osd(["[SpiceBot_Channels]", "I am now updating the channel listing for this server."])
|
bot.osd(["[SpiceBot_Channels]", "I am now updating the channel listing for this server."])
|
||||||
bot.memory['SpiceBot_Channels']['ProcessLock'] = True
|
bot.memory['SpiceBot_Channels']['ProcessLock'] = True
|
||||||
@ -64,6 +66,7 @@ def nickname_comand_channels(bot, trigger):
|
|||||||
join_all_channels(bot)
|
join_all_channels(bot)
|
||||||
foundchannelcount = len(bot.memory['SpiceBot_Channels']['channels'].keys())
|
foundchannelcount = len(bot.memory['SpiceBot_Channels']['channels'].keys())
|
||||||
bot.osd("[SpiceBot_Channels]", "Channel listing finished!", str(foundchannelcount) + " channel(s) found.")
|
bot.osd("[SpiceBot_Channels]", "Channel listing finished!", str(foundchannelcount) + " channel(s) found.")
|
||||||
|
bot_part_empty(bot)
|
||||||
return
|
return
|
||||||
|
|
||||||
elif commandused == 'topic':
|
elif commandused == 'topic':
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user