use of sx.blah.discord.api.internal.json.requests.WebhookEditRequest in project Discord4J by Discord4J.
the class Webhook method edit.
/**
* Sends a request to edit the webhook.
*
* @param name The default name of the webhook.
* @param avatar The base64-encoded default avatar of the webhook.
*/
private void edit(String name, String avatar) {
PermissionUtils.requirePermissions(channel, client.getOurUser(), Permissions.MANAGE_WEBHOOKS);
WebhookObject response = ((DiscordClientImpl) client).REQUESTS.PATCH.makeRequest(DiscordEndpoints.WEBHOOKS + id, new WebhookEditRequest(name, avatar), WebhookObject.class);
IWebhook oldWebhook = copy();
IWebhook newWebhook = DiscordUtils.getWebhookFromJSON(channel, response);
client.getDispatcher().dispatch(new WebhookUpdateEvent(oldWebhook, newWebhook));
}
Aggregations