diff options
| author | acdenisSK <[email protected]> | 2017-07-11 22:13:57 +0200 |
|---|---|---|
| committer | acdenisSK <[email protected]> | 2017-07-11 22:13:57 +0200 |
| commit | ebc4e51fe3b1e5bc61dc99da25a22d2e2277ffc6 (patch) | |
| tree | 1eeee881705d8721cdb4238461e5422043a63ca1 /src | |
| parent | Add a way to add multiple fields at once (diff) | |
| download | serenity-ebc4e51fe3b1e5bc61dc99da25a22d2e2277ffc6.tar.xz serenity-ebc4e51fe3b1e5bc61dc99da25a22d2e2277ffc6.zip | |
Remove the deprecated functions
It's already been enough time for people to migrate
Diffstat (limited to 'src')
| -rw-r--r-- | src/cache/mod.rs | 67 | ||||
| -rw-r--r-- | src/client/mod.rs | 18 | ||||
| -rw-r--r-- | src/http/mod.rs | 18 | ||||
| -rw-r--r-- | src/model/channel/channel_id.rs | 115 | ||||
| -rw-r--r-- | src/model/channel/group.rs | 64 | ||||
| -rw-r--r-- | src/model/channel/guild_channel.rs | 31 | ||||
| -rw-r--r-- | src/model/channel/message.rs | 10 | ||||
| -rw-r--r-- | src/model/channel/mod.rs | 95 | ||||
| -rw-r--r-- | src/model/channel/private_channel.rs | 64 | ||||
| -rw-r--r-- | src/model/guild/guild_id.rs | 91 | ||||
| -rw-r--r-- | src/model/guild/member.rs | 8 | ||||
| -rw-r--r-- | src/model/guild/mod.rs | 100 | ||||
| -rw-r--r-- | src/model/guild/partial_guild.rs | 91 | ||||
| -rw-r--r-- | src/model/guild/role.rs | 9 | ||||
| -rw-r--r-- | src/model/permissions.rs | 27 | ||||
| -rw-r--r-- | src/model/user.rs | 35 | ||||
| -rw-r--r-- | src/utils/colour.rs | 36 |
17 files changed, 0 insertions, 879 deletions
diff --git a/src/cache/mod.rs b/src/cache/mod.rs index 22be025..a583e8c 100644 --- a/src/cache/mod.rs +++ b/src/cache/mod.rs @@ -590,73 +590,6 @@ impl Cache { self.users.get(&user_id.into()).cloned() } - /// Alias of [`channel`]. - /// - /// [`channel`]: #method.channel - #[deprecated(since="0.1.5", note="Use `channel` instead.")] - #[inline] - pub fn get_channel<C: Into<ChannelId>>(&self, id: C) -> Option<Channel> { - self.channel(id) - } - - /// Alias of [`guild`]. - /// - /// [`guild`]: #method.guild - #[deprecated(since="0.1.5", note="Use `guild` instead.")] - #[inline] - pub fn get_guild<G: Into<GuildId>>(&self, id: G) -> Option<Arc<RwLock<Guild>>> { - self.guild(id) - } - - /// Alias of [`guild_channel`]. - /// - /// [`guild_channel`]: #method.guild_channel - #[deprecated(since="0.1.5", note="Use `guild_channel` instead.")] - #[inline] - pub fn get_guild_channel<C: Into<ChannelId>>(&self, id: C) - -> Option<Arc<RwLock<GuildChannel>>> { - self.guild_channel(id) - } - - /// Alias of [`member`]. - /// - /// [`member`]: #method.member - #[deprecated(since="0.1.5", note="Use `member` instead.")] - #[inline] - pub fn get_member<G, U>(&self, guild_id: G, user_id: U) -> Option<Member> - where G: Into<GuildId>, U: Into<UserId> { - self.member(guild_id, user_id) - } - - /// Alias of [`private_channel`]. - /// - /// [`private_channel`]: #method.private_channel - #[deprecated(since="0.1.5", note="Use `private_channel` instead.")] - #[inline] - pub fn get_private_channel<C: Into<ChannelId>>(&self, id: C) - -> Option<Arc<RwLock<PrivateChannel>>> { - self.private_channel(id) - } - - /// Alias of [`role`]. - /// - /// [`role`]: #method.role - #[deprecated(since="0.1.5", note="Use `role` instead.")] - #[inline] - pub fn get_role<G, R>(&self, guild_id: G, role_id: R) -> Option<Role> - where G: Into<GuildId>, R: Into<RoleId> { - self.role(guild_id, role_id) - } - - /// Alias of [`user`]. - /// - /// [`user`]: #method.user - #[deprecated(since="0.1.5", note="Use `user` instead.")] - #[inline] - pub fn get_user<U: Into<UserId>>(&self, id: U) -> Option<Arc<RwLock<User>>> { - self.user(id) - } - pub(crate) fn update_with_channel_create(&mut self, event: &ChannelCreateEvent) -> Option<Channel> { match event.channel { Channel::Group(ref group) => { diff --git a/src/client/mod.rs b/src/client/mod.rs index 5a8bc51..4ffbf3f 100644 --- a/src/client/mod.rs +++ b/src/client/mod.rs @@ -221,24 +221,6 @@ impl<H: EventHandler + Send + Sync + 'static> Client<H> { init_client(token, handler) } - /// Alias of [`new`]. - /// - /// [`new`]: #method.new - #[deprecated(since="0.1.5", note="Use `new` instead")] - #[inline(always)] - pub fn login_bot(token: &str, handler: H) -> Self { - Self::new(token, handler) - } - - /// Alias for [`new`]. - /// - /// [`new`]: #method.new - #[deprecated(since="0.2.1", note="Use `new` instead")] - #[inline(always)] - pub fn login(token: &str, handler: H) -> Self { - Self::new(token, handler) - } - /// Sets a framework to be used with the client. All message events will be /// passed through the framework _after_ being passed to the [`on_message`] /// event handler. diff --git a/src/http/mod.rs b/src/http/mod.rs index 382f264..781e64a 100644 --- a/src/http/mod.rs +++ b/src/http/mod.rs @@ -1397,24 +1397,6 @@ pub fn remove_group_recipient(group_id: u64, user_id: u64) -> Result<()> { user_id)) } -/// Sends a file to a channel. -/// -/// # Errors -/// -/// Returns an -/// [`HttpError::InvalidRequest(PayloadTooLarge)`][`HttpError::InvalidRequest`] -/// if the file is too large to send. -/// -/// [`HttpError::InvalidRequest`]: enum.HttpError.html#variant.InvalidRequest -#[deprecated(since="0.2.0", note="Please use `send_files` instead.")] -pub fn send_file<R: Read>(channel_id: u64, mut file: R, filename: &str, map: JsonMap) - -> Result<Message> { - let mut bytes = vec![]; - file.read_to_end(&mut bytes)?; - - send_files(channel_id, vec![AttachmentType::Bytes((&bytes, filename))], map) -} - /// Sends file(s) to a channel. /// /// # Errors 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 { diff --git a/src/model/guild/guild_id.rs b/src/model/guild/guild_id.rs index c707413..5d318a5 100644 --- a/src/model/guild/guild_id.rs +++ b/src/model/guild/guild_id.rs @@ -513,97 +513,6 @@ impl GuildId { pub fn webhooks(&self) -> Result<Vec<Webhook>> { http::get_guild_webhooks(self.0) } - - /// Alias of [`bans`]. - /// - /// [`bans`]: #method.bans - #[deprecated(since="0.1.5", note="Use `bans` instead.")] - #[inline] - pub fn get_bans(&self) -> Result<Vec<Ban>> { - self.bans() - } - - /// Alias of [`channels`]. - /// - /// [`channels`]: #method.channels - #[deprecated(since="0.1.5", note="Use `channels` instead.")] - #[inline] - pub fn get_channels(&self) -> Result<HashMap<ChannelId, GuildChannel>> { - self.channels() - } - - /// Alias of [`emoji`]. - /// - /// [`emoji`]: #method.emoji - #[deprecated(since="0.1.5", note="Use `emoji` instead.")] - #[inline] - pub fn get_emoji<E: Into<EmojiId>>(&self, emoji_id: E) -> Result<Emoji> { - self.emoji(emoji_id) - } - - /// Alias of [`emojis`]. - /// - /// [`emojis`]: #method.emojis - #[deprecated(since="0.1.5", note="Use `emojis` instead.")] - #[inline] - pub fn get_emojis(&self) -> Result<Vec<Emoji>> { - self.emojis() - } - - /// Alias of [`integrations`]. - /// - /// [`integrations`]: #method.integrations - #[deprecated(since="0.1.5", note="Use `integrations` instead.")] - #[inline] - pub fn get_integrations(&self) -> Result<Vec<Integration>> { - self.integrations() - } - - /// 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 [`member`]. - /// - /// [`member`]: #method.member - #[deprecated(since="0.1.5", note="Use `member` instead.")] - #[inline] - pub fn get_member<U: Into<UserId>>(&self, user_id: U) -> Result<Member> { - self.member(user_id) - } - - /// Alias of [`members`]. - /// - /// [`members`]: #method.members - #[deprecated(since="0.1.5", note="Use `members` instead.")] - #[inline] - pub fn get_members<U>(&self, limit: Option<u64>, after: Option<U>) - -> Result<Vec<Member>> where U: Into<UserId> { - self.members(limit, after) - } - - /// Alias of [`prune_count`]. - /// - /// [`prune_count`]: #method.prune_count - #[deprecated(since="0.1.5", note="Use `prune_count` instead.")] - #[inline] - pub fn get_prune_count(&self, days: u16) -> Result<GuildPrune> { - self.prune_count(days) - } - - /// 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 Display for GuildId { diff --git a/src/model/guild/member.rs b/src/model/guild/member.rs index 053360d..2b382a0 100644 --- a/src/model/guild/member.rs +++ b/src/model/guild/member.rs @@ -206,14 +206,6 @@ impl Member { http::edit_member(self.guild_id.0, self.user.read().unwrap().id.0, &map) } - /// Returns the value of [`guild_id`]. - /// - /// [`guild_id`]: #structfield.guild_id - #[deprecated(since="0.2.1", note="Use the `guild_id` structfield instead.")] - pub fn find_guild(&self) -> Result<GuildId> { - Ok(self.guild_id) - } - /// Kick the member from the guild. /// /// **Note**: Requires the [Kick Members] permission. diff --git a/src/model/guild/mod.rs b/src/model/guild/mod.rs index 97eb3a4..fb91654 100644 --- a/src/model/guild/mod.rs +++ b/src/model/guild/mod.rs @@ -1008,106 +1008,6 @@ impl Guild { pub fn webhooks(&self) -> Result<Vec<Webhook>> { self.id.webhooks() } - - /// Alias of [`bans`]. - /// - /// [`bans`]: #method.bans - #[deprecated(since="0.1.5", note="Use `bans` instead.")] - #[inline] - pub fn get_bans(&self) -> Result<Vec<Ban>> { - self.bans() - } - - /// Alias of [`channels`]. - /// - /// [`channels`]: #method.channels - #[deprecated(since="0.1.5", note="Use `channels` instead.")] - #[inline] - pub fn get_channels(&self) -> Result<HashMap<ChannelId, GuildChannel>> { - self.channels() - } - - /// Alias of [`emoji`]. - /// - /// [`emoji`]: #method.emoji - #[deprecated(since="0.1.5", note="Use `emoji` instead.")] - #[inline] - pub fn get_emoji<E: Into<EmojiId>>(&self, emoji_id: E) -> Result<Emoji> { - self.emoji(emoji_id) - } - - /// Alias of [`emojis`]. - /// - /// [`emojis`]: #method.emojis - #[deprecated(since="0.1.5", note="Use `emojis` instead.")] - #[inline] - pub fn get_emojis(&self) -> Result<Vec<Emoji>> { - self.emojis() - } - - /// Alias of [`integrations`]. - /// - /// [`integrations`]: #method.integrations - #[deprecated(since="0.1.5", note="Use `integrations` instead.")] - #[inline] - pub fn get_integrations(&self) -> Result<Vec<Integration>> { - self.integrations() - } - - /// 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 [`member`]. - /// - /// [`member`]: #method.member - #[deprecated(since="0.1.5", note="Use `member` instead.")] - #[inline] - pub fn get_member<U: Into<UserId>>(&self, user_id: U) -> Result<Member> { - self.member(user_id) - } - - /// Alias of [`members`]. - /// - /// [`members`]: #method.members - #[deprecated(since="0.1.5", note="Use `members` instead.")] - #[inline] - pub fn get_members<U>(&self, limit: Option<u64>, after: Option<U>) - -> Result<Vec<Member>> where U: Into<UserId> { - self.members(limit, after) - } - - /// Alias of [`member_named`]. - /// - /// [`member_named`]: #method.member_named - #[deprecated(since="0.1.5", note="Use `member_named` instead.")] - #[inline] - pub fn get_member_named(&self, name: &str) -> Option<&Member> { - self.member_named(name) - } - - /// Alias of [`prune_count`]. - /// - /// [`prune_count`]: #method.prune_count - #[deprecated(since="0.1.5", note="Use `prune_count` instead.")] - #[inline] - pub fn get_prune_count(&self, days: u16) -> Result<GuildPrune> { - self.prune_count(days) - } - - /// 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<'de> Deserialize<'de> for Guild { diff --git a/src/model/guild/partial_guild.rs b/src/model/guild/partial_guild.rs index 694a64b..26d4257 100644 --- a/src/model/guild/partial_guild.rs +++ b/src/model/guild/partial_guild.rs @@ -477,95 +477,4 @@ impl PartialGuild { pub fn webhooks(&self) -> Result<Vec<Webhook>> { self.id.webhooks() } - - /// Alias of [`bans`]. - /// - /// [`bans`]: #method.bans - #[deprecated(since="0.1.5", note="Use `bans` instead.")] - #[inline] - pub fn get_bans(&self) -> Result<Vec<Ban>> { - self.bans() - } - - /// Alias of [`channels`]. - /// - /// [`channels`]: #method.channels - #[deprecated(since="0.1.5", note="Use `channels` instead.")] - #[inline] - pub fn get_channels(&self) -> Result<HashMap<ChannelId, GuildChannel>> { - self.channels() - } - - /// Alias of [`emoji`]. - /// - /// [`emoji`]: #method.emoji - #[deprecated(since="0.1.5", note="Use `emoji` instead.")] - #[inline] - pub fn get_emoji<E: Into<EmojiId>>(&self, emoji_id: E) -> Result<Emoji> { - self.emoji(emoji_id) - } - - /// Alias of [`emojis`]. - /// - /// [`emojis`]: #method.emojis - #[deprecated(since="0.1.5", note="Use `emojis` instead.")] - #[inline] - pub fn get_emojis(&self) -> Result<Vec<Emoji>> { - self.emojis() - } - - /// Alias of [`integrations`]. - /// - /// [`integrations`]: #method.integrations - #[deprecated(since="0.1.5", note="Use `integrations` instead.")] - #[inline] - pub fn get_integrations(&self) -> Result<Vec<Integration>> { - self.integrations() - } - - /// 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 [`member`]. - /// - /// [`member`]: #method.member - #[deprecated(since="0.1.5", note="Use `member` instead.")] - #[inline] - pub fn get_member<U: Into<UserId>>(&self, user_id: U) -> Result<Member> { - self.member(user_id) - } - - /// Alias of [`members`]. - /// - /// [`members`]: #method.members - #[deprecated(since="0.1.5", note="Use `members` instead.")] - #[inline] - pub fn get_members<U>(&self, limit: Option<u64>, after: Option<U>) - -> Result<Vec<Member>> where U: Into<UserId> { - self.members(limit, after) - } - - /// Alias of [`prune_count`]. - /// - /// [`prune_count`]: #method.prune_count - #[deprecated(since="0.1.5", note="Use `prune_count` instead.")] - #[inline] - pub fn get_prune_count(&self, days: u16) -> Result<GuildPrune> { - self.prune_count(days) - } - - /// 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() - } } diff --git a/src/model/guild/role.rs b/src/model/guild/role.rs index 8383675..bed641b 100644 --- a/src/model/guild/role.rs +++ b/src/model/guild/role.rs @@ -101,15 +101,6 @@ impl Role { } } - /// Alias of [`edit`] - /// - /// [`edit`]: struct.Role.html#method.edit - #[deprecated(since="0.2.1", note="Please use `edit` instead.")] - #[cfg(all(feature="builder", feature="cache"))] - pub fn edit_role<F: FnOnce(EditRole) -> EditRole>(&self, f: F) -> Result<Role> { - self.edit(f) - } - /// Searches the cache for the guild that owns the role. /// /// # Errors diff --git a/src/model/permissions.rs b/src/model/permissions.rs index 40e75ce..3968e16 100644 --- a/src/model/permissions.rs +++ b/src/model/permissions.rs @@ -146,33 +146,6 @@ pub const PRESET_VOICE: Permissions = Permissions { bits: 0b00000011111100000000000000000000, }; -/// Alias of [`PRESET_GENERAL`]. -/// -/// [`PRESET_GENERAL`]: const.PRESET_GENERAL.html -#[deprecated(since="0.1.5", note="Use `permissions::PRESET_GENERAL` instead")] -#[inline(always)] -pub fn general() -> Permissions { - PRESET_GENERAL -} - -/// Alias of [`PRESET_TEXT`]. -/// -/// [`PRESET_TEXT`]: const.PRESET_TEXT.html -#[deprecated(since="0.1.5", note="Use `permissions::PRESET_TEXT` instead")] -#[inline(always)] -pub fn text() -> Permissions { - PRESET_TEXT -} - -/// Alias of [`PRESET_VOICE`]. -/// -/// [`PRESET_VOICE`]: const.PRESET_VOICE.html -#[deprecated(since="0.1.5", note="Use `permissions::PRESET_VOICE` instead")] -#[inline(always)] -pub fn voice() -> Permissions { - PRESET_VOICE -} - bitflags! { /// A set of permissions that can be assigned to [`User`]s and [`Role`]s via /// [`PermissionOverwrite`]s, roles globally in a [`Guild`], and to diff --git a/src/model/user.rs b/src/model/user.rs index 9c248ba..e447519 100644 --- a/src/model/user.rs +++ b/src/model/user.rs @@ -72,15 +72,6 @@ impl CurrentUser { default_avatar_url(self.discriminator) } - /// Alias of [`tag`]. - /// - /// [`tag`]: #method.tag - #[deprecated(since="0.2.0", note="Use `tag` instead.")] - #[inline] - pub fn distinct(&self) -> String { - self.tag() - } - /// Edits the current user's profile settings. /// /// This mutates the current user in-place. @@ -540,15 +531,6 @@ impl User { private_channel_id.send_message(f) } - /// Alias of [`tag`]. - /// - /// [`tag`]: #method.tag - #[deprecated(since="0.2.0", note="Use `tag` instead.")] - #[inline] - pub fn distinct(&self) -> String { - self.tag() - } - /// This is an alias of [direct_message]. /// /// # Examples @@ -586,23 +568,6 @@ impl User { self.avatar_url().unwrap_or_else(|| self.default_avatar_url()) } - /// Gets a user by its Id over the REST API. - /// - /// **Note**: The current user must be a bot user. - /// - /// # Errors - /// - /// If the `cache` is enabled, returns a - /// [`ModelError::InvalidOperationAsUser`] if the current user is not a bot - /// user. - /// - /// [`ModelError::InvalidOperationAsUser`]: enum.ModelError.html#variant.InvalidOperationAsUser - #[deprecated(since="0.2.0", note="Don't use this, since it doesn't fit serenity's design.")] - #[inline] - pub fn get<U: Into<UserId>>(user_id: U) -> Result<User> { - user_id.into().get() - } - /// Check if a user has a [`Role`]. This will retrieve the [`Guild`] from /// the [`Cache`] if it is available, and then check if that guild has the /// given [`Role`]. diff --git a/src/utils/colour.rs b/src/utils/colour.rs index 71fc25a..6436a06 100644 --- a/src/utils/colour.rs +++ b/src/utils/colour.rs @@ -188,42 +188,6 @@ impl Colour { pub fn tuple(&self) -> (u8, u8, u8) { (self.r(), self.g(), self.b()) } - - /// Alias of [`r`]. - /// - /// [`r`]: #method.r - #[deprecated(since="0.1.5", note="Use `r` instead.")] - #[inline] - pub fn get_r(&self) -> u8 { - self.r() - } - - /// Alias of [`g`]. - /// - /// [`g`]: #method.g - #[deprecated(since="0.1.5", note="Use `g` instead.")] - #[inline] - pub fn get_g(&self) -> u8 { - self.g() - } - - /// Alias of [`b`]. - /// - /// [`b`]: #method.b - #[deprecated(since="0.1.5", note="Use `b` instead.")] - #[inline] - pub fn get_b(&self) -> u8 { - self.b() - } - - /// Alias of [`tuple`]. - /// - /// [`tuple`]: #method.tuple - #[deprecated(since="0.1.5", note="Use `tuple` instead.")] - #[inline] - pub fn get_tuple(&self) -> (u8, u8, u8) { - self.tuple() - } } impl From<i32> for Colour { |