diff options
| author | Zeyla Hellyer <[email protected]> | 2017-04-13 20:45:56 -0700 |
|---|---|---|
| committer | Zeyla Hellyer <[email protected]> | 2017-04-19 14:53:32 -0700 |
| commit | 3f03f9adc97315bb61a5c71f52365306cb8e2d1a (patch) | |
| tree | 8fe0b518d1450b0657cfb75f56251fd90120807e /src/model/channel/message.rs | |
| parent | Update the way errors are handled in dispatch (diff) | |
| download | serenity-3f03f9adc97315bb61a5c71f52365306cb8e2d1a.tar.xz serenity-3f03f9adc97315bb61a5c71f52365306cb8e2d1a.zip | |
Deprecate methods prefixed with `get_`
A lot of structs - such as `Guild` or `ChannelId` - have methods with
prefixes of `get_`, which are generally discouraged. To fix this,
deprecate them and remove them in v0.3.0.
Diffstat (limited to 'src/model/channel/message.rs')
| -rw-r--r-- | src/model/channel/message.rs | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/model/channel/message.rs b/src/model/channel/message.rs index f572aea..6bbb1a2 100644 --- a/src/model/channel/message.rs +++ b/src/model/channel/message.rs @@ -236,9 +236,9 @@ impl Message { /// [`User`]: struct.User.html /// [Read Message History]: permissions/constant.READ_MESSAGE_HISTORY.html #[inline] - pub fn get_reaction_users<R, U>(&self, reaction_type: R, limit: Option<u8>, after: Option<U>) + pub fn reaction_users<R, U>(&self, reaction_type: R, limit: Option<u8>, after: Option<U>) -> Result<Vec<User>> where R: Into<ReactionType>, U: Into<UserId> { - self.channel_id.get_reaction_users(self.id, reaction_type, limit, after) + self.channel_id.reaction_users(self.id, reaction_type, limit, after) } /// Returns the associated `Guild` for the message if one is in the cache. @@ -251,7 +251,7 @@ impl Message { /// [`guild_id`]: #method.guild_id #[cfg(feature="cache")] pub fn guild(&self) -> Option<Arc<RwLock<Guild>>> { - self.guild_id().and_then(|guild_id| CACHE.read().unwrap().get_guild(guild_id)) + self.guild_id().and_then(|guild_id| CACHE.read().unwrap().guild(guild_id)) } /// Retrieves the Id of the guild that the message was sent in, if sent in @@ -261,7 +261,7 @@ impl Message { /// cache. #[cfg(feature="cache")] pub fn guild_id(&self) -> Option<GuildId> { - match CACHE.read().unwrap().get_channel(self.channel_id) { + match CACHE.read().unwrap().channel(self.channel_id) { Some(Channel::Guild(ch)) => Some(ch.read().unwrap().guild_id), _ => None, } @@ -270,7 +270,7 @@ impl Message { /// True if message was sent using direct messages. #[cfg(feature="cache")] pub fn is_private(&self) -> bool { - match CACHE.read().unwrap().get_channel(self.channel_id) { + match CACHE.read().unwrap().channel(self.channel_id) { Some(Channel::Group(_)) | Some(Channel::Private(_)) => true, _ => false, } @@ -421,6 +421,16 @@ impl Message { rest::unpin_message(self.channel_id.0, self.id.0) } + + /// Alias of [`reaction_users`]. + /// + /// [`reaction_users`]: #method.reaction_users + #[deprecated(since="0.1.5", note="Use `reaction_users` instead.")] + #[inline] + pub fn get_reaction_users<R, U>(&self, reaction_type: R, limit: Option<u8>, after: Option<U>) + -> Result<Vec<User>> where R: Into<ReactionType>, U: Into<UserId> { + self.reaction_users(reaction_type, limit, after) + } } impl From<Message> for MessageId { |