Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions PyBugReporter/src/BugReporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"

Expand Down Expand Up @@ -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')