Function serenity::http::edit_webhook [] [src]

pub fn edit_webhook(webhook_id: u64, map: &Value) -> Result<Webhook>

Edits a the webhook with the given data.

The Value is a map with optional values of:

  • avatar: base64-encoded 128x128 image for the webhook's default avatar (optional);
  • name: the name of the webhook, limited to between 2 and 100 characters long.

Note that, unlike with create_webhook, all values are optional.

This method requires authentication, whereas edit_webhook_with_token does not.

Examples

Edit the image of a webhook given its Id and unique token:

This example is not tested
extern crate serde_json;
extern crate serenity;

use serde_json::builder::ObjectBuilder;
use serenity::http;

let id = 245037420704169985;
let token = "ig5AO-wdVWpCBtUUMxmgsWryqgsW3DChbKYOINftJ4DCrUbnkedoYZD0VOH1QLr-S3sV";
let image = serenity::utils::read_image("./webhook_img.png")
    .expect("Error reading image");
let map = ObjectBuilder::new().insert("avatar", image).build();

let edited = http::edit_webhook_with_token(id, token, map)
    .expect("Error editing webhook");