Search in sources :

Example 1 with SlashCommand

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

the class SlashCommandUpdaterDelegateImpl method updateForServer.

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

Example 2 with SlashCommand

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

the class SlashCommandUpdaterDelegateImpl method updateGlobal.

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

Aggregations

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