Search in sources :

Example 1 with UserContextMenu

use of org.javacord.api.interaction.UserContextMenu in project Javacord by BtoBastian.

the class UserContextMenuUpdaterDelegateImpl method updateGlobal.

@Override
public CompletableFuture<UserContextMenu> updateGlobal(DiscordApi api) {
    ObjectNode body = JsonNodeFactory.instance.objectNode();
    prepareBody(body);
    return new RestRequest<UserContextMenu>(api, RestMethod.PATCH, RestEndpoint.APPLICATION_COMMANDS).setUrlParameters(String.valueOf(api.getClientId()), String.valueOf(commandId)).setBody(body).execute(result -> new UserContextMenuImpl((DiscordApiImpl) api, result.getJsonBody()));
}
Also used : ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) DiscordApiImpl(org.javacord.core.DiscordApiImpl) UserContextMenu(org.javacord.api.interaction.UserContextMenu)

Example 2 with UserContextMenu

use of org.javacord.api.interaction.UserContextMenu in project Javacord by BtoBastian.

the class UserContextMenuUpdaterDelegateImpl method updateForServer.

@Override
public CompletableFuture<UserContextMenu> updateForServer(Server server) {
    ObjectNode body = JsonNodeFactory.instance.objectNode();
    prepareBody(body);
    return new RestRequest<UserContextMenu>(server.getApi(), RestMethod.PATCH, RestEndpoint.SERVER_APPLICATION_COMMANDS).setUrlParameters(String.valueOf(server.getApi().getClientId()), server.getIdAsString(), String.valueOf(commandId)).setBody(body).execute(result -> new UserContextMenuImpl((DiscordApiImpl) server.getApi(), result.getJsonBody()));
}
Also used : ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) DiscordApiImpl(org.javacord.core.DiscordApiImpl) UserContextMenu(org.javacord.api.interaction.UserContextMenu)

Aggregations

ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)2 UserContextMenu (org.javacord.api.interaction.UserContextMenu)2 DiscordApiImpl (org.javacord.core.DiscordApiImpl)2