JacobCoffee / byte

The Discord bot built for developers
https://docs.byte-bot.app/
MIT License
5 stars 2 forks source link

Enhancement(Issue Creation): Link to message #82

Closed JacobCoffee closed 4 months ago

JacobCoffee commented 4 months ago

@JacobCoffee is it possible for byte to link to the message in discord that these originate from?

Originally posted by @peterschutt in https://github.com/litestar-org/litestar/issues/3463#issuecomment-2105365209


[!NOTE]
We utilize Polar.sh to engage in regular as well as pledge-based > sponsorship.

Check out all issues funded or available for funding on our Polar.sh dashboard

  • If you would like to see an issue prioritized, make a pledge towards it!
  • We receive the pledge once the issue is completed & verified
  • This, along with engagement in the community, helps us know which features are a priority to our users.

Fund with Polar

JacobCoffee commented 4 months ago
Index: src/byte/plugins/github.py
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/byte/plugins/github.py b/src/byte/plugins/github.py
--- a/src/byte/plugins/github.py    (revision 1f01bcb704870b24873facc32866ec79508d639a)
+++ b/src/byte/plugins/github.py    (date 1715384999023)
@@ -51,9 +51,11 @@

     async def on_submit(self, interaction: Interaction) -> None:
         issue_reporter = interaction.user
+        issue_origin = f"https://discord.com/channels/{interaction.guild_id}/{interaction.channel_id}/{interaction.id}"
         issue_body_lines = [
             "### Reported by",
-            f"[{issue_reporter.display_name}](https://discord.com/users/{issue_reporter.id}) in Discord: {interaction.channel.name}",  # noqa: E501
+            f"[{issue_reporter.display_name}](https://discord.com/users/{issue_reporter.id}) in "
+            f"Discord ([message link]({issue_origin}): {interaction.channel.name}",
             "",
             "### Description",
             f"{self.description.value.strip()}",

Best way I can figure as interaction.message isn't available (message.jump_url) through modals