Skip to content

Commit

Permalink
Add method to EditGuild to transfer ownership
Browse files Browse the repository at this point in the history
There used to be a method to do the equivilant but was lost in the move
to an OOP pattern, so this should be re-added back.
  • Loading branch information
Zeyla Hellyer committed Feb 7, 2017
1 parent 6f33a35 commit f00e165
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/utils/builder/edit_guild.rs
@@ -1,7 +1,7 @@
use serde_json::builder::ObjectBuilder;
use serde_json::Value;
use std::default::Default;
use ::model::{ChannelId, Region, VerificationLevel};
use ::model::{ChannelId, Region, UserId, VerificationLevel};

/// A builder to optionally edit certain fields of a [`Guild`]. This is meant
/// for usage with [`Context::edit_guild`] and [`LiveGuild::edit`].
Expand Down Expand Up @@ -72,6 +72,13 @@ impl EditGuild {
EditGuild(self.0.insert("name", name))
}

/// Transfers the ownership of the guild to another user by Id.
///
/// **Note**: The current user must be the owner of the guild.
pub fn owner<U: Into<UserId>>(self, user_id: U) -> Self {
EditGuild(self.0.insert("owner_id", user_id.into().0))
}

/// Set the voice region of the server.
///
/// # Examples
Expand Down

0 comments on commit f00e165

Please sign in to comment.