use of sx.blah.discord.api.internal.json.requests.MessageRequest in project Discord4J by Discord4J.
the class Message method edit.
@Override
public IMessage edit(String content, EmbedObject embed) {
getShard().checkReady("edit message");
if (!this.getAuthor().equals(client.getOurUser()))
throw new MissingPermissionsException("Cannot edit other users' messages!", EnumSet.noneOf(Permissions.class));
if (isDeleted())
throw new DiscordException("Cannot edit deleted messages!");
if (embed != null) {
PermissionUtils.requirePermissions(getChannel(), client.getOurUser(), Permissions.EMBED_LINKS);
}
((DiscordClientImpl) client).REQUESTS.PATCH.makeRequest(DiscordEndpoints.CHANNELS + channel.getStringID() + "/messages/" + id, new MessageRequest(content, embed, false));
return this;
}
Aggregations