tenebrous-dicebot/src/context.rs

28 lines
603 B
Rust
Raw Normal View History

use crate::db::Database;
/// A context carried through the system providing access to things
/// like the database.
#[derive(Clone)]
pub struct Context<'a> {
2020-10-17 15:18:51 +00:00
pub db: Database,
pub room_id: &'a str,
pub username: &'a str,
pub message_body: &'a str,
}
impl<'a> Context<'a> {
pub fn new(
db: &Database,
room_id: &'a str,
username: &'a str,
message_body: &'a str,
) -> Context<'a> {
Context {
2020-10-17 15:18:51 +00:00
db: db.clone(),
room_id: room_id,
username: username,
message_body: message_body,
}
}
}