use super::prelude::*;
use std::ops::Deref;
#[derive(Clone)]
pub struct Context {
api: Arc<BotApi>,
pub bot_info: Option<BotInfo>,
}
impl Context {
pub(crate) fn new(api: Arc<BotApi>) -> Self {
Self {
api,
bot_info: None,
}
}
pub fn api(&self) -> &BotApi {
&self.api
}
pub(crate) fn with_bot_info(mut self, bot_info: BotInfo) -> Self {
self.bot_info = Some(bot_info);
self
}
}
impl Deref for Context {
type Target = BotApi;
fn deref(&self) -> &Self::Target {
self.api()
}
}