aboutsummaryrefslogtreecommitdiff
path: root/src/model/id.rs
diff options
context:
space:
mode:
authorAustin Hellyer <[email protected]>2016-11-07 11:43:15 -0800
committerAustin Hellyer <[email protected]>2016-11-07 11:43:15 -0800
commita114a55efb5b08f9e5f289203db2dfd4db82852a (patch)
tree8522e8eb3e77534ecf5c8e0208746b587eae887b /src/model/id.rs
parentAdd Attachment::download{,to_directory} (diff)
downloadserenity-a114a55efb5b08f9e5f289203db2dfd4db82852a.tar.xz
serenity-a114a55efb5b08f9e5f289203db2dfd4db82852a.zip
Add webhook support
Diffstat (limited to 'src/model/id.rs')
-rw-r--r--src/model/id.rs29
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)
+ }
+}