-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.tsx
42 lines (38 loc) · 1.33 KB
/
index.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { ApplicationCommandInputType, sendBotMessage } from "@api/Commands";
import definePlugin from "@utils/types";
import { cleanMessage } from "./core";
let totalReplacements = 0;
export default definePlugin({
name: "dysclusif",
description: "Remove inclusive writing for dyslexic people",
authors: [{ name: "candiceetdefondouze", id: 0n }],
dependencies: ["CommandsAPI"],
patches: [
{
find: "Message must not be a thread starter message",
replacement: {
match: /\.memo\(function\((\i)\)\{/,
replace: ".memo(function($1){$1=$self.editMessage($1);"
}
}
],
commands: [
{
name: "dyscount",
description: "Montre le nombre de regex utilisées depuis que discord est actif",
inputType: ApplicationCommandInputType.BUILT_IN,
options: [],
execute: (_, ctx) => {
sendBotMessage(ctx.channel.id, {
content: totalReplacements + " Regex utilisées depuis le début de la journée"
});
}
},
],
editMessage: (m) => {
let [newContent, replacementCounts] = cleanMessage(m.message.content);
totalReplacements += replacementCounts;
m.message.content = newContent;
return m;
}
});