[−][src]Function serenity::utils::is_nsfw
pub fn is_nsfw(name: &str) -> bool
Deprecated since 0.5.10:
Discord no longer turns a channel NSFW based on its name.
Determines if a name is NSFW.
This checks that the name is either "nsfw"
or, for names longer than that,
is prefixed with "nsfw"
.
Examples
Check that a channel named "nsfw"
is in fact NSFW:
use serenity::utils; assert!(utils::is_nsfw("nsfw"));
Check that a channel named "cats"
is not NSFW:
use serenity::utils; assert!(!utils::is_nsfw("cats"));
Check that a channel named "nsfw-stuff"
is NSFW:
use serenity::utils; assert!(utils::is_nsfw("nsfw-stuff"));
Channels prefixed with "nsfw"
but not the hyphen ('-'
) are not
considered NSFW:
use serenity::utils; assert!(!utils::is_nsfw("nsfwstuff"));