Skip to content

Commit d59f9f5

Browse files
authored
Merge pull request barosl#84 from servo/ping
add homu ping command (fixes barosl#83)
2 parents 19c16ed + 612d2b2 commit d59f9f5

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

homu/main.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import subprocess
1919
from .git_helper import SSH_KEY_FILE
2020
import shlex
21+
import random
2122

2223
STATUS_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+
281286
def 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

Comments
 (0)