pub fn parse_invite(code: &str) -> &strExpand description
Retrieves the “code” part of an invite out of a URL.
§Examples
Two formats of invite codes are supported, both regardless of protocol prefix. Some examples:
- Retrieving the code from the URL
"https://discord.gg/0cDvIgU2voY8RSYL":
use serenity::utils;
let url = "https://discord.gg/0cDvIgU2voY8RSYL";
assert_eq!(utils::parse_invite(url), "0cDvIgU2voY8RSYL");- Retrieving the code from the URL
"http://discord.com/invite/0cDvIgU2voY8RSYL":
use serenity::utils;
let url = "http://discord.com/invite/0cDvIgU2voY8RSYL";
assert_eq!(utils::parse_invite(url), "0cDvIgU2voY8RSYL");