[][src]Function serenity::http::raw::set_token

pub fn set_token(token: &str)

Sets the token to be used across all requests which require authentication.

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:

use serenity::http;
use std::env;

http::set_token(&env::var("DISCORD_TOKEN")?);