Function serenity::utils::parse_webhook[][src]

pub fn parse_webhook(url: &Url) -> Option<(u64, &str)>
Expand description

Parses the id and token from a webhook url. Expects a reqwest::Url object rather than a &str.

Examples

use serenity::utils;

let url_str = "https://discord.com/api/webhooks/245037420704169985/ig5AO-wdVWpCBtUUMxmgsWryqgsW3DChbKYOINftJ4DCrUbnkedoYZD0VOH1QLr-S3sV";
let url = url_str.parse().unwrap();
let (id, token) = utils::parse_webhook(&url).unwrap();

assert_eq!(id, 245037420704169985);
assert_eq!(token, "ig5AO-wdVWpCBtUUMxmgsWryqgsW3DChbKYOINftJ4DCrUbnkedoYZD0VOH1QLr-S3sV");