First working build™️

master
Chloe Fontenot 🏳️‍⚧️ 2023-03-31 13:20:24 +07:00
parent 233bdbf8e7
commit 7b3f6af93f
1 changed files with 12 additions and 10 deletions

@ -71,9 +71,9 @@ var abbreviationKey = require("./abbreviation_key.json");
function arrayRotate(arr, reverse, amount) { function arrayRotate(arr, reverse, amount) {
for (var i = 0; i < amount; i++) { for (var i = 0; i < amount; i++) {
if (reverse) arr.unshift(arr.pop()); if (reverse) arr.unshift(arr.pop());
else arr.push(arr.shift()); else arr.push(arr.shift());
return arr; return arr;
} }
} }
@ -81,15 +81,15 @@ function matchAbbr(abbrTarget) {
console.log("Looking for: " + abbrTarget); console.log("Looking for: " + abbrTarget);
for (var abbr in abbreviationKey.target_phrases) { for (var abbr in abbreviationKey.target_phrases) {
if (abbreviationKey.target_phrases[abbr] == abbrTarget) { if (abbreviationKey.target_phrases[abbr] == abbrTarget) {
console.log("abbrTarget:" + typeof(abbrTarget)); console.log("abbrTarget: " + typeof (abbrTarget));
console.log("abbr: " + typeof(abbr)); console.log("abbr: " + typeof (abbr));
return abbr; return abbr;
} else { } else {
console.log("abbrTarget:" + typeof(abbrTarget)); console.log("abbrTarget: " + typeof (abbrTarget));
console.log("abbr: " + typeof(abbr)); console.log("abbr: " + typeof (abbr));
return "";
} }
} }
return "";
} }
function replyMessage(message, correctedMessage) { function replyMessage(message, correctedMessage) {
@ -109,7 +109,9 @@ client.on('messageCreate', message => {
if (abbreviationKey.target_phrases[matchMessageArray[i]] !== undefined) { if (abbreviationKey.target_phrases[matchMessageArray[i]] !== undefined) {
//Return key //Return key
var phrase = abbreviationKey.target_phrases[matchMessageArray[i]]; var phrase = abbreviationKey.target_phrases[matchMessageArray[i]];
var abbr = matchAbbr(phrase);
var abbr = matchAbbr(phrase); //abbreviationKey.target_phrases[phrase];
console.log(typeof(abbr));
console.log("Found abbreviation: " + abbr); console.log("Found abbreviation: " + abbr);
console.log("Phrase that matches used acronym: " + phrase); console.log("Phrase that matches used acronym: " + phrase);