2023-08-12 09:43:37 +00:00
|
|
|
import logger from "../logger.mjs"
|
2023-08-12 10:05:24 +00:00
|
|
|
import getAcceptablePrompts from "../database-calls/getAcceptablePrompts.mjs"
|
2023-08-12 09:43:37 +00:00
|
|
|
import { checkSpelling } from "spellchecker"
|
|
|
|
|
|
|
|
export default async function (note) {
|
|
|
|
const childLogger = logger.child({note})
|
|
|
|
childLogger.trace("receiveMention called")
|
|
|
|
const textArray = note.text
|
|
|
|
.replace(/@[a-z,A-Z,0-9]* /g, "")
|
|
|
|
.trim()
|
|
|
|
.match(/[a-z]*/ig)
|
|
|
|
if(textArray.length===1){
|
|
|
|
const word = textArray[0]
|
|
|
|
if(checkSpelling(word)){
|
|
|
|
if(await getAcceptablePrompts().indexOf(word)!=-1){
|
2023-08-12 10:05:24 +00:00
|
|
|
if(/*wordIsAlreadyInBuffer*/true){
|
|
|
|
|
|
|
|
}
|
2023-08-12 09:43:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//ETC
|
|
|
|
}else if(textArray.length>1){
|
|
|
|
//"Please reply with one word, I'm only a bot etc etc"
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|