fix: discord attachment not working for non-image files

feat: hoverEvent on [Attachment] (showing the filename)
This commit is contained in:
ChomeNS
2025-02-15 19:10:40 +07:00
parent 6ba3a1cd2d
commit 4061bc5874
2 changed files with 10 additions and 3 deletions

View File

@@ -233,7 +233,14 @@ public class DiscordPlugin {
.append(
Component
.text("[Attachment]")
.clickEvent(ClickEvent.openUrl(attachment.getProxyUrl()))
.clickEvent(ClickEvent.openUrl(attachment.getUrl()))
.hoverEvent(
HoverEvent.showText(
Component
.text(attachment.getFileName())
.color(NamedTextColor.GREEN)
)
)
.color(NamedTextColor.GREEN)
)
.append(Component.space());
@@ -242,7 +249,7 @@ public class DiscordPlugin {
Component embedsComponent = Component.empty();
if (!message.getEmbeds().isEmpty()) {
if (message.getAttachments().isEmpty() || !message.getContentDisplay().isEmpty()) embedsComponent = embedsComponent.append(Component.space());
if (!message.getContentDisplay().isEmpty()) embedsComponent = embedsComponent.append(Component.space());
for (MessageEmbed embed : message.getEmbeds()) {
final Component hoverEvent = Component.translatable(