Function serenity::utils::parse_role[][src]

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

Retrieves an Id from a role mention.

If the mention is invalid, then None is returned.

Examples

Retrieving an Id from a valid Role mention:

use serenity::utils::parse_role;

assert_eq!(parse_role("<@&136107769680887808>"), Some(136107769680887808));

Asserting that an invalid role mention returns None:

use serenity::utils::parse_role;

assert!(parse_role("<@&136107769680887808").is_none());