diff options
| author | Austin Hellyer <[email protected]> | 2016-11-07 11:43:15 -0800 |
|---|---|---|
| committer | Austin Hellyer <[email protected]> | 2016-11-07 11:43:15 -0800 |
| commit | a114a55efb5b08f9e5f289203db2dfd4db82852a (patch) | |
| tree | 8522e8eb3e77534ecf5c8e0208746b587eae887b /src/model/id.rs | |
| parent | Add Attachment::download{,to_directory} (diff) | |
| download | serenity-a114a55efb5b08f9e5f289203db2dfd4db82852a.tar.xz serenity-a114a55efb5b08f9e5f289203db2dfd4db82852a.zip | |
Add webhook support
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) + } +} |