diff options
| author | Zeyla Hellyer <[email protected]> | 2017-02-07 11:16:09 -0800 |
|---|---|---|
| committer | Zeyla Hellyer <[email protected]> | 2017-02-07 11:16:09 -0800 |
| commit | f00e1654e8549ec6582c6f3a8fc4af6aadd56015 (patch) | |
| tree | b4237961826961221b41eeef8cffd18e3ff5159d /src/utils/builder | |
| parent | Remove lifetime on Search (diff) | |
| download | serenity-f00e1654e8549ec6582c6f3a8fc4af6aadd56015.tar.xz serenity-f00e1654e8549ec6582c6f3a8fc4af6aadd56015.zip | |
Add method to EditGuild to transfer ownership
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.
Diffstat (limited to 'src/utils/builder')
| -rw-r--r-- | src/utils/builder/edit_guild.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/utils/builder/edit_guild.rs b/src/utils/builder/edit_guild.rs index 43e93da..83d5016 100644 --- a/src/utils/builder/edit_guild.rs +++ b/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`]. @@ -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 |