Fix urban dictionary term not getting parsed correctly for url

This commit is contained in:
Bea 2022-12-20 00:52:31 +01:00
parent d412801758
commit 8ca70dac78

View File

@ -176,10 +176,9 @@ public class UrbanDictionaryCommand implements MessageCommand
} }
// make it nice to look at, compared to the html value // make it nice to look at, compared to the html value
term = term.replaceAll("\\+", " ");
term = WordUtils.capitalizeFully(term);
final String finalTerm = term;
term = WordUtils.capitalizeFully(term.replaceAll("\\+", " "));
String serializedMeanings = serialize(plaintextMeanings); String serializedMeanings = serialize(plaintextMeanings);
String serializedExamples = serialize(plaintextExamples); String serializedExamples = serialize(plaintextExamples);
@ -194,7 +193,6 @@ public class UrbanDictionaryCommand implements MessageCommand
plaintextExamples.get(0), contributorsNames.get(0), submissionDates.get(0), 0); plaintextExamples.get(0), contributorsNames.get(0), submissionDates.get(0), 0);
// copy term for async thing // copy term for async thing
final String finalTerm = term;
event.getChannel() event.getChannel()
.sendMessageEmbeds(embed) .sendMessageEmbeds(embed)
.addActionRow(previousPageButton.asDisabled(), //disabled by default because we're on page 0 .addActionRow(previousPageButton.asDisabled(), //disabled by default because we're on page 0
@ -243,8 +241,6 @@ public class UrbanDictionaryCommand implements MessageCommand
public static void changePage(ButtonInteractionEvent event, boolean increase) public static void changePage(ButtonInteractionEvent event, boolean increase)
{ {
String messageId = event.getMessageId(); String messageId = event.getMessageId();
DatabaseSource database = Cache.getDatabaseSource(); DatabaseSource database = Cache.getDatabaseSource();
@ -278,6 +274,8 @@ public class UrbanDictionaryCommand implements MessageCommand
page++; page++;
else page--; else page--;
term = WordUtils.capitalizeFully(term.replaceAll("\\+", " "));
MessageEmbed updatedEmbed = buildEmbed(term, url, event.getUser(), MessageEmbed updatedEmbed = buildEmbed(term, url, event.getUser(),
meanings.get(page), examples.get(page), contributors.get(page), meanings.get(page), examples.get(page), contributors.get(page),
dates.get(page), page); dates.get(page), page);