Skip to content

Commit

Permalink
Add telegram tagging functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
lauwsj-alpha committed Feb 15, 2022
1 parent f72f9d8 commit f51a9c4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion github/github_functionalities.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@
database_client = MySQLClient(database_name)
github_client = GitHubClient(GITHUB_API_TOKEN, database_client)

github_telegram_map = {
'simonjulianl': 'simonjulianl',
'lauwsj': 'simonjulianl',
'Amadeus-Winarto': 'amadeusw',
'bernarduskrishna': 'Bernardus_Krishna',
'CommanderW324': 'CwD324'
}


def get_github_repo(update: Update, context: CallbackContext):
repo_list_string = github_client.get_repo_list()
Expand Down Expand Up @@ -113,4 +121,14 @@ def clean_up_existing_pr_id(repo_name: str):


def convert_pr_list_to_string(pull_requests):
return ''.join([f'- {resp["title"]} : {resp["html_url"]} \n\n' for resp in pull_requests])
return ''.join([
f'New PR [opened by @{github_telegram_map.get(resp["user"]["login"], resp["user"]["login"])}] : {resp["title"]}\n'
f'Link: {resp["html_url"]}\n'
f'Reviewer : {get_reviewers(resp)} \n\n'
for resp in pull_requests])


def get_reviewers(pull_request):
reviewer = ','.join(['@' + github_telegram_map.get(resp["login"], resp["login"]) for resp in
pull_request["requested_reviewers"]])
return reviewer
Binary file removed test.zip
Binary file not shown.

0 comments on commit f51a9c4

Please sign in to comment.