Function serenity::utils::parse_mention[][src]

pub fn parse_mention(mention: impl AsRef<str>) -> Option<u64>
Expand description

Retrieve the ID number out of a channel, role, or user mention.

If the mention is invalid, None is returned.

Examples

use serenity::utils::parse_mention;

assert_eq!(parse_mention("<@136510335967297536>"), Some(136510335967297536));
assert_eq!(parse_mention("<@&137235212097683456>"), Some(137235212097683456));
assert_eq!(parse_mention("<#137234234728251392>"), Some(137234234728251392));