tenebrous-dicebot/src/context.rs

23 lines
569 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)]
2020-10-17 15:18:51 +00:00
pub struct Context {
pub db: Database,
pub room_id: String,
pub username: String,
pub message_body: String,
}
2020-10-17 15:18:51 +00:00
impl Context {
pub fn new(db: &Database, room_id: &str, username: &str, message_body: &str) -> Context {
Context {
2020-10-17 15:18:51 +00:00
db: db.clone(),
room_id: room_id.to_owned(),
username: username.to_owned(),
message_body: message_body.to_owned(),
}
}
}