fix: Update post URL formatting to use angle brackets in random message responses

This commit is contained in:
Slipstream 2025-06-04 21:42:59 -06:00
parent ff2e555b1e
commit ddfcf28237
Signed by: slipstream
GPG Key ID: 13E498CE010AC6FD

View File

@ -418,14 +418,14 @@ class GelbooruWatcherBaseCog(commands.Cog, abc.ABC, metaclass=GelbooruWatcherMet
async def new_random(self, interaction: discord.Interaction, button: Button): async def new_random(self, interaction: discord.Interaction, button: Button):
random_result = random.choice(self.all_results) random_result = random.choice(self.all_results)
post_url = self.cog.post_url_template.format(random_result["id"]) post_url = self.cog.post_url_template.format(random_result["id"])
content = f"{random_result['file_url']}\n{post_url}" content = f"<{post_url}>\n{random_result['file_url']}"
await interaction.response.edit_message(content=content, view=self) await interaction.response.edit_message(content=content, view=self)
@discord.ui.button(label="Random In New Message", style=discord.ButtonStyle.success) @discord.ui.button(label="Random In New Message", style=discord.ButtonStyle.success)
async def new_message(self, interaction: discord.Interaction, button: Button): async def new_message(self, interaction: discord.Interaction, button: Button):
random_result = random.choice(self.all_results) random_result = random.choice(self.all_results)
post_url = self.cog.post_url_template.format(random_result["id"]) post_url = self.cog.post_url_template.format(random_result["id"])
content = f"{random_result['file_url']}\n{post_url}" content = f"<{post_url}>\n{random_result['file_url']}"
await interaction.response.send_message(content, view=self, ephemeral=self.hidden) await interaction.response.send_message(content, view=self, ephemeral=self.hidden)
@discord.ui.button(label="Browse Results", style=discord.ButtonStyle.secondary) @discord.ui.button(label="Browse Results", style=discord.ButtonStyle.secondary)
@ -517,7 +517,7 @@ class GelbooruWatcherBaseCog(commands.Cog, abc.ABC, metaclass=GelbooruWatcherMet
return return
random_result = random.choice(self.all_results) random_result = random.choice(self.all_results)
post_url = self.cog.post_url_template.format(random_result["id"]) post_url = self.cog.post_url_template.format(random_result["id"])
content = f"{random_result['file_url']}\n{post_url}" content = f"<{post_url}>\n{random_result['file_url']}"
view = self.cog.GelbooruButtons( view = self.cog.GelbooruButtons(
self.cog, self.tags, self.all_results, self.hidden self.cog, self.tags, self.all_results, self.hidden
) )