mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-03 02:09:52 +08:00
Prevent IndexOutOfBoundsException in interaction replies (#4690)
This commit is contained in:
parent
98917d97c8
commit
d53ff36a2a
@ -34,7 +34,12 @@ public class InteractionEventImpl implements InteractionEvent {
|
||||
public void reply(String message) {
|
||||
message = FormatUtil.stripFormat(message).replace("§", ""); // Don't ask
|
||||
replyBuffer.add(message);
|
||||
event.getHook().editOriginal(new MessageBuilder().setContent(Joiner.on('\n').join(replyBuffer).substring(0, Message.MAX_CONTENT_LENGTH)).setAllowedMentions(DiscordUtil.NO_GROUP_MENTIONS).build())
|
||||
String reply = Joiner.on('\n').join(replyBuffer);
|
||||
reply = reply.substring(0, Math.min(Message.MAX_CONTENT_LENGTH, reply.length()));
|
||||
event.getHook().editOriginal(
|
||||
new MessageBuilder()
|
||||
.setContent(reply)
|
||||
.setAllowedMentions(DiscordUtil.NO_GROUP_MENTIONS).build())
|
||||
.queue(null, error -> logger.log(Level.SEVERE, "Error while editing command interaction response", error));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user