aboutsummaryrefslogtreecommitdiff
path: root/src/model/channel.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/model/channel.rs')
-rw-r--r--src/model/channel.rs23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/model/channel.rs b/src/model/channel.rs
index 014442a..facb67a 100644
--- a/src/model/channel.rs
+++ b/src/model/channel.rs
@@ -16,7 +16,7 @@ use super::utils::{
};
use super::*;
use super::utils;
-use ::builder::{CreateInvite, EditChannel};
+use ::builder::{CreateEmbed, CreateInvite, EditChannel};
use ::client::{STATE, http};
use ::prelude_internal::*;
use ::utils::decode_array;
@@ -251,6 +251,18 @@ impl fmt::Display for Channel {
}
}
+impl Embed {
+ /// Creates a fake Embed, giving back a `serde_json` map.
+ ///
+ /// This should only be useful in conjunction with [`Webhook::execute`].
+ ///
+ /// [`Webhook::execute`]: struct.Webhook.html
+ #[inline(always)]
+ pub fn fake<F>(f: F) -> Value where F: FnOnce(CreateEmbed) -> CreateEmbed {
+ f(CreateEmbed::default()).0.build()
+ }
+}
+
impl Group {
/// Adds the given user to the group. If the user is already in the group,
/// then nothing is done.
@@ -764,6 +776,15 @@ impl PublicChannel {
http::send_message(self.id.0, map)
}
+
+ /// 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.id.0)
+ }
}
impl fmt::Display for PublicChannel {