[][src]Macro tbot::from_env

macro_rules! from_env {
    ($var:literal) => { ... };
    ($var:literal,) => { ... };
    ($var:literal, $connector:expr) => { ... };
    ($var:literal, $connector:expr,) => { ... };
    () => { ... };
    ($($x:tt)+) => { ... };
}

Constructs a new Bot, extracting the token from the environment at compile time.

You can provide a connector as the second parameter, e.g. from_env!("...", connector).

If you need to extract the token at runtime, use Bot::from_env.

Example

let mut bot = tbot::from_env!("BOT_TOKEN");
let me = bot.get_me().call().await.unwrap();
dbg!(me);