mirror of
https://github.com/revanced/revanced-discord-bot.git
synced 2025-04-30 06:24:27 +02:00
feat: use configuration.json
This commit is contained in:
parent
fd5ccb5dd6
commit
4fbe66762f
@ -7,7 +7,11 @@
|
|||||||
0
|
0
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"logging_channel": 0
|
"logging_channel": 0,
|
||||||
|
"censor": {
|
||||||
|
"additions": ["word", "another word"],
|
||||||
|
"excludes": ["word", "another word"]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"administrators": {
|
"administrators": {
|
||||||
"roles": [
|
"roles": [
|
||||||
@ -41,7 +45,7 @@
|
|||||||
},
|
},
|
||||||
"thread_options": {
|
"thread_options": {
|
||||||
"lock_on_response": false,
|
"lock_on_response": false,
|
||||||
"close_on_response": false,
|
"close_on_response": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -10,7 +10,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"media_channels": [],
|
"media_channels": [],
|
||||||
"logging_channel": 1027892160797872179
|
"logging_channel": 1027892160797872179,
|
||||||
|
"censor": {
|
||||||
|
"additions": ["nigga"],
|
||||||
|
"removals": []
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"administrators": {
|
"administrators": {
|
||||||
"roles": [
|
"roles": [
|
||||||
|
@ -66,6 +66,7 @@ pub struct General {
|
|||||||
pub embed_color: i32,
|
pub embed_color: i32,
|
||||||
pub mute: Mute,
|
pub mute: Mute,
|
||||||
pub logging_channel: u64,
|
pub logging_channel: u64,
|
||||||
|
pub censor: Censor
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default, Serialize, Deserialize)]
|
#[derive(Default, Serialize, Deserialize)]
|
||||||
@ -74,6 +75,11 @@ pub struct Mute {
|
|||||||
pub take: Vec<u64>,
|
pub take: Vec<u64>,
|
||||||
}
|
}
|
||||||
#[derive(Default, Serialize, Deserialize)]
|
#[derive(Default, Serialize, Deserialize)]
|
||||||
|
pub struct Censor {
|
||||||
|
pub additions: Vec<String>,
|
||||||
|
pub removals: Vec<String>,
|
||||||
|
}
|
||||||
|
#[derive(Default, Serialize, Deserialize)]
|
||||||
pub struct Administrators {
|
pub struct Administrators {
|
||||||
pub roles: Vec<u64>,
|
pub roles: Vec<u64>,
|
||||||
pub users: Vec<u64>,
|
pub users: Vec<u64>,
|
||||||
|
@ -3,14 +3,27 @@ extern crate decancer;
|
|||||||
use censor::*;
|
use censor::*;
|
||||||
use tracing::{error, info, trace};
|
use tracing::{error, info, trace};
|
||||||
|
|
||||||
use super::*;
|
use super::{*, bot::get_data_lock};
|
||||||
|
|
||||||
pub async fn cure(
|
pub async fn cure(
|
||||||
ctx: &serenity::Context,
|
ctx: &serenity::Context,
|
||||||
old_if_available: &Option<serenity::Member>,
|
old_if_available: &Option<serenity::Member>,
|
||||||
member: &serenity::Member,
|
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 {
|
if member.user.bot {
|
||||||
trace!("Skipping decancer for bot {}.", member.user.tag());
|
trace!("Skipping decancer for bot {}.", member.user.tag());
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user