1818import subprocess
1919from .git_helper import SSH_KEY_FILE
2020import shlex
21+ import random
2122
2223STATUS_TO_PRIORITY = {
2324 'success' : 0 ,
@@ -278,6 +279,10 @@ def verify_auth(username, repo_cfg, state, auth, realtime):
278279 return False
279280
280281
282+ PORTAL_TURRET_DIALOG = ["Target acquired" , "Activated" , "Who's there?" , "There you are" ]
283+ PORTAL_TURRET_IMAGE = "https://cloud.githubusercontent.com/assets/1617736/22222924/c07b2a1c-e16d-11e6-91b3-ac659550585c.png"
284+
285+
281286def parse_commands (body , username , repo_cfg , state , my_username , db , states , * , realtime = False , sha = '' ):
282287 # Skip parsing notifications that we created
283288 if username == my_username :
@@ -286,6 +291,8 @@ def parse_commands(body, username, repo_cfg, state, my_username, db, states, *,
286291 state_changed = False
287292
288293 words = list (chain .from_iterable (re .findall (r'\S+' , x ) for x in body .splitlines () if '@' + my_username in x ))
294+ if words [1 :] == ["are" , "you" , "still" , "there?" ]:
295+ state .add_comment (":cake: {}\n \n " .format (random .choice (PORTAL_TURRET_DIALOG ), PORTAL_TURRET_IMAGE ))
289296 for i , word in reversed (list (enumerate (words ))):
290297 found = True
291298
@@ -459,7 +466,8 @@ def parse_commands(body, username, repo_cfg, state, my_username, db, states, *,
459466 state .init_build_res ([])
460467
461468 state .save ()
462-
469+ elif word == 'hello?' or word == 'ping' :
470+ state .add_comment (":sleepy: I'm awake I'm awake" )
463471 else :
464472 found = False
465473
0 commit comments