fix newlines
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
package me.youhavetrouble.noted;
|
||||
|
||||
public class MessageUtil {
|
||||
|
||||
public static String fixNewlines(String input) {
|
||||
return input.replaceAll("\\\\n", "\n");
|
||||
}
|
||||
|
||||
public static String formatForDiscord(String string) {
|
||||
return fixNewlines(string);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package me.youhavetrouble.noted.command;
|
||||
|
||||
import me.youhavetrouble.noted.Main;
|
||||
import me.youhavetrouble.noted.MessageUtil;
|
||||
import me.youhavetrouble.noted.Storage;
|
||||
import me.youhavetrouble.noted.note.Note;
|
||||
import net.dv8tion.jda.api.JDA;
|
||||
@@ -83,7 +84,10 @@ public class AddNoteCommand extends Command {
|
||||
return;
|
||||
}
|
||||
|
||||
Note note = Note.createNew(titleOption.getAsString(), contentOption.getAsString());
|
||||
Note note = Note.createNew(
|
||||
MessageUtil.formatForDiscord(titleOption.getAsString()),
|
||||
MessageUtil.formatForDiscord(contentOption.getAsString())
|
||||
);
|
||||
|
||||
OptionMapping titleUrlOption = event.getOption("title-url");
|
||||
if (titleUrlOption != null) {
|
||||
@@ -114,7 +118,7 @@ public class AddNoteCommand extends Command {
|
||||
|
||||
OptionMapping authorOption = event.getOption("author");
|
||||
if (authorOption != null) {
|
||||
note = note.withAuthor(authorOption.getAsString());
|
||||
note = note.withAuthor(MessageUtil.formatForDiscord(authorOption.getAsString()));
|
||||
}
|
||||
|
||||
OptionMapping authorUrlOption = event.getOption("author-url");
|
||||
@@ -124,7 +128,7 @@ public class AddNoteCommand extends Command {
|
||||
|
||||
OptionMapping footerOption = event.getOption("footer");
|
||||
if (footerOption != null) {
|
||||
note = note.withFooter(footerOption.getAsString());
|
||||
note = note.withFooter(MessageUtil.formatForDiscord(footerOption.getAsString()));
|
||||
}
|
||||
|
||||
OptionMapping footerUrlOption = event.getOption("footer-url");
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package me.youhavetrouble.noted.command;
|
||||
|
||||
import me.youhavetrouble.noted.Main;
|
||||
import me.youhavetrouble.noted.MessageUtil;
|
||||
import me.youhavetrouble.noted.Storage;
|
||||
import me.youhavetrouble.noted.note.Note;
|
||||
import net.dv8tion.jda.api.JDA;
|
||||
@@ -122,7 +123,7 @@ public class EditNoteCommand extends Command {
|
||||
|
||||
OptionMapping titleOption = event.getOption("title");
|
||||
if (titleOption != null) {
|
||||
note = note.withTitle(titleOption.getAsString());
|
||||
note = note.withTitle(MessageUtil.formatForDiscord(titleOption.getAsString()));
|
||||
}
|
||||
|
||||
OptionMapping titleUrlOption = event.getOption("title-url");
|
||||
@@ -132,7 +133,7 @@ public class EditNoteCommand extends Command {
|
||||
|
||||
OptionMapping contentOption = event.getOption("content");
|
||||
if (contentOption != null) {
|
||||
note = note.withContent(contentOption.getAsString());
|
||||
note = note.withContent(MessageUtil.formatForDiscord(contentOption.getAsString()));
|
||||
}
|
||||
|
||||
OptionMapping imageUrlOption = event.getOption("image-url");
|
||||
@@ -159,7 +160,7 @@ public class EditNoteCommand extends Command {
|
||||
|
||||
OptionMapping authorOption = event.getOption("author");
|
||||
if (authorOption != null) {
|
||||
note = note.withAuthor(authorOption.getAsString());
|
||||
note = note.withAuthor(MessageUtil.formatForDiscord(authorOption.getAsString()));
|
||||
}
|
||||
|
||||
OptionMapping authorUrlOption = event.getOption("author-url");
|
||||
@@ -169,7 +170,7 @@ public class EditNoteCommand extends Command {
|
||||
|
||||
OptionMapping footerOption = event.getOption("footer");
|
||||
if (footerOption != null) {
|
||||
note = note.withFooter(footerOption.getAsString());
|
||||
note = note.withFooter(MessageUtil.formatForDiscord(footerOption.getAsString()));
|
||||
}
|
||||
|
||||
OptionMapping footerUrlOption = event.getOption("footer-url");
|
||||
|
||||
Reference in New Issue
Block a user