From f00e1654e8549ec6582c6f3a8fc4af6aadd56015 Mon Sep 17 00:00:00 2001 From: Zeyla Hellyer Date: Tue, 7 Feb 2017 11:16:09 -0800 Subject: 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. --- src/utils/builder/edit_guild.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/utils/builder') 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>(self, user_id: U) -> Self { + EditGuild(self.0.insert("owner_id", user_id.into().0)) + } + /// Set the voice region of the server. /// /// # Examples -- cgit v1.2.3