feat: Split des packages
This commit is contained in:
parent
d026347897
commit
9ecece1a5b
37
Cargo.lock
generated
37
Cargo.lock
generated
@ -404,15 +404,12 @@ dependencies = [
|
|||||||
"chrono",
|
"chrono",
|
||||||
"clickhouse",
|
"clickhouse",
|
||||||
"clickhouse_pool",
|
"clickhouse_pool",
|
||||||
|
"config",
|
||||||
"database",
|
"database",
|
||||||
"poise",
|
"poise",
|
||||||
"serde",
|
"serde",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tokio-cron-scheduler",
|
|
||||||
"toml",
|
|
||||||
"tool_tracing",
|
|
||||||
"tracing",
|
"tracing",
|
||||||
"uuid",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -524,6 +521,26 @@ version = "1.0.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "93a719913643003b84bd13022b4b7e703c09342cd03b679c4641c7d2e50dc34d"
|
checksum = "93a719913643003b84bd13022b4b7e703c09342cd03b679c4641c7d2e50dc34d"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cli"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"bot",
|
||||||
|
"chrono",
|
||||||
|
"clickhouse",
|
||||||
|
"clickhouse_pool",
|
||||||
|
"config",
|
||||||
|
"database",
|
||||||
|
"poise",
|
||||||
|
"serde",
|
||||||
|
"tokio",
|
||||||
|
"tokio-cron-scheduler",
|
||||||
|
"toml",
|
||||||
|
"tool_tracing",
|
||||||
|
"tracing",
|
||||||
|
"uuid",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clickhouse"
|
name = "clickhouse"
|
||||||
version = "0.13.2"
|
version = "0.13.2"
|
||||||
@ -583,6 +600,18 @@ dependencies = [
|
|||||||
"url",
|
"url",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "config"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"database",
|
||||||
|
"poise",
|
||||||
|
"serde",
|
||||||
|
"toml",
|
||||||
|
"tool_tracing",
|
||||||
|
"tracing",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "core-foundation"
|
name = "core-foundation"
|
||||||
version = "0.9.4"
|
version = "0.9.4"
|
||||||
|
12
Cargo.toml
12
Cargo.toml
@ -2,14 +2,16 @@
|
|||||||
[workspace]
|
[workspace]
|
||||||
resolver = '2'
|
resolver = '2'
|
||||||
members = [
|
members = [
|
||||||
'apps/bot',
|
'apps/cli',
|
||||||
'libs/tool_tracing',
|
'libs/tool_tracing',
|
||||||
'libs/clickhouse_pool',
|
'libs/clickhouse_pool',
|
||||||
'libs/database',
|
'libs/database',
|
||||||
|
'libs/bot',
|
||||||
|
'libs/config',
|
||||||
]
|
]
|
||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
poise = { git = "https://github.com/serenity-rs/poise", branch = "current" }
|
poise = { git = 'https://github.com/serenity-rs/poise', branch = 'current' }
|
||||||
tokio = { version = '1.45.0', features = [
|
tokio = { version = '1.45.0', features = [
|
||||||
'macros',
|
'macros',
|
||||||
'rt-multi-thread',
|
'rt-multi-thread',
|
||||||
@ -19,11 +21,11 @@ serde = '1.0'
|
|||||||
tracing = '0.1'
|
tracing = '0.1'
|
||||||
serde_json = '1.0'
|
serde_json = '1.0'
|
||||||
clickhouse = { version = '0.13', features = ['native-tls', 'uuid', 'chrono'] }
|
clickhouse = { version = '0.13', features = ['native-tls', 'uuid', 'chrono'] }
|
||||||
uuid = { version = "1.16", features = ["serde", "v4"] }
|
uuid = { version = '1.16', features = ['serde', 'v4'] }
|
||||||
chrono = { version = "0.4.41", features = ["serde"] }
|
chrono = { version = '0.4.41', features = ['serde'] }
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
lto = true
|
lto = true
|
||||||
|
|
||||||
[patch.crates-io]
|
[patch.crates-io]
|
||||||
serenity = { git = "https://github.com/serenity-rs/serenity", branch = "current" }
|
serenity = { git = 'https://github.com/serenity-rs/serenity', branch = 'current' }
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
- [ ] [ADMIN] trivial add-question : Ajout de question + réponse ou X réponse
|
- [ ] [ADMIN] trivial add-question : Ajout de question + réponse ou X réponse
|
||||||
- [ ] [ADMIN] trivial del-question : Suppression de question
|
- [ ] [ADMIN] trivial del-question : Suppression de question
|
||||||
- [ ] [ADMIN] trivial load-question : Charge un fichier/lien de question
|
- [ ] [ADMIN] trivial load-question : Charge un fichier/lien de question
|
||||||
- [ ] [ADMIN] trivial choose-chan : Choix du channel
|
|
||||||
- [ ] trivial scoreboard : Scoreboard
|
- [ ] trivial scoreboard : Scoreboard
|
||||||
- [ ] trivial score : Score d'une personne par défaut le sien
|
- [ ] trivial score : Score d'une personne par défaut le sien
|
||||||
- [ ] trivial top : Top X par défaut 3
|
- [ ] trivial top : Top X par défaut 3
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "bot"
|
name = "cli"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
@ -20,5 +20,7 @@ tokio-cron-scheduler = { version = "0.14", features = [
|
|||||||
"tracing-subscriber",
|
"tracing-subscriber",
|
||||||
"signal",
|
"signal",
|
||||||
] }
|
] }
|
||||||
|
config = { path = "../../libs/config" }
|
||||||
|
bot = { path = "../../libs/bot" }
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"name": "bot",
|
"name": "cli",
|
||||||
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
||||||
"projectType": "application",
|
"projectType": "application",
|
||||||
"sourceRoot": "apps/bot/src",
|
"sourceRoot": "apps/cli/src",
|
||||||
"targets": {
|
"targets": {
|
||||||
"build": {
|
"build": {
|
||||||
"cache": true,
|
"cache": true,
|
||||||
@ -11,7 +11,7 @@
|
|||||||
"{options.target-dir}"
|
"{options.target-dir}"
|
||||||
],
|
],
|
||||||
"options": {
|
"options": {
|
||||||
"target-dir": "dist/target/bot"
|
"target-dir": "dist/target/cli"
|
||||||
},
|
},
|
||||||
"configurations": {
|
"configurations": {
|
||||||
"production": {
|
"production": {
|
||||||
@ -26,7 +26,7 @@
|
|||||||
"{options.target-dir}"
|
"{options.target-dir}"
|
||||||
],
|
],
|
||||||
"options": {
|
"options": {
|
||||||
"target-dir": "dist/target/bot"
|
"target-dir": "dist/target/cli"
|
||||||
},
|
},
|
||||||
"configurations": {
|
"configurations": {
|
||||||
"production": {
|
"production": {
|
||||||
@ -41,7 +41,7 @@
|
|||||||
"{options.target-dir}"
|
"{options.target-dir}"
|
||||||
],
|
],
|
||||||
"options": {
|
"options": {
|
||||||
"target-dir": "dist/target/bot"
|
"target-dir": "dist/target/cli"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"run": {
|
"run": {
|
||||||
@ -50,7 +50,7 @@
|
|||||||
"{options.target-dir}"
|
"{options.target-dir}"
|
||||||
],
|
],
|
||||||
"options": {
|
"options": {
|
||||||
"target-dir": "dist/target/bot"
|
"target-dir": "dist/target/cli"
|
||||||
},
|
},
|
||||||
"configurations": {
|
"configurations": {
|
||||||
"production": {
|
"production": {
|
@ -2,10 +2,6 @@ use bot::start_bot;
|
|||||||
use config::parse_local_config;
|
use config::parse_local_config;
|
||||||
use tracing::{error, info};
|
use tracing::{error, info};
|
||||||
|
|
||||||
pub mod bot;
|
|
||||||
pub mod config;
|
|
||||||
pub mod dotenv;
|
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() {
|
async fn main() {
|
||||||
println!(include_str!("banner.art"));
|
println!(include_str!("banner.art"));
|
17
libs/bot/Cargo.toml
Normal file
17
libs/bot/Cargo.toml
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
[package]
|
||||||
|
name = "bot"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
poise = { workspace = true }
|
||||||
|
tokio = { workspace = true }
|
||||||
|
serde = { workspace = true }
|
||||||
|
tracing = { workspace = true }
|
||||||
|
clickhouse_pool = { path = "../../libs/clickhouse_pool" }
|
||||||
|
clickhouse = { workspace = true }
|
||||||
|
chrono = { workspace = true }
|
||||||
|
config = { path = "../../libs/config" }
|
||||||
|
database = { path = "../../libs/database" }
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
43
libs/bot/project.json
Normal file
43
libs/bot/project.json
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
{
|
||||||
|
"name": "bot",
|
||||||
|
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
||||||
|
"projectType": "library",
|
||||||
|
"sourceRoot": "libs/bot/src",
|
||||||
|
"targets": {
|
||||||
|
"build": {
|
||||||
|
"executor": "@monodon/rust:check",
|
||||||
|
"outputs": [
|
||||||
|
"{options.target-dir}"
|
||||||
|
],
|
||||||
|
"options": {
|
||||||
|
"target-dir": "dist/target/bot"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"test": {
|
||||||
|
"cache": true,
|
||||||
|
"executor": "@monodon/rust:test",
|
||||||
|
"outputs": [
|
||||||
|
"{options.target-dir}"
|
||||||
|
],
|
||||||
|
"options": {
|
||||||
|
"target-dir": "dist/target/bot"
|
||||||
|
},
|
||||||
|
"configurations": {
|
||||||
|
"production": {
|
||||||
|
"release": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"lint": {
|
||||||
|
"cache": true,
|
||||||
|
"executor": "@monodon/rust:lint",
|
||||||
|
"outputs": [
|
||||||
|
"{options.target-dir}"
|
||||||
|
],
|
||||||
|
"options": {
|
||||||
|
"target-dir": "dist/target/bot"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"tags": []
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
use crate::bot::{Data, Error};
|
use crate::{Data, Error};
|
||||||
use poise::serenity_prelude::{self as serenity, ActivityData};
|
use poise::serenity_prelude::{self as serenity, ActivityData};
|
||||||
use tracing::info;
|
use tracing::info;
|
||||||
|
|
@ -2,7 +2,7 @@ use clickhouse_pool::traits::Model;
|
|||||||
use database::guild::Guild;
|
use database::guild::Guild;
|
||||||
use tracing::{info, warn};
|
use tracing::{info, warn};
|
||||||
|
|
||||||
use crate::bot::{Context, Error};
|
use crate::{Context, Error};
|
||||||
|
|
||||||
/// Check if the guild has been initialized, if it is check if user is in list of admins
|
/// Check if the guild has been initialized, if it is check if user is in list of admins
|
||||||
/// If not, check the user's permissions
|
/// If not, check the user's permissions
|
@ -7,7 +7,7 @@ use tracing::info;
|
|||||||
use trivia::trivia;
|
use trivia::trivia;
|
||||||
use utility::{age::age, help::help, server::servers};
|
use utility::{age::age, help::help, server::servers};
|
||||||
|
|
||||||
use crate::config::Config;
|
use config::Config;
|
||||||
|
|
||||||
pub mod event;
|
pub mod event;
|
||||||
pub mod helper;
|
pub mod helper;
|
@ -1,5 +1,5 @@
|
|||||||
use crate::bot::helper::is_user_admin_right;
|
use crate::helper::is_user_admin_right;
|
||||||
use crate::bot::{Context, Error};
|
use crate::{Context, Error};
|
||||||
use clickhouse_pool::traits::Model;
|
use clickhouse_pool::traits::Model;
|
||||||
use database::trivial::{Trivial, TrivialRewardKind};
|
use database::trivial::{Trivial, TrivialRewardKind};
|
||||||
use poise::serenity_prelude::{Channel, Role};
|
use poise::serenity_prelude::{Channel, Role};
|
@ -1,5 +1,5 @@
|
|||||||
use crate::bot::helper::is_user_admin_right;
|
use crate::helper::is_user_admin_right;
|
||||||
use crate::bot::{Context, Error};
|
use crate::{Context, Error};
|
||||||
use clickhouse_pool::traits::Model;
|
use clickhouse_pool::traits::Model;
|
||||||
use database::trivial::Trivial;
|
use database::trivial::Trivial;
|
||||||
use poise::serenity_prelude;
|
use poise::serenity_prelude;
|
@ -1,5 +1,5 @@
|
|||||||
use crate::bot::helper::is_user_admin_right;
|
use crate::helper::is_user_admin_right;
|
||||||
use crate::bot::{Context, Error};
|
use crate::{Context, Error};
|
||||||
use clickhouse_pool::traits::Model;
|
use clickhouse_pool::traits::Model;
|
||||||
use database::trivial::Trivial;
|
use database::trivial::Trivial;
|
||||||
use poise::{
|
use poise::{
|
@ -2,7 +2,7 @@ pub mod config;
|
|||||||
pub mod create;
|
pub mod create;
|
||||||
pub mod list;
|
pub mod list;
|
||||||
|
|
||||||
use crate::bot::{Context, Error};
|
use crate::{Context, Error};
|
||||||
use config::config;
|
use config::config;
|
||||||
use create::create;
|
use create::create;
|
||||||
use list::list;
|
use list::list;
|
@ -1,4 +1,4 @@
|
|||||||
use crate::bot::{Context, Error};
|
use crate::{Context, Error};
|
||||||
use poise::serenity_prelude as serenity;
|
use poise::serenity_prelude as serenity;
|
||||||
use tracing::instrument;
|
use tracing::instrument;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
use crate::bot::{Context, Error};
|
use crate::{Context, Error};
|
||||||
use poise::builtins::PrettyHelpConfiguration;
|
use poise::builtins::PrettyHelpConfiguration;
|
||||||
use tracing::instrument;
|
use tracing::instrument;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
use crate::bot::{Context, Error};
|
use crate::{Context, Error};
|
||||||
use tracing::instrument;
|
use tracing::instrument;
|
||||||
|
|
||||||
/// Lists all servers the bot is in
|
/// Lists all servers the bot is in
|
13
libs/config/Cargo.toml
Normal file
13
libs/config/Cargo.toml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
[package]
|
||||||
|
name = "config"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
poise = { workspace = true }
|
||||||
|
serde = { workspace = true }
|
||||||
|
database = { path = "../../libs/database" }
|
||||||
|
tool_tracing = { path = "../../libs/tool_tracing" }
|
||||||
|
toml = "0.8"
|
||||||
|
tracing = { workspace = true }
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
43
libs/config/project.json
Normal file
43
libs/config/project.json
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
{
|
||||||
|
"name": "config",
|
||||||
|
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
||||||
|
"projectType": "library",
|
||||||
|
"sourceRoot": "libs/config/src",
|
||||||
|
"targets": {
|
||||||
|
"build": {
|
||||||
|
"executor": "@monodon/rust:check",
|
||||||
|
"outputs": [
|
||||||
|
"{options.target-dir}"
|
||||||
|
],
|
||||||
|
"options": {
|
||||||
|
"target-dir": "dist/target/config"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"test": {
|
||||||
|
"cache": true,
|
||||||
|
"executor": "@monodon/rust:test",
|
||||||
|
"outputs": [
|
||||||
|
"{options.target-dir}"
|
||||||
|
],
|
||||||
|
"options": {
|
||||||
|
"target-dir": "dist/target/config"
|
||||||
|
},
|
||||||
|
"configurations": {
|
||||||
|
"production": {
|
||||||
|
"release": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"lint": {
|
||||||
|
"cache": true,
|
||||||
|
"executor": "@monodon/rust:lint",
|
||||||
|
"outputs": [
|
||||||
|
"{options.target-dir}"
|
||||||
|
],
|
||||||
|
"options": {
|
||||||
|
"target-dir": "dist/target/config"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"tags": []
|
||||||
|
}
|
@ -4,7 +4,7 @@ use serde::Deserialize;
|
|||||||
use std::{env, fs::read_to_string, path::PathBuf};
|
use std::{env, fs::read_to_string, path::PathBuf};
|
||||||
use tool_tracing::tracing_kind::Tracing;
|
use tool_tracing::tracing_kind::Tracing;
|
||||||
|
|
||||||
use crate::dotenv;
|
pub mod dotenv;
|
||||||
|
|
||||||
const BOT_NAME: &str = "BOT_NAME";
|
const BOT_NAME: &str = "BOT_NAME";
|
||||||
const BOT_TOKEN: &str = "BOT_TOKEN";
|
const BOT_TOKEN: &str = "BOT_TOKEN";
|
Loading…
Reference in New Issue
Block a user