Correct spam bug
This commit is contained in:
parent
43b1e84409
commit
404c976a7d
11
main.ts
11
main.ts
@ -104,10 +104,12 @@ client.on('messageCreate', message => {
|
||||
var matchMessageArray = message.content.toLowerCase().split(/[ ,!@#$%^&*()]+/);
|
||||
|
||||
console.log(matchMessageArray);
|
||||
var correctedMessage = message.content;
|
||||
|
||||
let correctedMessage = message.content;
|
||||
let matchDetected = false;
|
||||
for (let i = 0; i < matchMessageArray.length; ++i) {
|
||||
console.log("Corrected Message: " + correctedMessage);
|
||||
if (abbreviationKey.target_phrases[matchMessageArray[i]] !== undefined) {
|
||||
matchDetected = true;
|
||||
//Return key
|
||||
var phrase = abbreviationKey.target_phrases[matchMessageArray[i]];
|
||||
var abbr = matchAbbr(phrase); //abbreviationKey.target_phrases[phrase];
|
||||
@ -136,6 +138,9 @@ client.on('messageCreate', message => {
|
||||
//break;
|
||||
}
|
||||
}
|
||||
replyMessage(message, correctedMessage);
|
||||
if (matchDetected) {
|
||||
replyMessage(message, correctedMessage);
|
||||
}
|
||||
|
||||
}
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user