Function serenity::http::create_webhook[][src]

pub fn create_webhook(channel_id: u64, map: &Value) -> Result<Webhook>

Creates a webhook for the given channel's Id, passing in the given data.

This method requires authentication.

The Value is a map with the 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.

Examples

Creating a webhook named test:

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

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

let channel_id = 81384788765712384;
let map = ObjectBuilder::new().insert("name", "test").build();

let webhook = http::create_webhook(channel_id, map).expect("Error creating");