aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAustin Hellyer <[email protected]>2017-01-24 08:05:39 -0800
committerAustin Hellyer <[email protected]>2017-01-24 08:05:39 -0800
commite8a90860d1e451e21d3bf728178957fe54cf106d (patch)
tree298ccf208dd2cbd16e366ab19f3f3d89f0b5dda7 /src
parentUse Id methods where possible (diff)
downloadserenity-e8a90860d1e451e21d3bf728178957fe54cf106d.tar.xz
serenity-e8a90860d1e451e21d3bf728178957fe54cf106d.zip
Rename 'webhooks' methods to 'get_webhooks'
Diffstat (limited to 'src')
-rw-r--r--src/model/channel.rs40
-rw-r--r--src/model/guild.rs60
2 files changed, 50 insertions, 50 deletions
diff --git a/src/model/channel.rs b/src/model/channel.rs
index 931524e..42d5d08 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<Vec<Webhook>> {
+ rest::get_channel_webhooks(self.0)
+ }
+
/// Pins a [`Message`] to the channel.
#[inline]
pub fn pin<M: Into<MessageId>>(&self, message_id: M) -> Result<()> {
@@ -819,16 +829,6 @@ impl ChannelId {
pub fn unpin<M: Into<MessageId>>(&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<Vec<Webhook>> {
- rest::get_channel_webhooks(self.0)
- }
}
impl From<Channel> 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<Vec<Webhook>> {
+ 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<M: Into<MessageId>>(&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<Vec<Webhook>> {
- self.id.webhooks()
- }
}
impl fmt::Display for GuildChannel {
diff --git a/src/model/guild.rs b/src/model/guild.rs
index e356385..1e3b10e 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<Vec<Webhook>> {
+ self.id.get_webhooks()
+ }
+
/// Returns the formatted URL of the guild's icon, if one exists.
pub fn icon_url(&self) -> Option<String> {
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<Vec<Webhook>> {
- 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<Vec<Webhook>> {
+ 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<U: Into<UserId>>(&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<Vec<Webhook>> {
- 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<Vec<Webhook>> {
+ self.id.get_webhooks()
+ }
+
/// Kicks a [`Member`] from the guild.
///
/// Requires the [Kick Members] permission.
@@ -2361,16 +2371,6 @@ impl PartialGuild {
pub fn unban<U: Into<UserId>>(&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<Vec<Webhook>> {
- self.id.webhooks()
- }
}
impl PossibleGuild<Guild> {