diff options
| author | Austin Hellyer <[email protected]> | 2016-11-24 14:30:22 -0800 |
|---|---|---|
| committer | Austin Hellyer <[email protected]> | 2016-11-24 14:30:22 -0800 |
| commit | 6331fb5f2de580d9ba8c6de00c98032e4db5d984 (patch) | |
| tree | 38eb7e6dd56eb175bdac0d9202613dfd42558777 /src/model/invite.rs | |
| parent | Rename guild structs to Guild and PartialGuild (diff) | |
| download | serenity-6331fb5f2de580d9ba8c6de00c98032e4db5d984.tar.xz serenity-6331fb5f2de580d9ba8c6de00c98032e4db5d984.zip | |
Allow compiling with only either cache or methods
Some of the methods relied on the cache being present. Now, these
methods only conditionally require the cache to be compiled and
present.
The cache was mainly used for checking if the current user had
permission to perform operations.
Diffstat (limited to 'src/model/invite.rs')
| -rw-r--r-- | src/model/invite.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/model/invite.rs b/src/model/invite.rs index 5216509..2f65fd1 100644 --- a/src/model/invite.rs +++ b/src/model/invite.rs @@ -109,13 +109,15 @@ impl RichInvite { /// [`http::delete_invite`]: ../client/http/fn.delete_invite.html /// [Manage Guild]: permissions/constant.MANAGE_GUILD.html /// [permission]: permissions/index.html - #[cfg(feature="methods")] + #[cfg(feature = "methods")] pub fn delete(&self) -> Result<Invite> { let req = permissions::MANAGE_GUILD; - if !try!(utils::user_has_perms(self.channel.id, req)) { - return Err(Error::Client(ClientError::InvalidPermissions(req))); - } + feature_cache_enabled! {{ + if !try!(utils::user_has_perms(self.channel.id, req)) { + return Err(Error::Client(ClientError::InvalidPermissions(req))); + } + }} http::delete_invite(&self.code) } |