Compare commits
2 Commits
8c2251d41c
...
096234f423
| Author | SHA1 | Date |
|---|---|---|
|
|
096234f423 | |
|
|
16825f006f |
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "manifold"
|
name = "manifold"
|
||||||
version = "6.0.0"
|
version = "6.1.0"
|
||||||
authors = ["Lucy Bladen <admin@lbladen.uk>"]
|
authors = ["Lucy Bladen <admin@lbladen.uk>"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::path::PathBuf;
|
|
||||||
use config::Config;
|
use config::Config;
|
||||||
use poise::serenity_prelude::ChannelId;
|
use poise::serenity_prelude::ChannelId;
|
||||||
use crate::ManifoldResult;
|
use crate::ManifoldResult;
|
||||||
|
|
@ -26,8 +25,7 @@ pub struct ManifoldConfig {
|
||||||
pub nickname: String,
|
pub nickname: String,
|
||||||
pub services: HashMap<String, FuelTank>,
|
pub services: HashMap<String, FuelTank>,
|
||||||
pub database: DatabaseConfig,
|
pub database: DatabaseConfig,
|
||||||
pub responses_file_path: PathBuf,
|
pub responses_file_path: String,
|
||||||
pub locale: String,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ManifoldConfig {
|
impl ManifoldConfig {
|
||||||
|
|
|
||||||
|
|
@ -81,8 +81,9 @@ pub async fn prepare_client<T: EventHandler>(arguments: ArgMatches, intents: Gat
|
||||||
info!("Reading configuration...");
|
info!("Reading configuration...");
|
||||||
debug!("Configuration file path: {}", &config_file);
|
debug!("Configuration file path: {}", &config_file);
|
||||||
let bot_config = ManifoldConfig::new(&config_file, bot_environment).expect(&*format!("Could not read configuration file {}", &config_file));
|
let bot_config = ManifoldConfig::new(&config_file, bot_environment).expect(&*format!("Could not read configuration file {}", &config_file));
|
||||||
|
let bot_locale = arguments.get_one::<String>("locale").unwrap();
|
||||||
|
|
||||||
rust_i18n::set_locale(bot_config.locale.as_str());
|
rust_i18n::set_locale(bot_locale);
|
||||||
|
|
||||||
let manager = ConnectionManager::<PgConnection>::new(format!("postgresql://{user}:{pass}@{host}:{port}/{database}", user=&bot_config.database.user, pass=&bot_config.database.pass, host=&bot_config.database.host, port=&bot_config.database.port, database=&bot_config.database.database_name));
|
let manager = ConnectionManager::<PgConnection>::new(format!("postgresql://{user}:{pass}@{host}:{port}/{database}", user=&bot_config.database.user, pass=&bot_config.database.pass, host=&bot_config.database.host, port=&bot_config.database.port, database=&bot_config.database.database_name));
|
||||||
let pool = r2d2::Pool::builder()
|
let pool = r2d2::Pool::builder()
|
||||||
|
|
@ -91,7 +92,7 @@ pub async fn prepare_client<T: EventHandler>(arguments: ArgMatches, intents: Gat
|
||||||
.expect("Database setup error!");
|
.expect("Database setup error!");
|
||||||
|
|
||||||
let mut responses = Responses::new();
|
let mut responses = Responses::new();
|
||||||
responses.reload(&PathBuf::from(&bot_config.responses_file_path)).expect("Could not load responses file!");
|
responses.reload(&PathBuf::from(&format!("{file}.{locale}.txt", file=bot_config.responses_file_path, locale=bot_locale))).expect("Could not load responses file!");
|
||||||
|
|
||||||
let token = env::var("DISCORD_TOKEN").expect(
|
let token = env::var("DISCORD_TOKEN").expect(
|
||||||
"Could not find an environment variable called DISCORD_TOKEN",
|
"Could not find an environment variable called DISCORD_TOKEN",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue