3
0
mirror of https://github.com/jlu5/PyLink.git synced 2025-02-17 14:01:03 +01:00

clientbot: support expansions ($nick, etc) in autoperform

This commit is contained in:
James Lu 2018-02-20 23:19:19 -08:00
parent 0b0da2cfe6
commit 804791b8af
2 changed files with 7 additions and 1 deletions

View File

@ -433,8 +433,11 @@ servers:
# something like 0.5 or 1.0 should help. Defaults to 0.005 if not set.
throttle_time: 0.3
# Clientbot also supports auto perform, using raw IRC messages.
# Raw IRC messages to send on connect. As of 2.0-alpha2, expansions such as $nick, $ident,
# and $host are also supported via Python template strings
# (https://docs.python.org/3/library/string.html#template-strings)
#autoperform:
# - "MODE $nick +B"
# - "NOTICE somebody :hello, i've connected"
# Determines whether oper statuses should be tracked on this Clientbot network. This

View File

@ -640,6 +640,9 @@ class ClientbotWrapperProtocol(IRCCommonProtocol):
# Run autoperform commands.
for line in self.serverdata.get("autoperform", []):
# Expand substitutions like $nick, $ident, $host
tmpl = string.Template(line)
line = tmpl.safe_substitute(**self.pseudoclient.__dict__)
self.send(line)
# Virtual endburst hook.