Skip to content

Commit 5219c11

Browse files
committed
fix exception
1 parent 6996b33 commit 5219c11

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

server/src/main/java/club/moddedminecraft/polychat/server/handlers/protomessages/GenericCommandResultMessageHandler.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import org.slf4j.Logger;
1010
import org.slf4j.LoggerFactory;
1111

12-
import java.awt.*;
12+
import java.awt.Color;
1313

1414
public final class GenericCommandResultMessageHandler {
1515
private final static Logger logger = LoggerFactory.getLogger(ServerStatusMessageHandler.class);
@@ -27,15 +27,21 @@ public void handle(CommandProtos.GenericCommandResult msg, ConnectedClient autho
2727
.addField("Server", msg.getServerId(), false);
2828

2929
if (!msg.getCommandOutput().isEmpty()) {
30-
eb.addField("Command output", msg.getCommandOutput(), false);
30+
String output = msg.getCommandOutput();
31+
32+
if (output.length() > 1024) {
33+
output = output.substring(0, 1024);
34+
}
35+
36+
eb.addField("Command output", output, false);
3137
}
3238

3339
TextChannel channelCmdOriginatedFrom = jda.getTextChannelById(msg.getDiscordChannelId());
3440

3541
if (channelCmdOriginatedFrom != null) {
3642
channelCmdOriginatedFrom.sendMessage(eb.build()).queue();
3743
} else {
38-
logger.error("Client told me a command was sent from a Discord channel that doesn't exist.");
44+
logger.error("Client claimed a command was sent from a Discord channel that doesn't exist.");
3945
}
4046
}
4147
}

0 commit comments

Comments
 (0)