Skip to content

Commit

Permalink
Using attachment for tag-raw
Browse files Browse the repository at this point in the history
instead of escaped markdown in an embed which leads to bugs
  • Loading branch information
Zabuzard committed Jan 18, 2022
1 parent 0be28de commit 8e8d1a8
Showing 1 changed file with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import net.dv8tion.jda.api.interactions.commands.OptionType;
import net.dv8tion.jda.api.interactions.commands.build.SubcommandData;
import net.dv8tion.jda.api.requests.ErrorResponse;
import net.dv8tion.jda.api.utils.AttachmentOption;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -18,6 +19,7 @@
import org.togetherjava.tjbot.commands.utils.MessageUtils;
import org.togetherjava.tjbot.config.Config;

import java.nio.charset.StandardCharsets;
import java.time.Instant;
import java.util.Objects;
import java.util.OptionalLong;
Expand Down Expand Up @@ -154,14 +156,8 @@ private void rawTag(@NotNull SlashCommandEvent event) {
return;
}

event
.replyEmbeds(new EmbedBuilder()
.setDescription(MessageUtils.escapeMarkdown(tagSystem.getTag(id).orElseThrow()))
.setFooter(event.getUser().getName())
.setTimestamp(Instant.now())
.setColor(TagSystem.AMBIENT_COLOR)
.build())
.queue();
String content = tagSystem.getTag(id).orElseThrow();
event.reply("").addFile(content.getBytes(StandardCharsets.UTF_8), "content.md").queue();
}

private void createTag(@NotNull CommandInteraction event) {
Expand Down

0 comments on commit 8e8d1a8

Please sign in to comment.