diff options
| author | Zeyla Hellyer <[email protected]> | 2017-05-05 17:09:39 -0700 |
|---|---|---|
| committer | Zeyla Hellyer <[email protected]> | 2017-05-05 17:11:31 -0700 |
| commit | ae352ea3df86eb2d853d5b1af048a95409aafc38 (patch) | |
| tree | b5701ee38a917c2483b09628d0e2ccf981bc1058 /src/client | |
| parent | Add framework dynamic_prefix example (diff) | |
| download | serenity-ae352ea3df86eb2d853d5b1af048a95409aafc38.tar.xz serenity-ae352ea3df86eb2d853d5b1af048a95409aafc38.zip | |
Fix guild leaving result
When leaving a guild, `rest::leave_guild` would attempt to deserialize a
JSON body containing a partial amount of guild info, resulting in an
error:
```
Could not leave guild: Json(ErrorImpl { code: EofWhileParsingValue, line: 1, column: 0 })
```
Although the bot would still actually leave the guild, it would always
return this error.
To fix this, don't try to deserialize anything and only check for a 204
instead.
Diffstat (limited to 'src/client')
| -rw-r--r-- | src/client/rest/mod.rs | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/client/rest/mod.rs b/src/client/rest/mod.rs index 1e032fd..31d7a17 100644 --- a/src/client/rest/mod.rs +++ b/src/client/rest/mod.rs @@ -1341,13 +1341,8 @@ pub fn leave_group(guild_id: u64) -> Result<Group> { } /// Leaves a guild. -pub fn leave_guild(guild_id: u64) -> Result<PartialGuild> { - let response = request!(Route::UsersMeGuildsId, - delete, - "/users/@me/guilds/{}", - guild_id); - - serde_json::from_reader::<HyperResponse, PartialGuild>(response).map_err(From::from) +pub fn leave_guild(guild_id: u64) -> Result<()> { + verify(204, request!(Route::UsersMeGuildsId, delete, "/users/@me/guilds/{}", guild_id)) } /// Deletes a user from group DM. |