Skip to content

Commit

Permalink
refactor: issue body
Browse files Browse the repository at this point in the history
  • Loading branch information
Alc-Alc committed May 13, 2024
1 parent d71c2f3 commit 8a70014
Showing 1 changed file with 19 additions and 18 deletions.
37 changes: 19 additions & 18 deletions src/byte/plugins/custom/litestar.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Custom plugins for the Litestar Discord."""
from __future__ import annotations

from textwrap import dedent
from typing import Self

from discord import Embed, Interaction, Message, TextStyle, app_commands
Expand Down Expand Up @@ -53,24 +54,24 @@ def __init__(

async def on_submit(self, interaction: Interaction) -> None:
issue_reporter = interaction.user
issue_body_lines = [
"### Reported by",
f"[{issue_reporter.display_name}](https://discord.com/users/{issue_reporter.id}) in ",
f"Discord [message link]({self.jump_url}): {interaction.channel.name})",
"",
"### Description",
f"{self.description.value.strip()}",
"",
"### MCVE",
f"{self.mcve.value.strip()}",
"",
"### Logs",
f"{self.logs.value.strip()}",
"",
"### Litestar Version",
f"{self.version.value.strip()}",
]
issue_body = "\n".join(issue_body_lines)
issue_body = dedent(
f"""
### Reported by
[{issue_reporter.display_name}](https://discord.com/users/{issue_reporter.id})"""
f""" in Discord ([#{interaction.channel.name}]({self.jump_url}))
### Description
{self.description.value.strip()}
### MCVE
{self.mcve.value.strip()}
### Logs
{self.logs.value.strip()}
### Litestar Version
{self.version.value.strip()}"""
).strip()
try:
response_wrapper = await github_client.rest.issues.async_create(
owner="litestar-org", repo="litestar", data={"title": self.title_.value, "body": issue_body}
Expand Down

0 comments on commit 8a70014

Please sign in to comment.