|
|
|
@ -1,18 +1,20 @@
|
|
|
|
import * as fs from 'fs';
|
|
|
|
import * as fs from "fs";
|
|
|
|
import client from "../client.js";
|
|
|
|
import client from "../client.js";
|
|
|
|
import _ from "lodash";
|
|
|
|
import _ from "lodash";
|
|
|
|
|
|
|
|
|
|
|
|
const dir = './data';
|
|
|
|
const dir = "./data";
|
|
|
|
const files = fs.readdirSync(dir);
|
|
|
|
const files = fs.readdirSync(dir);
|
|
|
|
|
|
|
|
|
|
|
|
for (const file of files) {
|
|
|
|
for (const file of files) {
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
|
|
let rsmData: any;
|
|
|
|
let rsmData: any;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
rsmData = JSON.parse(fs.readFileSync(`${dir}/${file}`, 'utf8'));
|
|
|
|
rsmData = JSON.parse(fs.readFileSync(`${dir}/${file}`, "utf8"));
|
|
|
|
} catch { continue }
|
|
|
|
} catch {
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
if (!rsmData.version || rsmData.version < 3) continue;
|
|
|
|
if (!rsmData.version || rsmData.version < 3) continue;
|
|
|
|
const nucleusData = await client.database.guilds.readOld(rsmData.guild_info.id)
|
|
|
|
const nucleusData = await client.database.guilds.readOld(rsmData.guild_info.id);
|
|
|
|
const rsmToNucleus = {
|
|
|
|
const rsmToNucleus = {
|
|
|
|
id: rsmData.guild_info.id,
|
|
|
|
id: rsmData.guild_info.id,
|
|
|
|
version: 1,
|
|
|
|
version: 1,
|
|
|
|
@ -20,54 +22,54 @@ for (const file of files) {
|
|
|
|
filters: {
|
|
|
|
filters: {
|
|
|
|
images: {
|
|
|
|
images: {
|
|
|
|
NSFW: rsmData.images?.nsfw,
|
|
|
|
NSFW: rsmData.images?.nsfw,
|
|
|
|
size: rsmData.images?.toosmall,
|
|
|
|
size: rsmData.images?.toosmall
|
|
|
|
},
|
|
|
|
},
|
|
|
|
malware: null,
|
|
|
|
malware: null,
|
|
|
|
wordFilter: {
|
|
|
|
wordFilter: {
|
|
|
|
enabled: true,
|
|
|
|
enabled: true,
|
|
|
|
words: {
|
|
|
|
words: {
|
|
|
|
strict: rsmData.wordfilter?.strict,
|
|
|
|
strict: rsmData.wordfilter?.strict,
|
|
|
|
loose: rsmData.wordfilter?.soft,
|
|
|
|
loose: rsmData.wordfilter?.soft
|
|
|
|
},
|
|
|
|
},
|
|
|
|
allowed: {
|
|
|
|
allowed: {
|
|
|
|
users: rsmData.wordfilter?.ignore?.members,
|
|
|
|
users: rsmData.wordfilter?.ignore?.members,
|
|
|
|
roles: rsmData.wordfilter?.ignore?.roles,
|
|
|
|
roles: rsmData.wordfilter?.ignore?.roles,
|
|
|
|
channels: rsmData.wordfilter?.ignore?.channels,
|
|
|
|
channels: rsmData.wordfilter?.ignore?.channels
|
|
|
|
},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
invite: {
|
|
|
|
invite: {
|
|
|
|
enabled: rsmData.invite?.enabled,
|
|
|
|
enabled: rsmData.invite?.enabled,
|
|
|
|
allowed: {
|
|
|
|
allowed: {
|
|
|
|
channels: rsmData.invite?.whitelist?.members,
|
|
|
|
channels: rsmData.invite?.whitelist?.members,
|
|
|
|
roles: rsmData.invite?.whitelist?.roles,
|
|
|
|
roles: rsmData.invite?.whitelist?.roles,
|
|
|
|
users: rsmData.invite?.whitelist?.channels,
|
|
|
|
users: rsmData.invite?.whitelist?.channels
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
welcome: {
|
|
|
|
welcome: {
|
|
|
|
enabled: true,
|
|
|
|
enabled: true,
|
|
|
|
role: rsmData.welcome?.role,
|
|
|
|
role: rsmData.welcome?.role,
|
|
|
|
channel: rsmData.welcome?.message?.channel,
|
|
|
|
channel: rsmData.welcome?.message?.channel,
|
|
|
|
message: rsmData.welcome?.message?.text ?? null,
|
|
|
|
message: rsmData.welcome?.message?.text ?? null
|
|
|
|
},
|
|
|
|
},
|
|
|
|
logging: {
|
|
|
|
logging: {
|
|
|
|
logs: {
|
|
|
|
logs: {
|
|
|
|
enabled: true,
|
|
|
|
enabled: true,
|
|
|
|
channel: rsmData.log_info?.log_channel,
|
|
|
|
channel: rsmData.log_info?.log_channel
|
|
|
|
},
|
|
|
|
},
|
|
|
|
staff: {
|
|
|
|
staff: {
|
|
|
|
channel: rsmData.log_info?.staff,
|
|
|
|
channel: rsmData.log_info?.staff
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
verify: {
|
|
|
|
verify: {
|
|
|
|
enabled: true,
|
|
|
|
enabled: true,
|
|
|
|
role: rsmData.verify_role,
|
|
|
|
role: rsmData.verify_role
|
|
|
|
},
|
|
|
|
},
|
|
|
|
tickets: {
|
|
|
|
tickets: {
|
|
|
|
enabled: true,
|
|
|
|
enabled: true,
|
|
|
|
category: rsmData.modmail?.cat,
|
|
|
|
category: rsmData.modmail?.cat,
|
|
|
|
supportRole: rsmData.modmail?.mention,
|
|
|
|
supportRole: rsmData.modmail?.mention,
|
|
|
|
maxTickets: rsmData.modmail?.max,
|
|
|
|
maxTickets: rsmData.modmail?.max
|
|
|
|
},
|
|
|
|
},
|
|
|
|
tags: rsmData.tags
|
|
|
|
tags: rsmData.tags
|
|
|
|
} as Partial<ReturnType<typeof client.database.guilds.read>>;
|
|
|
|
} as Partial<ReturnType<typeof client.database.guilds.read>>;
|
|
|
|
@ -75,5 +77,4 @@ for (const file of files) {
|
|
|
|
const merged = _.merge(nucleusData, rsmToNucleus);
|
|
|
|
const merged = _.merge(nucleusData, rsmToNucleus);
|
|
|
|
// console.log(merged)
|
|
|
|
// console.log(merged)
|
|
|
|
await client.database.guilds.write(merged.id!, merged);
|
|
|
|
await client.database.guilds.write(merged.id!, merged);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|