diff options
| author | Zeyla Hellyer <[email protected]> | 2017-03-04 20:23:25 -0800 |
|---|---|---|
| committer | Zeyla Hellyer <[email protected]> | 2017-03-04 20:23:25 -0800 |
| commit | e4b484f1c823ccb0aa2be7c54e0def07e5a01806 (patch) | |
| tree | 4ed1e33ae233c5f7583b4c0941ee8e5e19778ff3 /src/model | |
| parent | Fix client::rest::get_guilds doctest (diff) | |
| download | serenity-e4b484f1c823ccb0aa2be7c54e0def07e5a01806.tar.xz serenity-e4b484f1c823ccb0aa2be7c54e0def07e5a01806.zip | |
Remove invite accepting
Diffstat (limited to 'src/model')
| -rw-r--r-- | src/model/invite.rs | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/src/model/invite.rs b/src/model/invite.rs index 7d7378e..4e33a3f 100644 --- a/src/model/invite.rs +++ b/src/model/invite.rs @@ -9,41 +9,8 @@ use ::utils; use super::permissions; #[cfg(feature="cache")] use super::utils as model_utils; -#[cfg(feature="cache")] -use ::client::CACHE; impl Invite { - /// Accepts the invite, placing the current user in the [`Guild`] that the - /// invite was for. - /// - /// Refer to [`rest::accept_invite`] for more information. - /// - /// **Note**: This will fail if you are already in the guild, or are banned. - /// A ban is equivalent to an IP ban. - /// - /// **Note**: Requires that the current user be a user account. - /// - /// # Errors - /// - /// If the `cache` features is enabled, then this returns a - /// [`ClientError::InvalidOperationAsBot`] if the current user does not have - /// the required [permission]. - /// - /// [`ClientError::InvalidOperationAsBot`]: ../client/enum.ClientError.html#variant.InvalidOperationAsBot - /// [`Guild`]: struct.Guild.html - /// [`rest::accept_invite`]: ../client/rest/fn.accept_invite.html - /// [permission]: permissions/index.html - pub fn accept(&self) -> Result<Invite> { - #[cfg(feature="cache")] - { - if CACHE.read().unwrap().user.bot { - return Err(Error::Client(ClientError::InvalidOperationAsBot)); - } - } - - rest::accept_invite(&self.code) - } - /// Creates an invite for a [`GuildChannel`], providing a builder so that /// fields may optionally be set. /// @@ -110,36 +77,6 @@ impl Invite { } impl RichInvite { - /// Accepts the invite, placing the current user in the [`Guild`] that the - /// invite was for. - /// - /// Refer to [`rest::accept_invite`] for more information. - /// - /// **Note**: This will fail if you are already in the guild, or are banned. - /// A ban is equivalent to an IP ban. - /// - /// **Note**: Requires that the current user be a user account. - /// - /// # Errors - /// - /// If the `cache` is enabled, returns a - /// [`ClientError::InvalidOperationAsBot`] if the current user is a bot - /// user. - /// - /// [`ClientError::InvalidOperationAsBot`]: ../client/enum.ClientError.html#variant.InvalidOperationAsBot - /// [`Guild`]: struct.Guild.html - /// [`rest::accept_invite`]: ../client/rest/fn.accept_invite.html - pub fn accept(&self) -> Result<Invite> { - #[cfg(feature="cache")] - { - if CACHE.read().unwrap().user.bot { - return Err(Error::Client(ClientError::InvalidOperationAsBot)); - } - } - - rest::accept_invite(&self.code) - } - /// Deletes the invite. /// /// Refer to [`rest::delete_invite`] for more information. |