diff options
| author | Zeyla Hellyer <[email protected]> | 2017-06-20 11:28:52 -0700 |
|---|---|---|
| committer | Zeyla Hellyer <[email protected]> | 2017-06-20 11:28:52 -0700 |
| commit | dc73d1a4bad07b453a9d60a6c8f8c187a7e42450 (patch) | |
| tree | 8c8c4b86e371f8d3dd4262ac8d96b4cda672b9ad /src/model | |
| parent | Fix broken docs links on Permissions struct (diff) | |
| download | serenity-dc73d1a4bad07b453a9d60a6c8f8c187a7e42450.tar.xz serenity-dc73d1a4bad07b453a9d60a6c8f8c187a7e42450.zip | |
Add 'wait' parameter to http::execute_webhook
The 'wait' parameter allows you to specify waiting for the Message to be
sent prior to receiving a response, which will have Discord include the
JSON representation of the Message in the body.
Diffstat (limited to 'src/model')
| -rw-r--r-- | src/model/webhook.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/model/webhook.rs b/src/model/webhook.rs index 9f0309f..a858589 100644 --- a/src/model/webhook.rs +++ b/src/model/webhook.rs @@ -148,7 +148,7 @@ impl Webhook { /// let mut webhook = http::get_webhook_with_token(id, token) /// .expect("valid webhook"); /// - /// let _ = webhook.execute(|w| w.content("test")).expect("Error executing"); + /// let _ = webhook.execute(false, |w| w.content("test")).expect("Error executing"); /// ``` /// /// Execute a webhook with message content of `test`, overriding the @@ -171,15 +171,16 @@ impl Webhook { /// thread safety.") /// .url("https://rust-lang.org")); /// - /// let _ = webhook.execute(|w| w + /// let _ = webhook.execute(false, |w| w /// .content("test") /// .username("serenity") /// .embeds(vec![embed])) /// .expect("Error executing"); /// ``` #[inline] - pub fn execute<F: FnOnce(ExecuteWebhook) -> ExecuteWebhook>(&self, f: F) -> Result<Message> { - http::execute_webhook(self.id.0, &self.token, &f(ExecuteWebhook::default()).0) + pub fn execute<F: FnOnce(ExecuteWebhook) -> ExecuteWebhook>(&self, wait: bool, f: F) + -> Result<Option<Message>> { + http::execute_webhook(self.id.0, &self.token, wait, &f(ExecuteWebhook::default()).0) } /// Retrieves the latest information about the webhook, editing the |