mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-24 03:29:28 +01:00
service_support: allow specifying modes to join with for each service (#326)
This updates the example config to, by default, join Automode bots as op in channels.
This commit is contained in:
parent
3900833458
commit
0cce6ca488
@ -26,6 +26,10 @@ def spawn_service(irc, source, command, args):
|
||||
nick = irc.serverdata.get("%s_nick" % name) or conf.conf.get(name, {}).get('nick') or sbot.nick or name
|
||||
ident = irc.serverdata.get("%s_ident" % name) or conf.conf.get(name, {}).get('ident') or sbot.ident or name
|
||||
|
||||
# Specify modes to join the services bot with.
|
||||
joinmodes = irc.serverdata.get("%s_joinmodes" % name) or conf.conf.get(name, {}).get('joinmodes') or ''
|
||||
joinmodes = ''.join([m for m in joinmodes if m in irc.prefixmodes])
|
||||
|
||||
if name != 'pylink' and irc.protoname == 'clientbot':
|
||||
# Prefix service bots spawned on Clientbot to prevent possible nick collisions.
|
||||
nick = 'PyLinkService@' + nick
|
||||
@ -65,7 +69,12 @@ def spawn_service(irc, source, command, args):
|
||||
|
||||
for chan in channels:
|
||||
if utils.isChannel(chan):
|
||||
log.debug('(%s) Joining services %s to channel %s with modes %r', irc.name, name, chan, joinmodes)
|
||||
if joinmodes: # Modes on join were specified; use SJOIN to burst our service
|
||||
irc.proto.sjoin(irc.sid, chan, [(joinmodes, u)])
|
||||
else:
|
||||
irc.proto.join(u, chan)
|
||||
|
||||
irc.callHooks([irc.sid, 'PYLINK_SERVICE_JOIN', {'channel': chan, 'users': [u]}])
|
||||
else:
|
||||
log.warning('(%s) Ignoring invalid autojoin channel %r.', irc.name, chan)
|
||||
|
@ -488,3 +488,8 @@ games:
|
||||
automode:
|
||||
# Sets the nick of the Automode service, if you're using it. This defaults to "automode" if not defined.
|
||||
nick: Automode
|
||||
|
||||
# For each service, you can also specify what prefix modes you want the service bot to join channels with.
|
||||
# Setting this to op (+o) for Automode makes it appear more like a standard IRC service, and lessens
|
||||
# the risk of mode overrides being dropped.
|
||||
joinmodes: 'o'
|
||||
|
Loading…
Reference in New Issue
Block a user