Several improvements to chat pre/post processing
This commit is contained in:
parent
12922658b9
commit
b9283607d6
10 changed files with 217 additions and 71 deletions
|
|
@ -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});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue