aboutsummaryrefslogtreecommitdiff
path: root/src/model/channel/mod.rs
diff options
context:
space:
mode:
authorZeyla Hellyer <[email protected]>2017-04-13 20:45:56 -0700
committerZeyla Hellyer <[email protected]>2017-04-19 14:53:32 -0700
commit3f03f9adc97315bb61a5c71f52365306cb8e2d1a (patch)
tree8fe0b518d1450b0657cfb75f56251fd90120807e /src/model/channel/mod.rs
parentUpdate the way errors are handled in dispatch (diff)
downloadserenity-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/mod.rs')
-rw-r--r--src/model/channel/mod.rs53
1 files changed, 43 insertions, 10 deletions
diff --git a/src/model/channel/mod.rs b/src/model/channel/mod.rs
index 4877785..2ad06cf 100644
--- a/src/model/channel/mod.rs
+++ b/src/model/channel/mod.rs
@@ -170,8 +170,8 @@ impl Channel {
///
/// [Read Message History]: permissions/constant.READ_MESSAGE_HISTORY.html
#[inline]
- pub fn get_message<M: Into<MessageId>>(&self, message_id: M) -> Result<Message> {
- self.id().get_message(message_id)
+ pub fn message<M: Into<MessageId>>(&self, message_id: M) -> Result<Message> {
+ self.id().message(message_id)
}
/// Gets messages from the channel.
@@ -191,9 +191,9 @@ impl Channel {
///
/// [Read Message History]: permissions/constant.READ_MESSAGE_HISTORY.html
#[inline]
- pub fn get_messages<F>(&self, f: F) -> Result<Vec<Message>>
+ pub fn messages<F>(&self, f: F) -> Result<Vec<Message>>
where F: FnOnce(GetMessages) -> GetMessages {
- self.id().get_messages(f)
+ self.id().messages(f)
}
/// Gets the list of [`User`]s who have reacted to a [`Message`] with a
@@ -213,13 +213,13 @@ impl Channel {
/// [`User`]: struct.User.html
/// [Read Message History]: permissions/constant.READ_MESSAGE_HISTORY.html
#[inline]
- pub fn get_reaction_users<M, R, U>(&self,
- message_id: M,
- reaction_type: R,
- limit: Option<u8>,
- after: Option<U>)
+ pub fn reaction_users<M, R, U>(&self,
+ message_id: M,
+ reaction_type: R,
+ limit: Option<u8>,
+ after: Option<U>)
-> Result<Vec<User>> where M: Into<MessageId>, R: Into<ReactionType>, U: Into<UserId> {
- self.id().get_reaction_users(message_id, reaction_type, limit, after)
+ self.id().reaction_users(message_id, reaction_type, limit, after)
}
/// Retrieves the Id of the inner [`Group`], [`GuildChannel`], or
@@ -310,6 +310,39 @@ impl Channel {
pub fn unpin<M: Into<MessageId>>(&self, message_id: M) -> Result<()> {
self.id().unpin(message_id)
}
+
+ /// Alias of [`message`].
+ ///
+ /// [`message`]: #method.message
+ #[deprecated(since="0.1.5", note="Use `message` instead.")]
+ #[inline]
+ pub fn get_message<M: Into<MessageId>>(&self, message_id: M) -> Result<Message> {
+ self.message(message_id)
+ }
+
+ /// Alias of [`messages`].
+ ///
+ /// [`messages`]: #method.messages
+ #[deprecated(since="0.1.5", note="Use `messages` instead.")]
+ #[inline]
+ pub fn get_messages<F>(&self, f: F) -> Result<Vec<Message>>
+ where F: FnOnce(GetMessages) -> GetMessages {
+ self.messages(f)
+ }
+
+ /// 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<M, R, U>(&self,
+ message_id: M,
+ reaction_type: R,
+ limit: Option<u8>,
+ after: Option<U>)
+ -> Result<Vec<User>> where M: Into<MessageId>, R: Into<ReactionType>, U: Into<UserId> {
+ self.reaction_users(message_id, reaction_type, limit, after)
+ }
}
impl Deserialize for Channel {