Several improvements to chat pre/post processing

This commit is contained in:
rainbow napkin 2024-12-17 20:44:14 -05:00
parent 12922658b9
commit b9283607d6
10 changed files with 217 additions and 71 deletions

View file

@ -20,6 +20,7 @@ const {validationResult, matchedData} = require('express-validator');
//local imports
const {exceptionHandler, errorHandler} = require('../../../utils/loggerUtils');
const emoteModel = require('../../../schemas/emoteSchema');
const linkUtils = require('../../../utils/linkUtils');
module.exports.get = async function(req, res){
try{
@ -39,14 +40,22 @@ module.exports.post = async function(req, res){
//if they're empty
if(validResult.isEmpty()){
/*
const {command} = matchedData(req);
const tokeDB = await tokeCommandModel.findOne({command});
//get matched data
const {name, link} = matchedData(req);
//query for existing emote
const emoteDB = await emoteModel.findOne({name});
if(tokeDB != null){
return errorHandler(res, `Toke command '!${command}' already exists!`);
//if we have one
if(emoteDB != null){
//Throw a shit fit
return errorHandler(res, `Emote '[${name}]' already exists!`);
}
const linkObj = linkUtils.markLink(link);
console.log(linkObj);
/*
//Add the toke
await tokeCommandModel.create({command});