mirror of
http://aero2k.de/t/repos/urlbot-native.git
synced 2017-09-06 15:25:38 +02:00
alternative pong; version info on startup
This commit is contained in:
@@ -116,6 +116,10 @@ def parse_commands(data):
|
||||
logger('warn', 'received hangup: ' + data)
|
||||
elif 'ping' in data:
|
||||
if ratelimit_exceeded(): return False
|
||||
if (0 == (int(time.time()) & 3)): # 1:4
|
||||
chat_write(reply_user + ''': peng (You're dead now.)''')
|
||||
logger('info', 'sent pong (variant)')
|
||||
else:
|
||||
chat_write(reply_user + ''': pong''')
|
||||
logger('info', 'sent pong')
|
||||
else:
|
||||
@@ -141,6 +145,21 @@ def parse_delete(filepath):
|
||||
|
||||
os.remove(filepath) # probably better crash here
|
||||
|
||||
def print_version_git():
|
||||
import subprocess, sys
|
||||
|
||||
cmd = ['git', 'log', '-n', '1', '--oneline', '--abbrev-commit']
|
||||
|
||||
p = subprocess.Popen(cmd, bufsize=1, stdout=subprocess.PIPE)
|
||||
first_line = p.stdout.readline()
|
||||
|
||||
if 0 == p.wait():
|
||||
print sys.argv[0] + " version (Git) '%s'" % first_line.strip()
|
||||
else:
|
||||
print sys.argv[0] + " (unknown version)"
|
||||
|
||||
print_version_git()
|
||||
|
||||
while 1:
|
||||
try:
|
||||
for f in os.listdir(event_files_dir):
|
||||
|
||||
Reference in New Issue
Block a user