mirror of
https://github.com/jlu5/PyLink.git
synced 2025-02-21 16:00:57 +01:00
service_support: skip dynamic join/part hooks on bot-only servers
This commit is contained in:
parent
78d1d20856
commit
0ead868546
@ -131,6 +131,10 @@ utils.add_hook(handle_kill, 'KILL')
|
|||||||
|
|
||||||
def handle_join(irc, source, command, args):
|
def handle_join(irc, source, command, args):
|
||||||
"""Monitors channel joins for dynamic service bot joining."""
|
"""Monitors channel joins for dynamic service bot joining."""
|
||||||
|
if irc.has_cap('visible-state-only'):
|
||||||
|
# No-op on bot-only servers.
|
||||||
|
return
|
||||||
|
|
||||||
channel = args['channel']
|
channel = args['channel']
|
||||||
users = irc.channels[channel].users
|
users = irc.channels[channel].users
|
||||||
for servicename, sbot in world.services.items():
|
for servicename, sbot in world.services.items():
|
||||||
@ -143,6 +147,10 @@ utils.add_hook(handle_join, 'PYLINK_SERVICE_JOIN')
|
|||||||
|
|
||||||
def _services_dynamic_part(irc, channel):
|
def _services_dynamic_part(irc, channel):
|
||||||
"""Dynamically removes service bots from empty channels."""
|
"""Dynamically removes service bots from empty channels."""
|
||||||
|
if irc.has_cap('visible-state-only'):
|
||||||
|
# No-op on bot-only servers.
|
||||||
|
return
|
||||||
|
|
||||||
# If all remaining users in the channel are service bots, make them all part.
|
# If all remaining users in the channel are service bots, make them all part.
|
||||||
if all(irc.is_internal_client(u) for u in irc.channels[channel].users):
|
if all(irc.is_internal_client(u) for u in irc.channels[channel].users):
|
||||||
for u in irc.channels[channel].users.copy():
|
for u in irc.channels[channel].users.copy():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user