From 7eac5e198670954e14651ed91d6bbc090998c411 Mon Sep 17 00:00:00 2001 From: Jonathan Christensen Date: Wed, 17 Sep 2025 16:23:57 -0600 Subject: [PATCH] Added async manual bug report --- PyBugReporter/src/BugReporter.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/PyBugReporter/src/BugReporter.py b/PyBugReporter/src/BugReporter.py index 2e5754a..231dbe1 100644 --- a/PyBugReporter/src/BugReporter.py +++ b/PyBugReporter/src/BugReporter.py @@ -366,6 +366,17 @@ async def _getRepoId_async(self, handler: BugHandler) -> str: def manualBugReport(cls, repoName: str, errorTitle: str, errorMessage: str) -> None: """Manually sends a bug report to the Github repository. + Args: + repoName (str): the name of the repo to report to + errorTitle (str): the title of the error + errorMessage (str): the error message + """ + asyncio.run(cls.manualBugReportAsync(repoName,errorTitle,errorMessage)) + + @classmethod + async def manualBugReportAsync(cls, repoName: str, errorTitle: str, errorMessage: str) -> None: + """Manually sends a bug report to the Github repository. + Args: repoName (str): the name of the repo to report to errorTitle (str): the title of the error @@ -381,7 +392,7 @@ def manualBugReport(cls, repoName: str, errorTitle: str, errorMessage: str) -> N headers = {"Authorization": f"Bearer {handler.githubKey}"} # query variables - repoId = asyncio.run(cls._getRepoId_async(cls, handler)) + repoId = await cls._getRepoId_async(cls, handler) bugLabel = "LA_kwDOJ3JPj88AAAABU1q15w" autoLabel = "LA_kwDOJ3JPj88AAAABU1q2DA" @@ -414,15 +425,15 @@ def manualBugReport(cls, repoName: str, errorTitle: str, errorMessage: str) -> N } } - issueExists = asyncio.run(cls._checkIfIssueExists_async(cls, handler, errorTitle)) + issueExists = await cls._checkIfIssueExists_async(cls, handler, errorTitle) # Send to Discord if applicable if cls.handlers[repoName].useDiscord: discordBot = DiscordBot(cls.handlers[repoName].botToken, cls.handlers[repoName].channelId) - asyncio.run(discordBot.send_message(f"## {repoName}: {errorTitle}\n{errorMessage}", issueExists)) + await discordBot.send_message(f"## {repoName}: {errorTitle}\n{errorMessage}", issueExists) if (issueExists == False): - result = asyncio.run(client.execute_async(query=createIssue, variables=variables, headers=headers)) + result = await client.execute_async(query=createIssue, variables=variables, headers=headers) print('\nThis error has been reported to the Tree Growth team.\n') else: print('\nOur team is already aware of this issue.\n')