Search in sources :

Example 1 with MessageRequest

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;
}
Also used : MessageRequest(sx.blah.discord.api.internal.json.requests.MessageRequest) DiscordClientImpl(sx.blah.discord.api.internal.DiscordClientImpl)

Aggregations

DiscordClientImpl (sx.blah.discord.api.internal.DiscordClientImpl)1 MessageRequest (sx.blah.discord.api.internal.json.requests.MessageRequest)1