Substitute $nick and friends with <console> when exiting on Ctrl-C

This commit is contained in:
James Lu 2017-09-17 11:45:10 -07:00
parent d96d464698
commit 17a0348d9a

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: