feat(build): adding configuration folder to automod

This commit is contained in:
Raphael 2026-02-15 23:38:56 +01:00
parent 52eaa12cc1
commit 8a3798d3ea
No known key found for this signature in database

View file

@ -8,6 +8,7 @@ use std::{
const COMMAND_DIR: &str = "./src/commands/";
const EVENT_DIR: &str = "./src/events/";
const MODEL_DIR: &str = "./src/models";
const CONF_DIR: &str = "./src/config";
const DB_DIR: &str = "./src/database";
const UTILS_DIR: &str = "./src/utils";
const MOD_PREFIX: &str = "pub mod ";
@ -148,6 +149,20 @@ fn utils() -> io::Result<()> {
Ok(())
}
fn config() -> io::Result<()> {
let root: &Path = Path::new(CONF_DIR);
let sources: Vec<String> = read_dir(root);
let mut modules: String = String::new();
println!("'emoji'");
for source in sources {
modules = modules + &String::from(MOD_PREFIX) + &source + &String::from(";\n");
println!("\t'{}'", source);
}
write(String::from(CONF_DIR) + &String::from(MOD_FILE), modules)?;
Ok(())
}
fn main() {
if let Err(e) = commands() {
panic!("Error when writing the commands \n{}", e)
@ -164,4 +179,7 @@ fn main() {
if let Err(e) = utils() {
panic!("Error when writing the database_helper:\n{}", e)
}
if let Err(e) = config() {
panic!("Error when writing the database_helper:\n{}", e)
}
}