aboutsummaryrefslogtreecommitdiff
path: root/src/model/channel
diff options
context:
space:
mode:
authoracdenisSK <[email protected]>2017-07-11 22:13:57 +0200
committeracdenisSK <[email protected]>2017-07-11 22:13:57 +0200
commitebc4e51fe3b1e5bc61dc99da25a22d2e2277ffc6 (patch)
tree1eeee881705d8721cdb4238461e5422043a63ca1 /src/model/channel
parentAdd a way to add multiple fields at once (diff)
downloadserenity-ebc4e51fe3b1e5bc61dc99da25a22d2e2277ffc6.tar.xz
serenity-ebc4e51fe3b1e5bc61dc99da25a22d2e2277ffc6.zip
Remove the deprecated functions
It's already been enough time for people to migrate
Diffstat (limited to 'src/model/channel')
-rw-r--r--src/model/channel/channel_id.rs115
-rw-r--r--src/model/channel/group.rs64
-rw-r--r--src/model/channel/guild_channel.rs31
-rw-r--r--src/model/channel/message.rs10
-rw-r--r--src/model/channel/mod.rs95
-rw-r--r--src/model/channel/private_channel.rs64
6 files changed, 0 insertions, 379 deletions
diff --git a/src/model/channel/channel_id.rs b/src/model/channel/channel_id.rs
index 4cfd06c..e5f410b 100644
--- a/src/model/channel/channel_id.rs
+++ b/src/model/channel/channel_id.rs
@@ -366,70 +366,6 @@ impl ChannelId {
///
/// # Examples
///
- /// Send a file with the filename `my_file.jpg`:
- ///
- /// ```rust,no_run
- /// use serenity::model::ChannelId;
- /// use std::fs::File;
- ///
- /// let channel_id = ChannelId(7);
- /// let filename = "my_file.jpg";
- /// let file = File::open(filename).unwrap();
- ///
- /// let _ = channel_id.send_file(file, filename, |m| m.content("a file"));
- /// ```
- ///
- /// # Errors
- ///
- /// If the content of the message is over the above limit, then a
- /// [`ModelError::MessageTooLong`] will be returned, containing the number
- /// of unicode code points over the limit.
- ///
- /// Returns an
- /// [`HttpError::InvalidRequest(PayloadTooLarge)`][`HttpError::InvalidRequest`]
- /// if the file is too large to send.
- ///
- ///
- /// [`HttpError::InvalidRequest`]: ../http/enum.HttpError.html#variant.InvalidRequest
- /// [`ModelError::MessageTooLong`]: enum.ModelError.html#variant.MessageTooLong
- /// [`CreateMessage::content`]: ../builder/struct.CreateMessage.html#method.content
- /// [`GuildChannel`]: struct.GuildChannel.html
- /// [Attach Files]: permissions/constant.ATTACH_FILES.html
- /// [Send Messages]: permissions/constant.SEND_MESSAGES.html
- #[deprecated(since="0.2.0", note="Please use `send_files` instead.")]
- #[allow(deprecated)]
- pub fn send_file<F, R>(&self, file: R, filename: &str, f: F) -> Result<Message>
- where F: FnOnce(CreateMessage) -> CreateMessage, R: Read {
- let mut map = f(CreateMessage::default()).0;
-
- if let Some(content) = map.get("content") {
- if let Value::String(ref content) = *content {
- if let Some(length_over) = Message::overflow_length(content) {
- return Err(Error::Model(ModelError::MessageTooLong(length_over)));
- }
- }
- }
-
- let _ = map.remove("embed");
-
- http::send_file(self.0, file, filename, map)
- }
-
- /// Sends a file along with optional message contents. The filename _must_
- /// be specified.
- ///
- /// Message contents may be passed by using the [`CreateMessage::content`]
- /// method.
- ///
- /// An embed can _not_ be sent when sending a file. If you set one, it will
- /// be automatically removed.
- ///
- /// The [Attach Files] and [Send Messages] permissions are required.
- ///
- /// **Note**: Message contents must be under 2000 unicode code points.
- ///
- /// # Examples
- ///
/// Send files with the paths `/path/to/file.jpg` and `/path/to/file2.jpg`:
///
/// ```rust,no_run
@@ -548,57 +484,6 @@ impl ChannelId {
pub fn webhooks(&self) -> Result<Vec<Webhook>> {
http::get_channel_webhooks(self.0)
}
-
- /// Alias of [`invites`].
- ///
- /// [`invites`]: #method.invites
- #[deprecated(since="0.1.5", note="Use `invites` instead.")]
- #[inline]
- pub fn get_invites(&self) -> Result<Vec<RichInvite>> {
- self.invites()
- }
-
- /// 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)
- }
-
- /// Alias of [`webhooks`].
- ///
- /// [`webhooks`]: #method.webhooks
- #[deprecated(since="0.1.5", note="Use `webhooks` instead.")]
- #[inline]
- pub fn get_webhooks(&self) -> Result<Vec<Webhook>> {
- self.webhooks()
- }
}
impl From<Channel> for ChannelId {
diff --git a/src/model/channel/group.rs b/src/model/channel/group.rs
index 8bb4e2c..0b4f380 100644
--- a/src/model/channel/group.rs
+++ b/src/model/channel/group.rs
@@ -278,37 +278,6 @@ impl Group {
self.channel_id.say(content)
}
- /// Sends a file along with optional message contents. The filename _must_
- /// be specified.
- ///
- /// Refer to [`ChannelId::send_file`] for examples and more information.
- ///
- /// The [Attach Files] and [Send Messages] permissions are required.
- ///
- /// **Note**: Message contents must be under 2000 unicode code points.
- ///
- /// # Errors
- ///
- /// Returns an
- /// [`HttpError::InvalidRequest(PayloadTooLarge)`][`HttpError::InvalidRequest`]
- /// if the file is too large to send.
- ///
- /// If the content of the message is over the above limit, then a
- /// [`ModelError::MessageTooLong`] will be returned, containing the number
- /// of unicode code points over the limit.
- ///
- /// [`ChannelId::send_file`]: struct.ChannelId.html#method.send_file
- /// [`HttpError::InvalidRequest`]: ../http/enum.HttpError.html#variant.InvalidRequest
- /// [`ModelError::MessageTooLong`]: enum.ModelError.html#variant.MessageTooLong
- /// [Attach Files]: permissions/constant.ATTACH_FILES.html
- /// [Send Messages]: permissions/constant.SEND_MESSAGES.html
- #[deprecated(since="0.2.0", note="Please use `send_files` instead.")]
- #[allow(deprecated)]
- pub fn send_file<F, R>(&self, file: R, filename: &str, f: F) -> Result<Message>
- where F: FnOnce(CreateMessage) -> CreateMessage, R: Read {
- self.channel_id.send_file(file, filename, f)
- }
-
/// Sends (a) file(s) along with optional message contents.
///
/// Refer to [`ChannelId::send_files`] for examples and more information.
@@ -357,37 +326,4 @@ impl Group {
pub fn unpin<M: Into<MessageId>>(&self, message_id: M) -> Result<()> {
self.channel_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)
- }
}
diff --git a/src/model/channel/guild_channel.rs b/src/model/channel/guild_channel.rs
index 15a068e..f15fb91 100644
--- a/src/model/channel/guild_channel.rs
+++ b/src/model/channel/guild_channel.rs
@@ -545,37 +545,6 @@ impl GuildChannel {
self.id.say(content)
}
- /// Sends a file along with optional message contents. The filename _must_
- /// be specified.
- ///
- /// Refer to [`ChannelId::send_file`] for examples and more information.
- ///
- /// The [Attach Files] and [Send Messages] permissions are required.
- ///
- /// **Note**: Message contents must be under 2000 unicode code points.
- ///
- /// # Errors
- ///
- /// Returns an
- /// [`HttpError::InvalidRequest(PayloadTooLarge)`][`HttpError::InvalidRequest`]
- /// if the file is too large to send.
- ///
- /// If the content of the message is over the above limit, then a
- /// [`ModelError::MessageTooLong`] will be returned, containing the number
- /// of unicode code points over the limit.
- ///
- /// [`ChannelId::send_file`]: struct.ChannelId.html#method.send_file
- /// [`HttpError::InvalidRequest`]: ../http/enum.HttpError.html#variant.InvalidRequest
- /// [`ModelError::MessageTooLong`]: enum.ModelError.html#variant.MessageTooLong
- /// [Attach Files]: permissions/constant.ATTACH_FILES.html
- /// [Send Messages]: permissions/constant.SEND_MESSAGES.html
- #[deprecated(since="0.2.0", note="Please use `send_files` instead.")]
- #[allow(deprecated)]
- pub fn send_file<F, R>(&self, file: R, filename: &str, f: F) -> Result<Message>
- where F: FnOnce(CreateMessage) -> CreateMessage, R: Read {
- self.id.send_file(file, filename, f)
- }
-
/// Sends (a) file(s) along with optional message contents.
///
/// Refer to [`ChannelId::send_files`] for examples and more information.
diff --git a/src/model/channel/message.rs b/src/model/channel/message.rs
index 6314cae..e1eccf0 100644
--- a/src/model/channel/message.rs
+++ b/src/model/channel/message.rs
@@ -490,16 +490,6 @@ impl Message {
http::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)
- }
-
pub(crate) fn check_content_length(map: &JsonMap) -> Result<()> {
if let Some(content) = map.get("content") {
if let Value::String(ref content) = *content {
diff --git a/src/model/channel/mod.rs b/src/model/channel/mod.rs
index 730410e..5c29a52 100644
--- a/src/model/channel/mod.rs
+++ b/src/model/channel/mod.rs
@@ -105,37 +105,6 @@ impl Channel {
self.id().delete_message(message_id)
}
- /// Deletes all messages by Ids from the given vector in the channel.
- ///
- /// The minimum amount of messages is 2 and the maximum amount is 100.
- ///
- /// Requires the [Manage Messages] permission.
- ///
- /// **Note**: This uses bulk delete endpoint which is not available
- /// for user accounts.
- ///
- /// **Note**: Messages that are older than 2 weeks can't be deleted using
- /// this method.
- ///
- /// [Manage Messages]: permissions/constant.MANAGE_MESSAGES.html
- #[deprecated(since="0.2.0", note="Use the inner channel's `delete_messages` method instead.")]
- #[inline]
- pub fn delete_messages(&self, message_ids: &[MessageId]) -> Result<()> {
- self.id().delete_messages(message_ids)
- }
-
- /// Deletes all permission overrides in the channel from a member
- /// or role.
- ///
- /// **Note**: Requires the [Manage Channel] permission.
- ///
- /// [Manage Channel]: permissions/constant.MANAGE_CHANNELS.html
- #[deprecated(since="0.2.0", note="Use the inner channel's `delete_permission` method instead.")]
- #[inline]
- pub fn delete_permission(&self, permission_type: PermissionOverwriteType) -> Result<()> {
- self.id().delete_permission(permission_type)
- }
-
/// Deletes the given [`Reaction`] from the channel.
///
/// **Note**: Requires the [Manage Messages] permission, _if_ the current
@@ -275,37 +244,6 @@ impl Channel {
self.id().say(content)
}
- /// Sends a file along with optional message contents. The filename _must_
- /// be specified.
- ///
- /// Refer to [`ChannelId::send_file`] for examples and more information.
- ///
- /// The [Attach Files] and [Send Messages] permissions are required.
- ///
- /// **Note**: Message contents must be under 2000 unicode code points.
- ///
- /// # Errors
- ///
- /// Returns an
- /// [`HttpError::InvalidRequest(PayloadTooLarge)`][`HttpError::InvalidRequest`]
- /// if the file is too large to send.
- ///
- /// If the content of the message is over the above limit, then a
- /// [`ModelError::MessageTooLong`] will be returned, containing the number
- /// of unicode code points over the limit.
- ///
- /// [`ChannelId::send_file`]: struct.ChannelId.html#method.send_file
- /// [`HttpError::InvalidRequest`]: ../http/enum.HttpError.html#variant.InvalidRequest
- /// [`ModelError::MessageTooLong`]: enum.ModelError.html#variant.MessageTooLong
- /// [Attach Files]: permissions/constant.ATTACH_FILES.html
- /// [Send Messages]: permissions/constant.SEND_MESSAGES.html
- #[deprecated(since="0.2.0", note="Please use `send_files` instead.")]
- #[allow(deprecated)]
- pub fn send_file<F, R>(&self, file: R, filename: &str, f: F) -> Result<Message>
- where F: FnOnce(CreateMessage) -> CreateMessage, R: Read {
- self.id().send_file(file, filename, f)
- }
-
/// Sends (a) file(s) along with optional message contents.
///
/// Refer to [`ChannelId::send_files`] for examples and more information.
@@ -365,39 +303,6 @@ 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<'de> Deserialize<'de> for Channel {
diff --git a/src/model/channel/private_channel.rs b/src/model/channel/private_channel.rs
index c201c1c..b105d7e 100644
--- a/src/model/channel/private_channel.rs
+++ b/src/model/channel/private_channel.rs
@@ -224,37 +224,6 @@ impl PrivateChannel {
self.id.say(content)
}
- /// Sends a file along with optional message contents. The filename _must_
- /// be specified.
- ///
- /// Refer to [`ChannelId::send_file`] for examples and more information.
- ///
- /// The [Attach Files] and [Send Messages] permissions are required.
- ///
- /// **Note**: Message contents must be under 2000 unicode code points.
- ///
- /// # Errors
- ///
- /// Returns an
- /// [`HttpError::InvalidRequest(PayloadTooLarge)`][`HttpError::InvalidRequest`]
- /// if the file is too large to send.
- ///
- /// If the content of the message is over the above limit, then a
- /// [`ModelError::MessageTooLong`] will be returned, containing the number
- /// of unicode code points over the limit.
- ///
- /// [`ChannelId::send_file`]: struct.ChannelId.html#method.send_file
- /// [`HttpError::InvalidRequest`]: ../http/enum.HttpError.html#variant.InvalidRequest
- /// [`ModelError::MessageTooLong`]: enum.ModelError.html#variant.MessageTooLong
- /// [Attach Files]: permissions/constant.ATTACH_FILES.html
- /// [Send Messages]: permissions/constant.SEND_MESSAGES.html
- #[deprecated(since="0.2.0", note="Please use `send_files` instead.")]
- #[allow(deprecated)]
- pub fn send_file<F, R>(&self, file: R, filename: &str, f: F) -> Result<Message>
- where F: FnOnce(CreateMessage) -> CreateMessage, R: Read {
- self.id.send_file(file, filename, f)
- }
-
/// Sends (a) file(s) along with optional message contents.
///
/// Refer to [`ChannelId::send_files`] for examples and more information.
@@ -308,39 +277,6 @@ impl PrivateChannel {
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 Display for PrivateChannel {