diff options
Diffstat (limited to 'src/model/id.rs')
| -rw-r--r-- | src/model/id.rs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/model/id.rs b/src/model/id.rs index 967b18c..faeccd3 100644 --- a/src/model/id.rs +++ b/src/model/id.rs @@ -28,6 +28,15 @@ impl ChannelId { prefix: "<#", } } + + /// Retrieves the channel's webhooks. + /// + /// **Note**: Requires the [Manage Webhooks] permission. + /// + /// [Manage Webhooks]: permissions/constant.MANAGE_WEBHOOKS.html + pub fn webhooks(&self) -> Result<Vec<Webhook>> { + http::get_channel_webhooks(self.0) + } } impl From<Channel> for ChannelId { @@ -81,6 +90,15 @@ impl GuildId { prefix: "<#", } } + + /// Retrieves the guild's webhooks. + /// + /// **Note**: Requires the [Manage Webhooks] permission. + /// + /// [Manage Webhooks]: permissions/constant.MANAGE_WEBHOOKS.html + pub fn webhooks(&self) -> Result<Vec<Webhook>> { + http::get_guild_webhooks(self.0) + } } impl From<Guild> for GuildId { @@ -181,3 +199,14 @@ impl UserId { } } } + +impl WebhookId { + /// Retrieves the webhook by the Id. + /// + /// **Note**: Requires the [Manage Webhooks] permission. + /// + /// [Manage Webhooks]: permissions/constant.MANAGE_WEBHOOKS.html + pub fn webhooks(&self) -> Result<Webhook> { + http::get_webhook(self.0) + } +} |