Exemplo n.º 1
0
async def unassigned(event: Event, github_object: GitHubAPI) -> None:
    """ endpoint for when an issue is unassigned """
    issue: Issue = Issue(event, github_object)

    comment: str = store.format_string(
        config_manager.issues()['on_unassigned_comment'])
    if comment != None:
        await issue.comment(comment)
Exemplo n.º 2
0
async def commented(event: Event, github_object: GitHubAPI) -> None:
    """ endpoint for when someone comments on an issue """
    issue: Issue = Issue(event, github_object)
    comment: str = store.format_string(event.data['comment']['body'])

    # check if bot posted this comment so we can ignore
    if event.data['comment']['user']['login'] == config_manager.bot_name():
        return

    if issue.is_registered_command(comment):
        await issue.dispatch(comment)
    else:
        await issue.comment(f'sorry, [{comment}] is not a registered command')
Exemplo n.º 3
0
async def opened(event: Event, github_object: GitHubAPI) -> None:
    """ endpoint for when an issue is opened """
    issue: Issue = Issue(event, github_object)

    # first check that the formatting is correct
    if not issue.is_formatted_correctly():
        await issue.comment(
            'title is formatted incorrectly. closing issue. please resubmit your issue in the correct format'
        )
        await issue.close()
        return

    # issue is formatted correctly post on opened comment
    comment: str = store.format_string(
        config_manager.issues()['on_opened_comment'])
    if comment != None:
        await issue.comment(comment)
Exemplo n.º 4
0
 def is_registered_command(self, command: str) -> bool:
     for cli_command in config_manager.issues()['cli']:
         if store.format_string(cli_command['command']) == command:
             return True
     return False