This commit is contained in:
thororen1234 2025-05-19 12:45:36 -04:00
parent db7e46b463
commit c3f4967224
No known key found for this signature in database

View file

@ -27,16 +27,12 @@ const settings = definePluginSettings({
const isLegal = (word: string) => { const isLegal = (word: string) => {
if (word.startsWith("<@")) return false; if (word.startsWith("<@")) return false;
if (word.endsWith("ington")) return false;
if (/^https?:\/\//i.test(word)) return false; if (/^https?:\/\//i.test(word)) return false;
if (word.length < 4) return false; if (/[aeouy]$/i.test(word)) return false;
return true; return true;
}; };
const ingtonize = (word: string) => {
return word.endsWith("ton") ? word + "ton" : word + "ington";
};
const handleMessage = ((channelId, message) => { const handleMessage = ((channelId, message) => {
if (!settings.store.isEnabled) return; if (!settings.store.isEnabled) return;
if (!message.content || !message.content.trim()) return; if (!message.content || !message.content.trim()) return;
@ -53,9 +49,19 @@ const handleMessage = ((channelId, message) => {
if (isLegal(words[index])) { if (isLegal(words[index])) {
const word = words[index]; const word = words[index];
words[index] = word.endsWith("ing") if (word.endsWith("ing")) {
? (word === word.toUpperCase() ? word + "TON" : word + "ton") words[index] = word === word.toUpperCase() ? word + "TON" : word + "ton";
: word; } else if (word.endsWith("i") || word.endsWith("I")) {
words[index] = word === word.toUpperCase() ? word + "NGTON" : word + "ngton";
} else if (word.endsWith("in") || word.endsWith("IN")) {
words[index] = word === word.toUpperCase() ? word + "GTON" : word + "gton";
} else if (word.endsWith("ing") || word.endsWith("ING")) {
words[index] = word === word.toUpperCase() ? word + "TON" : word + "ton";
} else if (word.endsWith("ingt") || word.endsWith("INGT")) {
words[index] = word === word.toUpperCase() ? word + "ON" : word + "on";
} else {
words[index] = word === word.toUpperCase() ? word + "INGTON" : word + "ington";
}
} }
message.content = words.join(" "); message.content = words.join(" ");