Skip to content

Commit

Permalink
Add a method to retrieve a webhook's URL (#889)
Browse files Browse the repository at this point in the history
  • Loading branch information
vicky5124 committed Jun 20, 2020
1 parent a92ca08 commit 5931d1c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/model/webhook.rs
Expand Up @@ -234,6 +234,15 @@ impl Webhook {
Err(why) => Err(why),
}
}

/// Returns the url of the webhook.
///
/// ```rust,ignore
/// assert_eq!(hook.url(), "https://discord.com/api/webhooks/245037420704169985/ig5AO-wdVWpCBtUUMxmgsWryqgsW3DChbKYOINftJ4DCrUbnkedoYZD0VOH1QLr-S3sV")
/// ```
pub fn url(&self) -> String {
format!("https://discord.com/api/webhooks/{}/{}", self.id, self.token)
}
}

#[cfg(feature = "model")]
Expand Down

0 comments on commit 5931d1c

Please sign in to comment.