add a pretty "neat" feature
and remove banned slurs
This commit is contained in:
parent
1b3aae766b
commit
d5fcaece31
4 changed files with 23 additions and 52 deletions
|
@ -1,7 +1,3 @@
|
||||||
export const GUILD_ID = '923671181020766230';
|
export const GUILD_ID = '923671181020766230';
|
||||||
export const DEBUG_CHANNEL_ID = '977401259260788756';
|
export const DEBUG_CHANNEL_ID = '977401259260788756';
|
||||||
export const POLYCAT_CHANNEL_ID = '977797790749032448';
|
export const POLYCAT_CHANNEL_ID = '977797790749032448';
|
||||||
|
|
||||||
export const BAD_WORDS = <string[]>(
|
|
||||||
['ruls_tset'].map((r) => [...r].reverse().join(''))
|
|
||||||
);
|
|
||||||
|
|
40
index.ts
40
index.ts
|
@ -2,11 +2,11 @@ import { Client, Intents } from 'discord.js';
|
||||||
import { commands, aliases } from './commands';
|
import { commands, aliases } from './commands';
|
||||||
|
|
||||||
import * as BuildConfig from './constants';
|
import * as BuildConfig from './constants';
|
||||||
import Filter from 'bad-words';
|
|
||||||
import { isBad } from './badLinks';
|
import { isBad } from './badLinks';
|
||||||
|
|
||||||
import { green, bold, blue, underline, yellow } from 'kleur/colors';
|
import { green, bold, blue, underline, yellow } from 'kleur/colors';
|
||||||
import urlRegex from 'url-regex';
|
import urlRegex from 'url-regex';
|
||||||
|
import removeMarkdown from 'remove-markdown';
|
||||||
|
|
||||||
const client = new Client({
|
const client = new Client({
|
||||||
intents: [
|
intents: [
|
||||||
|
@ -73,34 +73,7 @@ client.once('ready', async () => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const profaneFilter = new Filter({
|
// phishing link filter
|
||||||
emptyList: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
profaneFilter.addWords(...BuildConfig.BAD_WORDS);
|
|
||||||
|
|
||||||
if (profaneFilter.isProfane(e.content)) {
|
|
||||||
const replyMsg = await e.reply({
|
|
||||||
embeds: [
|
|
||||||
{
|
|
||||||
title: 'Profanity detected!',
|
|
||||||
description: "Please don't use these words.",
|
|
||||||
color: 'FUCHSIA',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
});
|
|
||||||
await e.delete();
|
|
||||||
|
|
||||||
setTimeout(() => {
|
|
||||||
replyMsg.delete();
|
|
||||||
}, 2500);
|
|
||||||
|
|
||||||
// if (!e.member) return;
|
|
||||||
// await e.member.disableCommunicationUntil(Date.now() + 5 * 60 * 1000);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
const urlMatches = [...e.content.matchAll(urlRegex())];
|
const urlMatches = [...e.content.matchAll(urlRegex())];
|
||||||
|
|
||||||
|
@ -127,6 +100,15 @@ client.once('ready', async () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// neat
|
||||||
|
{
|
||||||
|
const cleanContent = removeMarkdown(e.content).toLowerCase();
|
||||||
|
if (cleanContent.split(' ').includes('neat')) {
|
||||||
|
console.log('[neat]', cleanContent);
|
||||||
|
await e.reply('Neat is a mod by Vazkii.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const cmd = e.content.split(' ')[0];
|
const cmd = e.content.split(' ')[0];
|
||||||
if (!cmd.startsWith('!')) return;
|
if (!cmd.startsWith('!')) return;
|
||||||
let func = commands[cmd];
|
let func = commands[cmd];
|
||||||
|
|
|
@ -9,15 +9,15 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@cliqz/adblocker": "^1.23.8",
|
"@cliqz/adblocker": "^1.23.8",
|
||||||
"bad-words": "^3.0.4",
|
|
||||||
"discord.js": "^13.7.0",
|
"discord.js": "^13.7.0",
|
||||||
"kleur": "^4.1.4",
|
"kleur": "^4.1.4",
|
||||||
"node-fetch": "^3.2.4",
|
"node-fetch": "^3.2.4",
|
||||||
|
"remove-markdown": "^0.5.0",
|
||||||
"url-regex": "^5.0.0"
|
"url-regex": "^5.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@esbuild-plugins/node-resolve": "^0.1.4",
|
"@esbuild-plugins/node-resolve": "^0.1.4",
|
||||||
"@types/bad-words": "^3.0.1",
|
"@types/remove-markdown": "^0.3.1",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.25.0",
|
"@typescript-eslint/eslint-plugin": "^5.25.0",
|
||||||
"@typescript-eslint/parser": "^5.25.0",
|
"@typescript-eslint/parser": "^5.25.0",
|
||||||
"esbuild": "^0.14.39",
|
"esbuild": "^0.14.39",
|
||||||
|
|
27
yarn.lock
27
yarn.lock
|
@ -191,11 +191,6 @@
|
||||||
dependencies:
|
dependencies:
|
||||||
defer-to-connect "^1.0.1"
|
defer-to-connect "^1.0.1"
|
||||||
|
|
||||||
"@types/bad-words@^3.0.1":
|
|
||||||
version "3.0.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/@types/bad-words/-/bad-words-3.0.1.tgz#6a20fb08814af5e1f2428fa9e0098ca7b36f730a"
|
|
||||||
integrity sha512-7la3ZDJG1tlRqySO+pnXycZpacaMEw/iLEm8kc4l+I+jN8KjBfoQVwO6jm98xzXVLrxV8vDrB5TaMoop8sKclQ==
|
|
||||||
|
|
||||||
"@types/chrome@^0.0.183":
|
"@types/chrome@^0.0.183":
|
||||||
version "0.0.183"
|
version "0.0.183"
|
||||||
resolved "https://registry.yarnpkg.com/@types/chrome/-/chrome-0.0.183.tgz#c12649c00ae5ae8fca511248256c0b11f91c95e2"
|
resolved "https://registry.yarnpkg.com/@types/chrome/-/chrome-0.0.183.tgz#c12649c00ae5ae8fca511248256c0b11f91c95e2"
|
||||||
|
@ -244,6 +239,11 @@
|
||||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.34.tgz#3b0b6a50ff797280b8d000c6281d229f9c538cef"
|
resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.34.tgz#3b0b6a50ff797280b8d000c6281d229f9c538cef"
|
||||||
integrity sha512-XImEz7XwTvDBtzlTnm8YvMqGW/ErMWBsKZ+hMTvnDIjGCKxwK5Xpc+c/oQjOauwq8M4OS11hEkpjX8rrI/eEgA==
|
integrity sha512-XImEz7XwTvDBtzlTnm8YvMqGW/ErMWBsKZ+hMTvnDIjGCKxwK5Xpc+c/oQjOauwq8M4OS11hEkpjX8rrI/eEgA==
|
||||||
|
|
||||||
|
"@types/remove-markdown@^0.3.1":
|
||||||
|
version "0.3.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/remove-markdown/-/remove-markdown-0.3.1.tgz#82bc3664c313f50f7c77f1bb59935f567689dc63"
|
||||||
|
integrity sha512-JpJNEJEsmmltyL2LdE8KRjJ0L2ad5vgLibqNj85clohT9AyTrfN6jvHxStPshDkmtcL/ShFu0p2tbY7DBS1mqQ==
|
||||||
|
|
||||||
"@types/resolve@^1.17.1":
|
"@types/resolve@^1.17.1":
|
||||||
version "1.20.2"
|
version "1.20.2"
|
||||||
resolved "https://registry.yarnpkg.com/@types/resolve/-/resolve-1.20.2.tgz#97d26e00cd4a0423b4af620abecf3e6f442b7975"
|
resolved "https://registry.yarnpkg.com/@types/resolve/-/resolve-1.20.2.tgz#97d26e00cd4a0423b4af620abecf3e6f442b7975"
|
||||||
|
@ -403,18 +403,6 @@ asynckit@^0.4.0:
|
||||||
resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"
|
resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"
|
||||||
integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==
|
integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==
|
||||||
|
|
||||||
bad-words@^3.0.4:
|
|
||||||
version "3.0.4"
|
|
||||||
resolved "https://registry.yarnpkg.com/bad-words/-/bad-words-3.0.4.tgz#044c83935c4c363a905d47b5e0179f7241fecaec"
|
|
||||||
integrity sha512-v/Q9uRPH4+yzDVLL4vR1+S9KoFgOEUl5s4axd6NIAq8SV2mradgi4E8lma/Y0cw1ltVdvyegCQQKffCPRCp8fg==
|
|
||||||
dependencies:
|
|
||||||
badwords-list "^1.0.0"
|
|
||||||
|
|
||||||
badwords-list@^1.0.0:
|
|
||||||
version "1.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/badwords-list/-/badwords-list-1.0.0.tgz#5e9856dbf13482a295c3b0b304afb9d4cfc5c579"
|
|
||||||
integrity sha512-oWhaSG67e+HQj3OGHQt2ucP+vAPm1wTbdp2aDHeuh4xlGXBdWwzZ//pfu6swf5gZ8iX0b7JgmSo8BhgybbqszA==
|
|
||||||
|
|
||||||
balanced-match@^1.0.0:
|
balanced-match@^1.0.0:
|
||||||
version "1.0.2"
|
version "1.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee"
|
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee"
|
||||||
|
@ -1768,6 +1756,11 @@ registry-url@^5.0.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
rc "^1.2.8"
|
rc "^1.2.8"
|
||||||
|
|
||||||
|
remove-markdown@^0.5.0:
|
||||||
|
version "0.5.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/remove-markdown/-/remove-markdown-0.5.0.tgz#a596264bbd60b9ceab2e2ae86e5789eee91aee32"
|
||||||
|
integrity sha512-x917M80K97K5IN1L8lUvFehsfhR8cYjGQ/yAMRI9E7JIKivtl5Emo5iD13DhMr+VojzMCiYk8V2byNPwT/oapg==
|
||||||
|
|
||||||
resolve-from@^4.0.0:
|
resolve-from@^4.0.0:
|
||||||
version "4.0.0"
|
version "4.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6"
|
resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue