diff --git a/system/apimock.py b/system/apimock.py index 8e48194..74eb311 100644 --- a/system/apimock.py +++ b/system/apimock.py @@ -1,12 +1,3 @@ -#Possible actions: -# - create repository -# - delete repository -# - list repositories -# - list respository issues -# - list repository pull requests -# - list notifications -# - list repository tests - repositoriesMock = ["repo1", "repo2", "repo3"] issuesMock = [ { diff --git a/system/generator_jezyka_nautalnego.py b/system/generator_jezyka_nautalnego.py index 02c7bcb..69b1c41 100644 --- a/system/generator_jezyka_nautalnego.py +++ b/system/generator_jezyka_nautalnego.py @@ -1,3 +1,4 @@ +from apimock import * import difflib as dl import random import sys @@ -37,7 +38,7 @@ bye = [ "Do zobaczenia", "Do widzenia", "Miłego dnia", - "Do widzenia i miłego dnia" + "Do widzenia i miłego dnia", "Narazie" ] @@ -72,6 +73,31 @@ def generator_jezyka_nautalnego(frame, tactic, state, text): print() sys.exit(0) + elif tactic[0] == 'ANSWER' and tactic[1] == 'issues': + print("Lista issues w repozytorium " + tactic[2][0][1] + ":") + issues = listRepositoryIssues(tactic[2][0][1]) + for issue in issues: + print(issue['name']) + print(issue['description']) + print(issue['status']) + print() + + elif tactic[0] == 'ANSWER' and tactic[1] == 'pullrequest': + print("Lista pull requestów w repozytorium " + tactic[2][0][1] + ":") + prs = listRepositoryPullRequests(tactic[2][0][1]) + for pr in prs: + print(pr['name']) + print(pr['description']) + print(pr['state']) + print() + + elif tactic == 'hello': + print(random.choice(welcome)) + + elif tactic[0] == 'QUESTION' and tactic[1][0] == 'repo': + print("Dodaj nazwę repozytorium na końcu komendy") + print("np. w nazwarepozytorium") + else: print(tactic) diff --git a/system/taktyka_dialogu.py b/system/taktyka_dialogu.py index 62cd300..b009fee 100644 --- a/system/taktyka_dialogu.py +++ b/system/taktyka_dialogu.py @@ -56,6 +56,8 @@ def validate_repo(repo): def long_thread(state): act = state['current_context'] + if act == None: + return 'null' for topic in state['topics']: if act == topic['act']: slots = topic['slots'] @@ -66,7 +68,7 @@ def long_thread(state): opt_args = add_facts(opt_args, facts) required_empty = check_req(req_args) if required_empty: - return "QESTION", required_empty[0] #slot do uzupełnienia + return "QUESTION", required_empty[0] #slot do uzupełnienia return "ANSWER", act, req_args, opt_args #wyświetl użytkownikowi def check_req(req_args):