diff options
| author | Austin Hellyer <[email protected]> | 2017-01-13 09:06:40 -0800 |
|---|---|---|
| committer | Austin Hellyer <[email protected]> | 2017-01-18 21:51:47 -0800 |
| commit | 147cf01d4f13e3ee15eb03705ab2b7a006851cdd (patch) | |
| tree | 90084581a3039cb7332f652231e31a8bb91568c8 /src/client/context.rs | |
| parent | TRACE-log on shard handler event receival (diff) | |
| download | serenity-147cf01d4f13e3ee15eb03705ab2b7a006851cdd.tar.xz serenity-147cf01d4f13e3ee15eb03705ab2b7a006851cdd.zip | |
Make a single POST on guild role create
The endpoint to create a role no longer returns an empty role which
must be PATCHed, and can be completed in the initial request.
Diffstat (limited to 'src/client/context.rs')
| -rw-r--r-- | src/client/context.rs | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/src/client/context.rs b/src/client/context.rs index 334d63c..73882dd 100644 --- a/src/client/context.rs +++ b/src/client/context.rs @@ -505,19 +505,7 @@ impl Context { /// [Manage Roles]: ../model/permissions/constant.MANAGE_ROLES.html pub fn create_role<F, G>(&self, guild_id: G, f: F) -> Result<Role> where F: FnOnce(EditRole) -> EditRole, G: Into<GuildId> { - let id = guild_id.into().0; - - // The API only allows creating an empty role, which must then be - // edited. - // - // Note to self: [this] issue/proposal may make this not require an - // edit. - // - // [this]: http://github.com/hammerandchisel/discord-api-docs/issues/156 - let role = rest::create_role(id)?; - let map = f(EditRole::default()).0.build(); - - rest::edit_role(id, role.id.0, map) + rest::create_role(guild_id.into().0, f(EditRole::default()).0.build()) } /// Deletes a [`Channel`] based on the Id given. |