[−][src]Function serenity::utils::parse_invite
pub fn parse_invite(code: &str) -> &str
Retrieves the "code" part of an invite out of a URL.
Examples
Three formats of invite codes are supported:
- 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.gg/0cDvIgU2voY8RSYL"
:
use serenity::utils; let url = "http://discord.gg/0cDvIgU2voY8RSYL"; assert_eq!(utils::parse_invite(url), "0cDvIgU2voY8RSYL");
- Retrieving the code from the URL
"discord.gg/0cDvIgU2voY8RSYL"
:
use serenity::utils; let url = "discord.gg/0cDvIgU2voY8RSYL"; assert_eq!(utils::parse_invite(url), "0cDvIgU2voY8RSYL");