Development (#77)

- moved extended tsconfig into our tsconfig to remove errors
- updated some mod checks to allow for running of commands (warn, about)
if mod only has manageMessages

Review this ASAP
pull/89/head
Samuel Shuert 3 years ago committed by GitHub
commit aacedbe77c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -5,7 +5,6 @@
"@tensorflow/tfjs": "^3.18.0", "@tensorflow/tfjs": "^3.18.0",
"@tensorflow/tfjs-node": "^3.18.0", "@tensorflow/tfjs-node": "^3.18.0",
"@total-typescript/ts-reset": "^0.3.7", "@total-typescript/ts-reset": "^0.3.7",
"@tsconfig/node18-strictest-esm": "^1.0.0",
"@types/gm": "^1.25.0", "@types/gm": "^1.25.0",
"@types/node": "^18.14.6", "@types/node": "^18.14.6",
"@ungap/structured-clone": "^1.0.1", "@ungap/structured-clone": "^1.0.1",
@ -82,7 +81,7 @@
"prettier": "^2.7.1", "prettier": "^2.7.1",
"prettier-eslint": "^15.0.1", "prettier-eslint": "^15.0.1",
"tsc-suppress": "^1.0.7", "tsc-suppress": "^1.0.7",
"typescript": "^4.9.4", "typescript": "^5.0.0",
"yarn-audit-fix": "^9.3.9" "yarn-audit-fix": "^9.3.9"
} }
} }

@ -444,7 +444,7 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
const check = (interaction: CommandInteraction) => { const check = (interaction: CommandInteraction) => {
const member = interaction.member as GuildMember; const member = interaction.member as GuildMember;
if (!member.permissions.has("ModerateMembers")) return "You do not have the *Moderate Members* permission"; if (!member.permissions.has("ManageMessages")) return "You do not have the *Manage Messages* permission";
return true; return true;
}; };

@ -300,7 +300,7 @@ const callback = async (
const check = (interaction: CommandInteraction | ButtonInteraction, partial: boolean = false, target?: GuildMember) => { const check = (interaction: CommandInteraction | ButtonInteraction, partial: boolean = false, target?: GuildMember) => {
if (!interaction.guild) return; if (!interaction.guild) return;
const member = interaction.member as GuildMember; const member = interaction.member as GuildMember;
if (!member.permissions.has("ModerateMembers")) return "You do not have the *Moderate Members* permission"; if (!member.permissions.has("ManageMessages")) return "You do not have the *Manage Messages* permission";
if (partial) return true; if (partial) return true;
let apply: GuildMember; let apply: GuildMember;
if (interaction.isButton()) { if (interaction.isButton()) {

@ -1092,29 +1092,29 @@ const callback = async (interaction: CommandInteraction): Promise<void> => {
} else { } else {
switch (i.values[0]) { switch (i.values[0]) {
case "invites": { case "invites": {
config.invite = await inviteMenu(i, m, _.isEqual(config, current), config.invite); current.invite = await inviteMenu(i, m, _.isEqual(config, current), current.invite);
break; break;
} }
case "mentions": { case "mentions": {
config.pings = await mentionMenu(i, m, _.isEqual(config, current), config.pings); current.pings = await mentionMenu(i, m, _.isEqual(config, current), current.pings);
break; break;
} }
case "words": { case "words": {
config.wordFilter = await wordMenu(i, m, _.isEqual(config, current), config.wordFilter); current.wordFilter = await wordMenu(i, m, _.isEqual(config, current), current.wordFilter);
break; break;
} }
case "malware": { case "malware": {
config.malware = !config.malware; current.malware = !current.malware;
break; break;
} }
case "images": { case "images": {
const next = await imageMenu(i, m, _.isEqual(config, current), config.images); const next = await imageMenu(i, m, _.isEqual(config, current), current.images);
config.images = next; current.images = next;
break; break;
} }
case "clean": { case "clean": {
const next = await cleanMenu(i, m, _.isEqual(config, current), config.clean); const next = await cleanMenu(i, m, _.isEqual(config, current), config.clean);
config.clean = next; current.clean = next;
break; break;
} }
} }

@ -219,7 +219,7 @@ export async function doMemberChecks(member: Discord.GuildMember): Promise<void>
// Does the username contain filtered words // Does the username contain filtered words
// Does the nickname contain filtered words // Does the nickname contain filtered words
let nameCheck; let nameCheck;
if(member.nickname) { if (member.nickname) {
nameCheck = TestString(member.nickname ?? "", loose, strict, guildData.filters.wordFilter.enabled); nameCheck = TestString(member.nickname ?? "", loose, strict, guildData.filters.wordFilter.enabled);
} else { } else {
nameCheck = TestString(member.user.username, loose, strict, guildData.filters.wordFilter.enabled); nameCheck = TestString(member.user.username, loose, strict, guildData.filters.wordFilter.enabled);
@ -239,13 +239,7 @@ export async function doMemberChecks(member: Discord.GuildMember): Promise<void>
// Does the nickname contain an invite // Does the nickname contain an invite
const nicknameInviteCheck = const nicknameInviteCheck =
guildData.filters.invite.enabled && /discord\.gg\/[a-zA-Z0-9]+/gi.test(member.nickname ?? ""); guildData.filters.invite.enabled && /discord\.gg\/[a-zA-Z0-9]+/gi.test(member.nickname ?? "");
if ( if (nameCheck !== null || avatarCheck || inviteCheck || nicknameInviteCheck || avatarTextCheck !== null) {
nameCheck !== null ||
avatarCheck ||
inviteCheck ||
nicknameInviteCheck ||
avatarTextCheck !== null
) {
const infractions = []; const infractions = [];
if (nameCheck !== null) { if (nameCheck !== null) {
infractions.push(`Name contains a ${nameCheck.type}ly filtered word (${nameCheck.word})`); infractions.push(`Name contains a ${nameCheck.type}ly filtered word (${nameCheck.word})`);

@ -1,6 +1,19 @@
{ {
"extends": "@tsconfig/node18-strictest-esm/tsconfig.json", "$schema": "https://json.schemastore.org/tsconfig",
"display": "Node 18 + ESM + Strictest",
"compilerOptions": { "compilerOptions": {
"lib": ["es2022"],
"strict": true,
"exactOptionalPropertyTypes": true,
"noFallthroughCasesInSwitch": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noUncheckedIndexedAccess": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"forceConsistentCasingInFileNames": true,
"allowUnusedLabels": false,
"allowUnreachableCode": false,
"module": "NodeNext", "module": "NodeNext",
"target": "es2020", "target": "es2020",
"sourceMap": true, "sourceMap": true,
@ -11,7 +24,8 @@
"resolveJsonModule": true, "resolveJsonModule": true,
"moduleResolution": "NodeNext", "moduleResolution": "NodeNext",
"skipLibCheck": true, "skipLibCheck": true,
"noImplicitReturns": false "noImplicitReturns": false,
"checkJs": true
}, },
"include": ["src/**/*", "src/*", "src/config/main.d.ts", "src/config/main.ts"], "include": ["src/**/*", "src/*", "src/config/main.d.ts", "src/config/main.ts"],
"exclude": ["src/Unfinished/**/*", "src/reflex/nsfwjs/**/*"] "exclude": ["src/Unfinished/**/*", "src/reflex/nsfwjs/**/*"]

Loading…
Cancel
Save