Add CTCP VERSION support

This commit is contained in:
io 2016-04-04 20:18:04 -03:00 committed by Ryan Schmidt
parent 5108822594
commit 4e41dfe47a

View File

@ -24,6 +24,7 @@ import fnmatch
import itertools
import math
import os
import platform
import random
import re
import signal
@ -6562,6 +6563,14 @@ def relay(cli, nick, chan, rest):
if rest.startswith("\u0001PING"):
cli.notice(nick, rest)
return
if rest == "\u0001VERSION\u0001":
try:
ans = subprocess.check_output(["git", "log", "-n", "1", "--pretty=format:%h"])
reply = "\u0001VERSION lykos {0}, Python {1} -- https://github.com/lykoss/lykos\u0001".format(str(ans.decode()), platform.python_version())
except (OSError, subprocess.CalledProcessError):
reply = "\u0001VERSION lykos, Python {0} -- https://github.com/lykoss/lykos\u0001".format(platform.python_version())
cli.notice(nick, reply)
return
if var.PHASE not in ("night", "day"):
return