diff options
| author | acdenisSK <[email protected]> | 2017-10-24 18:10:10 +0200 |
|---|---|---|
| committer | acdenisSK <[email protected]> | 2017-10-24 18:10:10 +0200 |
| commit | ef60c3cd5b93d61ff8200f5f6871b449bf7dccb5 (patch) | |
| tree | ff9ec9e09dc363c05c6b582380a120ca47290a9f /src/http | |
| parent | Remove `on_` prefix to EventHandler tymethods (diff) | |
| parent | Fall back to `str::parse` if `parse_username` fails (diff) | |
| download | serenity-ef60c3cd5b93d61ff8200f5f6871b449bf7dccb5.tar.xz serenity-ef60c3cd5b93d61ff8200f5f6871b449bf7dccb5.zip | |
Merge v0.4.2
Diffstat (limited to 'src/http')
| -rw-r--r-- | src/http/mod.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/http/mod.rs b/src/http/mod.rs index d6b32f1..3fb5b7b 100644 --- a/src/http/mod.rs +++ b/src/http/mod.rs @@ -820,6 +820,24 @@ pub fn edit_role(guild_id: u64, role_id: u64, map: &JsonMap) -> Result<Role> { .map_err(From::from) } +/// Changes the position of a role in a guild. +pub fn edit_role_position(guild_id: u64, role_id: u64, position: u64) -> Result<Vec<Role>> { + let body = serde_json::to_string(&json!({ + "id": role_id, + "position": position, + }))?; + let response = request!( + Route::GuildsIdRolesId(guild_id), + patch(body), + "/guilds/{}/roles/{}", + guild_id, + role_id + ); + + serde_json::from_reader::<HyperResponse, Vec<Role>>(response) + .map_err(From::from) +} + /// Edits a the webhook with the given data. /// /// The Value is a map with optional values of: |