20 lines
510 B
Rust
20 lines
510 B
Rust
use super::commands::*;
|
|
use serde::Deserialize;
|
|
use std::fs;
|
|
|
|
pub fn read_config() -> String {
|
|
fs::read_to_string("config.toml").expect("Could not read config file. Make sure a file named config.toml exists in the current working directory.")
|
|
}
|
|
|
|
#[derive(Deserialize, Debug)]
|
|
pub struct Config {
|
|
#[serde(rename = "command")]
|
|
pub commands: Vec<Command>,
|
|
pub secret: String,
|
|
pub prefix: String,
|
|
}
|
|
|
|
lazy_static! {
|
|
pub static ref CONFIG: Config = toml::from_str(&read_config()).unwrap();
|
|
}
|