Correct spam bug
This commit is contained in:
parent
459b8865b6
commit
d4a3f2f5e7
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…
Reference in New Issue
Block a user