macro_rules! from_env {
($var:literal$(,)?) => { ... };
($($x:tt)*) => { ... };
}
Expand description
Constructs a new Bot
, extracting the token from the environment at
compile time.
If you need to extract the token at runtime, use Bot::from_env
.
This macro is a shorthand for a common case. If you need advanced
configuration, e.g. you want to set a proxy or use a local Bot API
server, construct a Bot
using a bot::Builder
and extracting the token
using String::from(env!("BOT_TOKEN"))
.
Example
let mut bot = tbot::from_env!("BOT_TOKEN");
let me = bot.get_me().call().await?;
dbg!(me);