diff --git a/src/model/channel.rs b/src/model/channel.rs index 931524ef1db..42d5d089c81 100644 --- a/src/model/channel.rs +++ b/src/model/channel.rs @@ -703,6 +703,16 @@ impl ChannelId { after.map(|u| u.into().0)) } + /// Retrieves the channel's webhooks. + /// + /// **Note**: Requires the [Manage Webhooks] permission. + /// + /// [Manage Webhooks]: permissions/constant.MANAGE_WEBHOOKS.html + #[inline] + pub fn get_webhooks(&self) -> Result> { + rest::get_channel_webhooks(self.0) + } + /// Pins a [`Message`] to the channel. #[inline] pub fn pin>(&self, message_id: M) -> Result<()> { @@ -819,16 +829,6 @@ impl ChannelId { pub fn unpin>(&self, message_id: M) -> Result<()> { rest::unpin_message(self.0, message_id.into().0) } - - /// Retrieves the channel's webhooks. - /// - /// **Note**: Requires the [Manage Webhooks] permission. - /// - /// [Manage Webhooks]: permissions/constant.MANAGE_WEBHOOKS.html - #[inline] - pub fn webhooks(&self) -> Result> { - rest::get_channel_webhooks(self.0) - } } impl From for ChannelId { @@ -2109,6 +2109,16 @@ impl GuildChannel { self.id.get_reaction_users(message_id, reaction_type, limit, after) } + /// Retrieves the channel's webhooks. + /// + /// **Note**: Requires the [Manage Webhooks] permission. + /// + /// [Manage Webhooks]: permissions/constant.MANAGE_WEBHOOKS.html + #[inline] + pub fn get_webhooks(&self) -> Result> { + self.id.get_webhooks() + } + /// Attempts to find this channel's guild in the Cache. /// /// **Note**: Right now this performs a clone of the guild. This will be @@ -2202,16 +2212,6 @@ impl GuildChannel { pub fn unpin>(&self, message_id: M) -> Result<()> { self.id.unpin(message_id) } - - /// Retrieves the channel's webhooks. - /// - /// **Note**: Requires the [Manage Webhooks] permission. - /// - /// [Manage Webhooks]: permissions/constant.MANAGE_WEBHOOKS.html - #[inline] - pub fn webhooks(&self) -> Result> { - self.id.webhooks() - } } impl fmt::Display for GuildChannel { diff --git a/src/model/guild.rs b/src/model/guild.rs index e356385bd76..1e3b10ee456 100644 --- a/src/model/guild.rs +++ b/src/model/guild.rs @@ -800,6 +800,16 @@ impl Guild { self.id.get_prune_count(days) } + /// Retrieves the guild's webhooks. + /// + /// **Note**: Requires the [Manage Webhooks] permission. + /// + /// [Manage Webhooks]: permissions/constant.MANAGE_WEBHOOKS.html + #[inline] + pub fn get_webhooks(&self) -> Result> { + self.id.get_webhooks() + } + /// Returns the formatted URL of the guild's icon, if one exists. pub fn icon_url(&self) -> Option { self.icon.as_ref().map(|icon| @@ -1097,16 +1107,6 @@ impl Guild { self.id.unban(user_id) } - - /// Retrieves the guild's webhooks. - /// - /// **Note**: Requires the [Manage Webhooks] permission. - /// - /// [Manage Webhooks]: permissions/constant.MANAGE_WEBHOOKS.html - #[inline] - pub fn webhooks(&self) -> Result> { - self.id.webhooks() - } } impl GuildId { @@ -1478,6 +1478,16 @@ impl GuildId { rest::get_guild_prune_count(self.0, map) } + /// Retrieves the guild's webhooks. + /// + /// **Note**: Requires the [Manage Webhooks] permission. + /// + /// [Manage Webhooks]: permissions/constant.MANAGE_WEBHOOKS.html + #[inline] + pub fn get_webhooks(&self) -> Result> { + rest::get_guild_webhooks(self.0) + } + /// Kicks a [`Member`] from the guild. /// /// Requires the [Kick Members] permission. @@ -1581,16 +1591,6 @@ impl GuildId { pub fn unban>(&self, user_id: U) -> Result<()> { rest::remove_ban(self.0, user_id.into().0) } - - /// Retrieves the guild's webhooks. - /// - /// **Note**: Requires the [Manage Webhooks] permission. - /// - /// [Manage Webhooks]: permissions/constant.MANAGE_WEBHOOKS.html - #[inline] - pub fn webhooks(&self) -> Result> { - rest::get_guild_webhooks(self.0) - } } impl fmt::Display for GuildId { @@ -2229,6 +2229,16 @@ impl PartialGuild { self.id.get_prune_count(days) } + /// Retrieves the guild's webhooks. + /// + /// **Note**: Requires the [Manage Webhooks] permission. + /// + /// [Manage Webhooks]: permissions/constant.MANAGE_WEBHOOKS.html + #[inline] + pub fn get_webhooks(&self) -> Result> { + self.id.get_webhooks() + } + /// Kicks a [`Member`] from the guild. /// /// Requires the [Kick Members] permission. @@ -2361,16 +2371,6 @@ impl PartialGuild { pub fn unban>(&self, user_id: U) -> Result<()> { self.id.unban(user_id) } - - /// Retrieves the guild's webhooks. - /// - /// **Note**: Requires the [Manage Webhooks] permission. - /// - /// [Manage Webhooks]: permissions/constant.MANAGE_WEBHOOKS.html - #[inline] - pub fn webhooks(&self) -> Result> { - self.id.webhooks() - } } impl PossibleGuild {