diff options
| author | Lakelezz <[email protected]> | 2018-10-20 23:42:29 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2018-10-20 23:42:29 +0200 |
| commit | 75fb5c041511077e60e577e55039acc33d624569 (patch) | |
| tree | 46635aab225f9ee51ff78921eaa1cbda84bee61e /src/model | |
| parent | Prefix only Command (#416) (diff) | |
| download | serenity-75fb5c041511077e60e577e55039acc33d624569.tar.xz serenity-75fb5c041511077e60e577e55039acc33d624569.zip | |
Fix NSFW Checks (#418)
Diffstat (limited to 'src/model')
| -rw-r--r-- | src/model/channel/channel_category.rs | 3 | ||||
| -rw-r--r-- | src/model/channel/group.rs | 4 | ||||
| -rw-r--r-- | src/model/channel/guild_channel.rs | 6 | ||||
| -rw-r--r-- | src/model/channel/mod.rs | 10 | ||||
| -rw-r--r-- | src/model/channel/private_channel.rs | 4 |
5 files changed, 5 insertions, 22 deletions
diff --git a/src/model/channel/channel_category.rs b/src/model/channel/channel_category.rs index 47b2281..f57910e 100644 --- a/src/model/channel/channel_category.rs +++ b/src/model/channel/channel_category.rs @@ -125,10 +125,9 @@ impl ChannelCategory { }) } - #[cfg(feature = "utils")] #[inline] pub fn is_nsfw(&self) -> bool { - self.kind == ChannelType::Text && (self.nsfw || serenity_utils::is_nsfw(&self.name)) + self.kind == ChannelType::Text && self.nsfw } /// Returns the name of the category. diff --git a/src/model/channel/group.rs b/src/model/channel/group.rs index ad16fa0..e6946df 100644 --- a/src/model/channel/group.rs +++ b/src/model/channel/group.rs @@ -174,12 +174,8 @@ impl Group { /// Determines if the channel is NSFW. /// - /// Refer to [`utils::is_nsfw`] for more details. - /// /// **Note**: This method is for consistency. This will always return /// `false`, due to groups not being considered NSFW. - /// - /// [`utils::is_nsfw`]: ../../utils/fn.is_nsfw.html #[inline] pub fn is_nsfw(&self) -> bool { false } diff --git a/src/model/channel/guild_channel.rs b/src/model/channel/guild_channel.rs index 3713004..c403b4b 100644 --- a/src/model/channel/guild_channel.rs +++ b/src/model/channel/guild_channel.rs @@ -386,18 +386,14 @@ impl GuildChannel { /// Determines if the channel is NSFW. /// - /// Refer to [`utils::is_nsfw`] for more details. - /// /// Only [text channels][`ChannelType::Text`] are taken into consideration /// as being NSFW. [voice channels][`ChannelType::Voice`] are never NSFW. /// /// [`ChannelType::Text`]: enum.ChannelType.html#variant.Text /// [`ChannelType::Voice`]: enum.ChannelType.html#variant.Voice - /// [`utils::is_nsfw`]: ../../utils/fn.is_nsfw.html - #[cfg(feature = "utils")] #[inline] pub fn is_nsfw(&self) -> bool { - self.kind == ChannelType::Text && (self.nsfw || serenity_utils::is_nsfw(&self.name)) + self.kind == ChannelType::Text && self.nsfw } /// Gets a message from the channel. diff --git a/src/model/channel/mod.rs b/src/model/channel/mod.rs index 73e2ff3..bc4ea75 100644 --- a/src/model/channel/mod.rs +++ b/src/model/channel/mod.rs @@ -334,11 +334,7 @@ impl Channel { } /// Determines if the channel is NSFW. - /// - /// Refer to [`utils::is_nsfw`] for more details. - /// - /// [`utils::is_nsfw`]: ../../utils/fn.is_nsfw.html - #[cfg(all(feature = "model", feature = "utils"))] + #[cfg(feature = "model")] #[inline] pub fn is_nsfw(&self) -> bool { match *self { @@ -769,7 +765,7 @@ mod test { #[test] fn nsfw_checks() { let mut channel = guild_channel(); - assert!(channel.is_nsfw()); + assert!(!channel.is_nsfw()); channel.kind = ChannelType::Voice; assert!(!channel.is_nsfw()); @@ -778,7 +774,7 @@ mod test { assert!(!channel.is_nsfw()); channel.name = "nsfw".to_string(); - assert!(channel.is_nsfw()); + assert!(!channel.is_nsfw()); channel.kind = ChannelType::Voice; assert!(!channel.is_nsfw()); channel.kind = ChannelType::Text; diff --git a/src/model/channel/private_channel.rs b/src/model/channel/private_channel.rs index 2657d3b..4d602c9 100644 --- a/src/model/channel/private_channel.rs +++ b/src/model/channel/private_channel.rs @@ -150,12 +150,8 @@ impl PrivateChannel { /// Determines if the channel is NSFW. /// - /// Refer to [`utils::is_nsfw`] for more details. - /// /// **Note**: This method is for consistency. This will always return /// `false`, due to DMs not being considered NSFW. - /// - /// [`utils::is_nsfw`]: ../../utils/fn.is_nsfw.html #[inline] pub fn is_nsfw(&self) -> bool { false } |