diff --git a/configuration.example.json b/configuration.example.json index be74183..f1b6242 100644 --- a/configuration.example.json +++ b/configuration.example.json @@ -7,7 +7,11 @@ 0 ] }, - "logging_channel": 0 + "logging_channel": 0, + "censor": { + "additions": ["word", "another word"], + "excludes": ["word", "another word"] + } }, "administrators": { "roles": [ @@ -41,7 +45,7 @@ }, "thread_options": { "lock_on_response": false, - "close_on_response": false, + "close_on_response": false } } ] diff --git a/configuration.revanced.json b/configuration.revanced.json index 49fa63b..1a2a858 100644 --- a/configuration.revanced.json +++ b/configuration.revanced.json @@ -10,7 +10,11 @@ ] }, "media_channels": [], - "logging_channel": 1027892160797872179 + "logging_channel": 1027892160797872179, + "censor": { + "additions": ["nigga"], + "removals": [] + } }, "administrators": { "roles": [ diff --git a/src/model/application.rs b/src/model/application.rs index 440022a..99c9ccb 100644 --- a/src/model/application.rs +++ b/src/model/application.rs @@ -66,6 +66,7 @@ pub struct General { pub embed_color: i32, pub mute: Mute, pub logging_channel: u64, + pub censor: Censor } #[derive(Default, Serialize, Deserialize)] @@ -74,6 +75,11 @@ pub struct Mute { pub take: Vec, } #[derive(Default, Serialize, Deserialize)] +pub struct Censor { + pub additions: Vec, + pub removals: Vec, +} +#[derive(Default, Serialize, Deserialize)] pub struct Administrators { pub roles: Vec, pub users: Vec, diff --git a/src/utils/decancer.rs b/src/utils/decancer.rs index 9883c7e..59ca863 100644 --- a/src/utils/decancer.rs +++ b/src/utils/decancer.rs @@ -3,14 +3,27 @@ extern crate decancer; use censor::*; use tracing::{error, info, trace}; -use super::*; +use super::{*, bot::get_data_lock}; pub async fn cure( ctx: &serenity::Context, old_if_available: &Option, member: &serenity::Member, ) { - let censor = Standard + "nigga"; + let data_lock = get_data_lock(ctx).await; + let additions = &data_lock.read().await.configuration.general.censor.additions; + let removals = &data_lock.read().await.configuration.general.censor.removals; + + let mut censor = Standard; + + for addition in additions { + censor = censor + addition; + } + + for removal in removals { + censor = censor - removal; + } + if member.user.bot { trace!("Skipping decancer for bot {}.", member.user.tag()); return;