This commit is contained in:
Christopher Cookman 2024-07-19 18:27:12 -06:00
parent c6acb1ea2e
commit e1122f7edd
Signed by: ChrisChrome
GPG key ID: A023A26E42C33A42

View file

@ -342,51 +342,50 @@ app.post("/report/:psk", (req, res) => {
],
"timestamp": new Date(dataFeilds["UTC Timestamp"])
}
],
[
{
type: 1,
components: [
{
type: 2,
style: 1,
label: "Acknowledge",
custom_id: `acknowledge;${row.id}`
},
{
type: 2,
style: 3,
label: "Close (Action Taken)",
custom_id: `action;${row.id}`,
disabled: true
},
{
type: 2,
style: 2,
label: "Close (No Action)",
custom_id: `close;${row.id}`,
disabled: true
},
{
type: 2,
style: 4,
label: "Mark as False Report",
custom_id: `ignore;${row.id}`,
disabled: true
}
]
}
]
}
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(msgData).then(msg => {
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" });
}
msgData.components = [
{
type: 1,
components: [
{
type: 2,
style: 1,
label: "Acknowledge",
custom_id: `acknowledge;${row.id}`
},
{
type: 2,
style: 3,
label: "Close (Action Taken)",
custom_id: `action;${row.id}`,
disabled: true
},
{
type: 2,
style: 2,
label: "Close (No Action)",
custom_id: `close;${row.id}`,
disabled: true
},
{
type: 2,
style: 4,
label: "Mark as False Report",
custom_id: `ignore;${row.id}`,
disabled: true
}
]
}
]
msg.edit(msgData);
});
}); // Always do this just in case db fails
if (err) {