Skip to content
This repository was archived by the owner on Mar 20, 2024. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion homu/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import subprocess
from .git_helper import SSH_KEY_FILE
import shlex
import random

STATUS_TO_PRIORITY = {
'success': 0,
Expand Down Expand Up @@ -278,6 +279,10 @@ def verify_auth(username, repo_cfg, state, auth, realtime):
return False


PORTAL_TURRET_DIALOG = ["Target acquired", "Activated", "Who's there?", "There you are"]
PORTAL_TURRET_IMAGE = "https://cloud.githubusercontent.com/assets/1617736/22222924/c07b2a1c-e16d-11e6-91b3-ac659550585c.png"


def parse_commands(body, username, repo_cfg, state, my_username, db, states, *, realtime=False, sha=''):
# Skip parsing notifications that we created
if username == my_username:
Expand All @@ -286,6 +291,8 @@ def parse_commands(body, username, repo_cfg, state, my_username, db, states, *,
state_changed = False

words = list(chain.from_iterable(re.findall(r'\S+', x) for x in body.splitlines() if '@' + my_username in x))
if words[1:] == ["are", "you", "still", "there?"]:
state.add_comment(":cake: {}\n\n![]({})".format(random.choice(PORTAL_TURRET_DIALOG), PORTAL_TURRET_IMAGE))
for i, word in reversed(list(enumerate(words))):
found = True

Expand Down Expand Up @@ -459,7 +466,8 @@ def parse_commands(body, username, repo_cfg, state, my_username, db, states, *,
state.init_build_res([])

state.save()

elif word == 'hello?' or word == 'ping':
state.add_comment(":sleepy: I'm awake I'm awake")
else:
found = False

Expand Down