aboutsummaryrefslogtreecommitdiff
path: root/src/http
diff options
context:
space:
mode:
authorZeyla Hellyer <[email protected]>2017-09-23 09:17:32 -0700
committerZeyla Hellyer <[email protected]>2017-09-23 09:17:32 -0700
commitcb18d4207c3b9cf942bd561e76ae4059dd50979d (patch)
tree25411698637c8d55cce11eb42ae2ccc3c886d151 /src/http
parentUpdate bitflags, other dependencies (diff)
downloadserenity-cb18d4207c3b9cf942bd561e76ae4059dd50979d.tar.xz
serenity-cb18d4207c3b9cf942bd561e76ae4059dd50979d.zip
Document http::set_token and unhide it from docs
Diffstat (limited to 'src/http')
-rw-r--r--src/http/mod.rs25
1 files changed, 22 insertions, 3 deletions
diff --git a/src/http/mod.rs b/src/http/mod.rs
index 8789ac3..641d803 100644
--- a/src/http/mod.rs
+++ b/src/http/mod.rs
@@ -76,9 +76,28 @@ lazy_static! {
/// Sets the token to be used across all requests which require authentication.
///
-/// This is intended for internal use! The only exception are webhooks.
-/// But really, please don't use this.
-#[doc(hidden)]
+/// If you are using the client module, you don't need to use this. If you're
+/// using serenity solely for HTTP, you need to use this.
+///
+/// # Examples
+///
+/// Setting the token from an environment variable:
+///
+/// ```rust,no_run
+/// # use std::error::Error;
+/// #
+/// # fn try_main() -> Result<(), Box<Error>> {
+/// #
+/// use serenity::http;
+/// use std::env;
+///
+/// http::set_token(&env::var("DISCORD_TOKEN")?);
+/// # Ok(())
+/// # }
+/// #
+/// # fn main() {
+/// # try_main().unwrap();
+/// # }
pub fn set_token(token: &str) { TOKEN.lock().unwrap().clone_from(&token.to_owned()); }
/// Adds a [`User`] as a recipient to a [`Group`].