From d37c883d898f5964f54abc49dc581f6fbbd3c823 Mon Sep 17 00:00:00 2001 From: Mystikfluu Date: Wed, 10 Aug 2022 23:45:57 +0200 Subject: [PATCH] change channel to receiver --- createSchema.sql | 2 +- routes/api/dms/PersonalMessages.js | 4 ++-- routes/api/dms/post.js | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/createSchema.sql b/createSchema.sql index bbaba48..010cbc1 100644 --- a/createSchema.sql +++ b/createSchema.sql @@ -40,7 +40,7 @@ CREATE TABLE `dms` ( `dms_text` varchar(4000) NOT NULL, `dms_time` bigint NOT NULL, `dms_special_text` varchar(100) DEFAULT NULL, - `dms_channel` varchar(100) DEFAULT NULL, + `dms_receiver` varchar(100) DEFAULT NULL, `dms_is_private` tinyint DEFAULT '0', `dms_from_bot` tinyint DEFAULT '0', `dms_reply_id` bigint unsigned DEFAULT NULL, diff --git a/routes/api/dms/PersonalMessages.js b/routes/api/dms/PersonalMessages.js index c62de3c..5f75fec 100644 --- a/routes/api/dms/PersonalMessages.js +++ b/routes/api/dms/PersonalMessages.js @@ -16,8 +16,8 @@ module.exports = { "dms_user_name","dms_text","dms_time","dms_special_text","dms_id","dms_from_bot","dms_reply_id" ] - let sql = `select ${columns.join(",")} from ipost.dms where (dms_channel = ?) order by dms_id desc;` - con.query(sql, [xor(encodeURIComponent(res.locals.username),otherperson)], function (err, result) { + let sql = `select ${columns.join(",")} from ipost.dms where (dms_receiver = ?) order by dms_id desc;` + con.query(sql, [otherperson], function (err, result) { if (err) throw err; res.json(result) }); diff --git a/routes/api/dms/post.js b/routes/api/dms/post.js index b780f90..2065fa3 100644 --- a/routes/api/dms/post.js +++ b/routes/api/dms/post.js @@ -70,8 +70,8 @@ module.exports = { return } - let sql = `insert into ipost.dms (dms_user_name,dms_text,dms_time,dms_channel,dms_from_bot,dms_reply_id) values (?,?,?,?,?,?);` - let values = [encodeURIComponent(res.locals.username),req.body.message,Date.now(),xor(encodeURIComponent(res.locals.username),otherperson),res.locals.isbot,reply_id] + let sql = `insert into ipost.dms (dms_user_name,dms_text,dms_time,dms_receiver,dms_from_bot,dms_reply_id) values (?,?,?,?,?,?);` + let values = [encodeURIComponent(res.locals.username),req.body.message,Date.now(),otherperson,res.locals.isbot,reply_id] con.query(sql, values, function (err, result) { if (err) throw err; // let post_obj = {