Merge pull request #1302 from ProgVal/glolol/console-quit-subst

Substitute $nick and friends with <console> when exiting on Ctrl-C
This commit is contained in:
Valentin Lorentz 2017-09-17 21:09:38 +02:00 committed by GitHub
commit 12c8fa2e71

View File

@ -117,7 +117,14 @@ def main():
for irc in world.ircs:
quitmsg = conf.supybot.plugins.Owner.quitMsg() or \
'Ctrl-C at console.'
quitmsg = ircutils.standardSubstitute(irc, None, quitmsg)
# Because we're quitting from the console, none of the
# standard msg substitutions exist, and these will show as
# raw strings by default. Substitute them here with
# something meaningful instead.
env = dict((key, '<console>')
for key in ('who', 'nick', 'user', 'host'))
quitmsg = ircutils.standardSubstitute(irc, None, quitmsg,
env=env)
irc.queueMsg(ircmsgs.quit(quitmsg))
irc.die()
except SystemExit as e: