[OPB-15] removing spaces before > for news posts, because of formatting issue of discord

This commit is contained in:
Sheldan
2021-05-02 20:35:38 +02:00
parent 58f92293a4
commit f2055d8c52
2 changed files with 4 additions and 0 deletions

View File

@@ -26,6 +26,8 @@ public class News extends AbstractConditionableCommand {
@Override
public CompletableFuture<CommandResult> executeAsync(CommandContext commandContext) {
String text = (String) commandContext.getParameters().getParameters().get(0);
// workaround for Discord formatting issue
text = text.replace("\n >", "\n>");
return newsServiceBean.sendNewsPost(text, commandContext.getMessage())
.thenApply(unused -> CommandResult.fromSuccess());
}

View File

@@ -28,6 +28,8 @@ public class UpdateNews extends AbstractConditionableCommand {
List<Object> parameters = commandContext.getParameters().getParameters();
Long messageId = (Long) parameters.get(0);
String postText = (String) parameters.get(1);
// workaround for Discord formatting issue
postText = postText.replace("\n >", "\n>");
return newsServiceBean.updateNewsPostViaId(messageId, postText, commandContext.getMessage())
.thenApply(unused -> CommandResult.fromSuccess());
}