I'm tired of this...
This commit is contained in:
parent
19dbbb3c3e
commit
d758118272
13
main.cjs
13
main.cjs
@ -181,8 +181,15 @@ function getMatchingPhrase(inputString, targetCharacter) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
global.clenseDegeneracy = function clenseDegeneracy(message) {
|
global.clenseDegeneracy = function clenseDegeneracy(message) {
|
||||||
let checkString = message.content.toLowerCase();
|
function normalizeString(str) {
|
||||||
let checkArray = ["ussy", "u$sy", "us$y", "u$$y"];
|
// Define a mapping of characters to 's'
|
||||||
|
const sMap = { '$': 's', '5': 's' };
|
||||||
|
|
||||||
|
// Replace similar characters with 's'
|
||||||
|
return str.split('').map(char => sMap[char] || char).join('');
|
||||||
|
}
|
||||||
|
let checkString = normalizeString(message.content.toLowerCase());
|
||||||
|
let checkArray = ["ussy", "ussies"];
|
||||||
function checkLoop(message, content) {
|
function checkLoop(message, content) {
|
||||||
console.log("Checking " + content + "...");
|
console.log("Checking " + content + "...");
|
||||||
for (let i = 0; i < checkArray.length; i++) {
|
for (let i = 0; i < checkArray.length; i++) {
|
||||||
@ -197,6 +204,8 @@ function getMatchingPhrase(inputString, targetCharacter) {
|
|||||||
checkString = checkString.replace(/[^a-zA-Z0-9]/g, '');
|
checkString = checkString.replace(/[^a-zA-Z0-9]/g, '');
|
||||||
console.log(checkString);
|
console.log(checkString);
|
||||||
checkLoop(message, checkString);
|
checkLoop(message, checkString);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
Main bot logic. Check for abbreviations by splitting the message at any non-word characters, then if we find a match, create a new array, replace the abbreviation with the phrase, then call replyMessage() and reply to the original message with the corrected one.
|
Main bot logic. Check for abbreviations by splitting the message at any non-word characters, then if we find a match, create a new array, replace the abbreviation with the phrase, then call replyMessage() and reply to the original message with the corrected one.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user