Function parse_webhook

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

Parses the id and token from a webhook url. Expects a url::Url 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");