2022-06-15 08:47:39 +02:00
|
|
|
from apimock import *
|
2022-06-15 00:02:44 +02:00
|
|
|
import difflib as dl
|
2022-06-07 20:48:37 +02:00
|
|
|
import random
|
2022-06-15 00:02:44 +02:00
|
|
|
import sys
|
2022-04-20 09:14:16 +02:00
|
|
|
|
2022-06-15 00:02:44 +02:00
|
|
|
commands = [
|
|
|
|
'pomoc',
|
2022-06-15 10:32:26 +02:00
|
|
|
'powiedz co nowego w moim repozytorium x',
|
2022-06-15 00:02:44 +02:00
|
|
|
'do widzenia',
|
|
|
|
'pokaz issue w',
|
|
|
|
'pokaz mi powiadomienia',
|
|
|
|
'jakie sa pull requesty',
|
|
|
|
'pokaz mi testy w'
|
|
|
|
]
|
|
|
|
|
|
|
|
welcome = [
|
|
|
|
'Witaj!',
|
2022-06-07 20:48:37 +02:00
|
|
|
"Cześć",
|
|
|
|
"Hello",
|
|
|
|
"Hej",
|
|
|
|
"Dzień dobry",
|
2022-06-15 00:02:44 +02:00
|
|
|
"Hey"
|
|
|
|
]
|
|
|
|
|
|
|
|
unknown = [
|
|
|
|
"Nie rozumiem.",
|
|
|
|
"Nie wiem co masz na myśli."
|
|
|
|
]
|
2022-06-07 20:48:37 +02:00
|
|
|
|
2022-06-15 00:02:44 +02:00
|
|
|
other = [
|
|
|
|
"Podobne komendy: ",
|
|
|
|
"Może chodziło Ci o te komendy: ",
|
|
|
|
"Spróbuj wybrać jedną z tych komend: "
|
|
|
|
]
|
2022-06-07 20:48:37 +02:00
|
|
|
|
2022-06-15 00:02:44 +02:00
|
|
|
bye = [
|
|
|
|
"Żegnaj!",
|
2022-06-07 20:48:37 +02:00
|
|
|
"Do zobaczenia",
|
|
|
|
"Do widzenia",
|
|
|
|
"Miłego dnia",
|
2022-06-15 08:47:39 +02:00
|
|
|
"Do widzenia i miłego dnia",
|
2022-06-15 00:02:44 +02:00
|
|
|
"Narazie"
|
|
|
|
]
|
2022-06-07 20:48:37 +02:00
|
|
|
|
|
|
|
help = ["Obsługuję przekazywanie informacji z systemu GitHub - repozytoria, pull requesty, issue, powiadomienia."]
|
|
|
|
time = ["Z jakiego czasu?", "Z jakiego okresu?", "Podaj z jakiego przedziału czasowego"]
|
2022-06-15 00:02:44 +02:00
|
|
|
|
|
|
|
repo = [
|
|
|
|
"Z jakiego repozytorium",
|
|
|
|
"Wskaż repozytorium",
|
|
|
|
"Podaj z jakiego repozytorium chciałbyć otrzymać informacje",
|
|
|
|
"Określ repozytorium"
|
|
|
|
]
|
|
|
|
|
2022-06-07 20:48:37 +02:00
|
|
|
howmany = ["Ile ostatnich elemntów chcesz zobaczyć?", "Ile ostatnich elmentów wyświetlić?", "Ile ostatnich elemnetów pokazać?"]
|
2022-06-15 00:02:44 +02:00
|
|
|
error_time = ["Podano nie prawidłowy czas, popraw ramy czasowe", "Czas jest nie prawidłowy, podaj ponownie", "Podaj przedział czasowy jeszcze raz"]
|
|
|
|
error_repo = ["Podano nieprawidłową nazwę repozytorium", "Podaj ponownie nazwę repozytorium, ponieważ podania nie prawidłową"]
|
2022-06-07 20:48:37 +02:00
|
|
|
|
2022-06-15 00:02:44 +02:00
|
|
|
|
|
|
|
def generator_jezyka_nautalnego(frame, tactic, state, text):
|
|
|
|
if tactic == 'null':
|
|
|
|
beastMatch = dl.get_close_matches(text, commands)
|
|
|
|
print(random.choice(unknown))
|
|
|
|
if len(beastMatch) > 0:
|
|
|
|
print(random.choice(other) + ', '.join(beastMatch))
|
|
|
|
|
|
|
|
elif tactic[1] == 'help':
|
|
|
|
print(random.choice(help))
|
|
|
|
print("Dostępne komendy: \n - " + '\n - '.join(commands))
|
|
|
|
|
|
|
|
elif tactic == 'bye':
|
|
|
|
print(random.choice(bye))
|
|
|
|
print()
|
|
|
|
sys.exit(0)
|
2022-06-01 12:22:40 +02:00
|
|
|
|
2022-06-15 08:47:39 +02:00
|
|
|
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()
|
|
|
|
|
2022-06-15 10:32:26 +02:00
|
|
|
elif tactic[0] == 'ANSWER' and tactic[1] == 'brefing':
|
|
|
|
print("Podsumowanie w repozytorium " + tactic[2][0][1] + ":")
|
|
|
|
brefings = getBrefing()
|
|
|
|
for brefing in brefings:
|
|
|
|
print(brefing['name'])
|
|
|
|
print(brefing['description'])
|
|
|
|
print()
|
|
|
|
|
|
|
|
elif tactic[0] == 'ANSWER' and tactic[1] == 'tests':
|
|
|
|
print("Lista testów w repozytorium " + tactic[2][0][1] + ":")
|
|
|
|
tests = listRepositoryTests(tactic[2][0][1])
|
|
|
|
for test in tests:
|
|
|
|
print(test['name'])
|
|
|
|
print(test['description'])
|
|
|
|
print(test['status'])
|
|
|
|
print()
|
|
|
|
|
|
|
|
elif tactic[0] == 'ANSWER' and tactic[1] == 'notifications':
|
|
|
|
print("Lista powidomień w repozytorium " + tactic[2][0][1] + ":")
|
|
|
|
notifications = listNotifications(tactic[2][0][1])
|
|
|
|
for notification in notifications:
|
|
|
|
print(notification['name'])
|
|
|
|
print(notification['description'])
|
|
|
|
print()
|
|
|
|
|
2022-06-15 08:47:39 +02:00
|
|
|
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")
|
|
|
|
|
2022-05-25 12:52:02 +02:00
|
|
|
else:
|
2022-06-15 00:02:44 +02:00
|
|
|
print(tactic)
|
|
|
|
|
|
|
|
print()
|