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",
|
||||
"clickhouse",
|
||||
"clickhouse_pool",
|
||||
"config",
|
||||
"database",
|
||||
"poise",
|
||||
"serde",
|
||||
"tokio",
|
||||
"tokio-cron-scheduler",
|
||||
"toml",
|
||||
"tool_tracing",
|
||||
"tracing",
|
||||
"uuid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -524,6 +521,26 @@ version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
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]]
|
||||
name = "clickhouse"
|
||||
version = "0.13.2"
|
||||
@ -583,6 +600,18 @@ dependencies = [
|
||||
"url",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "config"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"database",
|
||||
"poise",
|
||||
"serde",
|
||||
"toml",
|
||||
"tool_tracing",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "core-foundation"
|
||||
version = "0.9.4"
|
||||
|
12
Cargo.toml
12
Cargo.toml
@ -2,14 +2,16 @@
|
||||
[workspace]
|
||||
resolver = '2'
|
||||
members = [
|
||||
'apps/bot',
|
||||
'apps/cli',
|
||||
'libs/tool_tracing',
|
||||
'libs/clickhouse_pool',
|
||||
'libs/database',
|
||||
'libs/bot',
|
||||
'libs/config',
|
||||
]
|
||||
|
||||
[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 = [
|
||||
'macros',
|
||||
'rt-multi-thread',
|
||||
@ -19,11 +21,11 @@ serde = '1.0'
|
||||
tracing = '0.1'
|
||||
serde_json = '1.0'
|
||||
clickhouse = { version = '0.13', features = ['native-tls', 'uuid', 'chrono'] }
|
||||
uuid = { version = "1.16", features = ["serde", "v4"] }
|
||||
chrono = { version = "0.4.41", features = ["serde"] }
|
||||
uuid = { version = '1.16', features = ['serde', 'v4'] }
|
||||
chrono = { version = '0.4.41', features = ['serde'] }
|
||||
|
||||
[profile.release]
|
||||
lto = true
|
||||
|
||||
[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 del-question : Suppression de question
|
||||
- [ ] [ADMIN] trivial load-question : Charge un fichier/lien de question
|
||||
- [ ] [ADMIN] trivial choose-chan : Choix du channel
|
||||
- [ ] trivial scoreboard : Scoreboard
|
||||
- [ ] trivial score : Score d'une personne par défaut le sien
|
||||
- [ ] trivial top : Top X par défaut 3
|
||||
|
@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "bot"
|
||||
name = "cli"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
@ -20,5 +20,7 @@ tokio-cron-scheduler = { version = "0.14", features = [
|
||||
"tracing-subscriber",
|
||||
"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
|
@ -1,8 +1,8 @@
|
||||
{
|
||||
"name": "bot",
|
||||
"name": "cli",
|
||||
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
||||
"projectType": "application",
|
||||
"sourceRoot": "apps/bot/src",
|
||||
"sourceRoot": "apps/cli/src",
|
||||
"targets": {
|
||||
"build": {
|
||||
"cache": true,
|
||||
@ -11,7 +11,7 @@
|
||||
"{options.target-dir}"
|
||||
],
|
||||
"options": {
|
||||
"target-dir": "dist/target/bot"
|
||||
"target-dir": "dist/target/cli"
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
@ -26,7 +26,7 @@
|
||||
"{options.target-dir}"
|
||||
],
|
||||
"options": {
|
||||
"target-dir": "dist/target/bot"
|
||||
"target-dir": "dist/target/cli"
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
@ -41,7 +41,7 @@
|
||||
"{options.target-dir}"
|
||||
],
|
||||
"options": {
|
||||
"target-dir": "dist/target/bot"
|
||||
"target-dir": "dist/target/cli"
|
||||
}
|
||||
},
|
||||
"run": {
|
||||
@ -50,7 +50,7 @@
|
||||
"{options.target-dir}"
|
||||
],
|
||||
"options": {
|
||||
"target-dir": "dist/target/bot"
|
||||
"target-dir": "dist/target/cli"
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
@ -2,10 +2,6 @@ use bot::start_bot;
|
||||
use config::parse_local_config;
|
||||
use tracing::{error, info};
|
||||
|
||||
pub mod bot;
|
||||
pub mod config;
|
||||
pub mod dotenv;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
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 tracing::info;
|
||||
|
@ -2,7 +2,7 @@ use clickhouse_pool::traits::Model;
|
||||
use database::guild::Guild;
|
||||
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
|
||||
/// If not, check the user's permissions
|
@ -7,7 +7,7 @@ use tracing::info;
|
||||
use trivia::trivia;
|
||||
use utility::{age::age, help::help, server::servers};
|
||||
|
||||
use crate::config::Config;
|
||||
use config::Config;
|
||||
|
||||
pub mod event;
|
||||
pub mod helper;
|
@ -1,5 +1,5 @@
|
||||
use crate::bot::helper::is_user_admin_right;
|
||||
use crate::bot::{Context, Error};
|
||||
use crate::helper::is_user_admin_right;
|
||||
use crate::{Context, Error};
|
||||
use clickhouse_pool::traits::Model;
|
||||
use database::trivial::{Trivial, TrivialRewardKind};
|
||||
use poise::serenity_prelude::{Channel, Role};
|
@ -1,5 +1,5 @@
|
||||
use crate::bot::helper::is_user_admin_right;
|
||||
use crate::bot::{Context, Error};
|
||||
use crate::helper::is_user_admin_right;
|
||||
use crate::{Context, Error};
|
||||
use clickhouse_pool::traits::Model;
|
||||
use database::trivial::Trivial;
|
||||
use poise::serenity_prelude;
|
@ -1,5 +1,5 @@
|
||||
use crate::bot::helper::is_user_admin_right;
|
||||
use crate::bot::{Context, Error};
|
||||
use crate::helper::is_user_admin_right;
|
||||
use crate::{Context, Error};
|
||||
use clickhouse_pool::traits::Model;
|
||||
use database::trivial::Trivial;
|
||||
use poise::{
|
@ -2,7 +2,7 @@ pub mod config;
|
||||
pub mod create;
|
||||
pub mod list;
|
||||
|
||||
use crate::bot::{Context, Error};
|
||||
use crate::{Context, Error};
|
||||
use config::config;
|
||||
use create::create;
|
||||
use list::list;
|
@ -1,4 +1,4 @@
|
||||
use crate::bot::{Context, Error};
|
||||
use crate::{Context, Error};
|
||||
use poise::serenity_prelude as serenity;
|
||||
use tracing::instrument;
|
||||
|
@ -1,4 +1,4 @@
|
||||
use crate::bot::{Context, Error};
|
||||
use crate::{Context, Error};
|
||||
use poise::builtins::PrettyHelpConfiguration;
|
||||
use tracing::instrument;
|
||||
|
@ -1,4 +1,4 @@
|
||||
use crate::bot::{Context, Error};
|
||||
use crate::{Context, Error};
|
||||
use tracing::instrument;
|
||||
|
||||
/// 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 tool_tracing::tracing_kind::Tracing;
|
||||
|
||||
use crate::dotenv;
|
||||
pub mod dotenv;
|
||||
|
||||
const BOT_NAME: &str = "BOT_NAME";
|
||||
const BOT_TOKEN: &str = "BOT_TOKEN";
|
Loading…
Reference in New Issue
Block a user