Skip to content

Commit

Permalink
Deprecate some text-only Channel methods
Browse files Browse the repository at this point in the history
Some methods on `model::Channel` are only for text channels. Methods on
Channel should be applicable to all channel types.

Deprecates the following methods on `model::Channel`:

- `create_reaction`
- `delete_message`
- `delete_reaction`
- `edit_message`
- `message`
- `messages`
- `reaction_users`
- `say`
- `send_files`
- `send_message`
- `unpin`
  • Loading branch information
Zeyla Hellyer committed Oct 19, 2017
1 parent 74ec713 commit 23ff6f2
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/model/channel/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ impl Channel {
/// [`Message::react`]: struct.Message.html#method.react
/// [Add Reactions]: permissions/constant.ADD_REACTIONS.html
#[cfg(feature = "model")]
#[deprecated(since = "0.4.2", note = "Use the inner channel's method")]
#[inline]
pub fn create_reaction<M, R>(&self, message_id: M, reaction_type: R) -> Result<()>
where M: Into<MessageId>, R: Into<ReactionType> {
Expand Down Expand Up @@ -110,6 +111,7 @@ impl Channel {
/// [`Message::delete`]: struct.Message.html#method.delete
/// [Manage Messages]: permissions/constant.MANAGE_MESSAGES.html
#[cfg(feature = "model")]
#[deprecated(since = "0.4.2", note = "Use the inner channel's method")]
#[inline]
pub fn delete_message<M: Into<MessageId>>(&self, message_id: M) -> Result<()> {
self.id().delete_message(message_id)
Expand All @@ -123,6 +125,7 @@ impl Channel {
/// [`Reaction`]: struct.Reaction.html
/// [Manage Messages]: permissions/constant.MANAGE_MESSAGES.html
#[cfg(feature = "model")]
#[deprecated(since = "0.4.2", note = "Use the inner channel's method")]
#[inline]
pub fn delete_reaction<M, R>(&self,
message_id: M,
Expand Down Expand Up @@ -154,6 +157,7 @@ impl Channel {
/// [`Message`]: struct.Message.html
/// [`the limit`]: ../builder/struct.CreateMessage.html#method.content
#[cfg(feature = "model")]
#[deprecated(since = "0.4.2", note = "Use the inner channel's method")]
#[inline]
pub fn edit_message<F, M>(&self, message_id: M, f: F) -> Result<Message>
where F: FnOnce(CreateMessage) -> CreateMessage, M: Into<MessageId> {
Expand Down Expand Up @@ -181,6 +185,7 @@ impl Channel {
///
/// [Read Message History]: permissions/constant.READ_MESSAGE_HISTORY.html
#[cfg(feature = "model")]
#[deprecated(since = "0.4.2", note = "Use the inner channel's method")]
#[inline]
pub fn message<M: Into<MessageId>>(&self, message_id: M) -> Result<Message> {
self.id().message(message_id)
Expand All @@ -203,6 +208,7 @@ impl Channel {
///
/// [Read Message History]: permissions/constant.READ_MESSAGE_HISTORY.html
#[cfg(feature = "model")]
#[deprecated(since = "0.4.2", note = "Use the inner channel's method")]
#[inline]
pub fn messages<F>(&self, f: F) -> Result<Vec<Message>>
where F: FnOnce(GetMessages) -> GetMessages {
Expand All @@ -226,6 +232,7 @@ impl Channel {
/// [`User`]: struct.User.html
/// [Read Message History]: permissions/constant.READ_MESSAGE_HISTORY.html
#[cfg(feature = "model")]
#[deprecated(since = "0.4.2", note = "Use the inner channel's method")]
#[inline]
pub fn reaction_users<M, R, U>(&self,
message_id: M,
Expand Down Expand Up @@ -264,6 +271,7 @@ impl Channel {
/// [`ChannelId`]: struct.ChannelId.html
/// [`ModelError::MessageTooLong`]: enum.ModelError.html#variant.MessageTooLong
#[cfg(feature = "model")]
#[deprecated(since = "0.4.2", note = "Use the inner channel's method")]
#[inline]
pub fn say(&self, content: &str) -> Result<Message> { self.id().say(content) }

Expand All @@ -286,6 +294,7 @@ impl Channel {
/// [Attach Files]: permissions/constant.ATTACH_FILES.html
/// [Send Messages]: permissions/constant.SEND_MESSAGES.html
#[cfg(feature = "model")]
#[deprecated(since = "0.4.2", note = "Use the inner channel's method")]
#[inline]
pub fn send_files<'a, F, T, It: IntoIterator<Item=T>>(&self, files: It, f: F) -> Result<Message>
where F: FnOnce(CreateMessage) -> CreateMessage, T: Into<AttachmentType<'a>> {
Expand All @@ -312,6 +321,7 @@ impl Channel {
/// [`CreateMessage`]: ../builder/struct.CreateMessage.html
/// [Send Messages]: permissions/constant.SEND_MESSAGES.html
#[cfg(feature = "model")]
#[deprecated(since = "0.4.2", note = "Use the inner channel's method")]
#[inline]
pub fn send_message<F>(&self, f: F) -> Result<Message>
where F: FnOnce(CreateMessage) -> CreateMessage {
Expand All @@ -325,6 +335,7 @@ impl Channel {
/// [`Message`]: struct.Message.html
/// [Manage Messages]: permissions/constant.MANAGE_MESSAGES.html
#[cfg(feature = "model")]
#[deprecated(since = "0.4.2", note = "Use the inner channel's method")]
#[inline]
pub fn unpin<M: Into<MessageId>>(&self, message_id: M) -> Result<()> {
self.id().unpin(message_id)
Expand Down

0 comments on commit 23ff6f2

Please sign in to comment.