Ok that was that way for a reason
This commit is contained in:
parent
29851ceb98
commit
51d6671089
23
index.js
23
index.js
|
@ -342,8 +342,17 @@ app.post("/report/:psk", (req, res) => {
|
||||||
],
|
],
|
||||||
"timestamp": new Date(dataFeilds["UTC Timestamp"])
|
"timestamp": new Date(dataFeilds["UTC Timestamp"])
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
components: [
|
}
|
||||||
|
|
||||||
|
db.run('INSERT INTO reports (channel_id, reporter_id, reported_id, reporter_name, reported_name, reason, time_stamp, server_name, server_endpoint, reported_netid, status) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', [channel.id, dataFeilds["Reporter UserID"].replaceAll("`", ""), dataFeilds["Reported UserID"].replaceAll("`", ""), dataFeilds["Reporter Nickname"], dataFeilds["Reported Nickname"], dataFeilds["Reason"], dataFeilds["Timestamp"], dataFeilds["Server Name"], dataFeilds["Server Endpoint"], dataFeilds["Reported NetID"], "unacknowledged"], (err) => {
|
||||||
|
channel.send(newMsgData).then(msg => {
|
||||||
|
db.get('SELECT id FROM reports WHERE channel_id = ? ORDER BY id DESC LIMIT 1', [channel.id], (err, row) => {
|
||||||
|
if (err) {
|
||||||
|
console.error(`${colors.red("[ERROR]")} ${colors.red(`An error occurred while handling a report: ${err}`)}`);
|
||||||
|
return res.status(500).send({ error: "An error occurred while handling the report" });
|
||||||
|
}
|
||||||
|
newMsgData.components = [
|
||||||
{
|
{
|
||||||
type: 1,
|
type: 1,
|
||||||
components: [
|
components: [
|
||||||
|
@ -377,15 +386,7 @@ app.post("/report/:psk", (req, res) => {
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
msg.edit(msgData);
|
||||||
|
|
||||||
db.run('INSERT INTO reports (channel_id, reporter_id, reported_id, reporter_name, reported_name, reason, time_stamp, server_name, server_endpoint, reported_netid, status) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', [channel.id, dataFeilds["Reporter UserID"].replaceAll("`", ""), dataFeilds["Reported UserID"].replaceAll("`", ""), dataFeilds["Reporter Nickname"], dataFeilds["Reported Nickname"], dataFeilds["Reason"], dataFeilds["Timestamp"], dataFeilds["Server Name"], dataFeilds["Server Endpoint"], dataFeilds["Reported NetID"], "unacknowledged"], (err) => {
|
|
||||||
channel.send(newMsgData).then(msg => {
|
|
||||||
db.get('SELECT id FROM reports WHERE channel_id = ? ORDER BY id DESC LIMIT 1', [channel.id], (err, row) => {
|
|
||||||
if (err) {
|
|
||||||
console.error(`${colors.red("[ERROR]")} ${colors.red(`An error occurred while handling a report: ${err}`)}`);
|
|
||||||
return res.status(500).send({ error: "An error occurred while handling the report" });
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}); // Always do this just in case db fails
|
}); // Always do this just in case db fails
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|
Loading…
Reference in a new issue