Skip to content

Commit

Permalink
Merge pull request #309 from carolinaisslaying/main
Browse files Browse the repository at this point in the history
Fixes auto syncing for servers
  • Loading branch information
carolinaisslaying authored Feb 15, 2025
2 parents c8b359b + 8f71937 commit b02383d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"type": "module",
"name": "del-website",
"version": "v5.6.17-Release",
"version": "v5.6.18-Release",
"description": "Discord Extreme List, Discord's unbiased list! Official source code for the DEL v5 website!",
"main": "dist/src/app.js",
"directories": {
Expand Down
10 changes: 5 additions & 5 deletions src/Routes/autosync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ router.get("/servers", async (req, res) => {
}
)) as RESTGetAPIInviteResult;
if (invite.guild.id !== server._id)
throw "Invite points to a different server";
if (invite.expires_at) throw "This invite is set to expire";
throw 3350001; // Invite points to a different server
if (invite.expires_at) throw 3350002; // "This invite is set to expire";

await global.db.collection("servers").updateOne(
{ _id: id },
Expand All @@ -218,14 +218,14 @@ router.get("/servers", async (req, res) => {
await serverCache.updateServer(id);
} catch (e) {
console.log(e);
if (e.code != 10006) return; // https://discord.com/developers/docs/topics/opcodes-and-status-codes#json
if (e != 3350001 && e != 3350002 && e.code != 10006) return; // https://discord.com/developers/docs/topics/opcodes-and-status-codes#json
await global.db.collection("servers").deleteOne({ _id: id });
await global.db.collection("audit").insertOne({
type: "REMOVE_SERVER",
executor: "AutoSync",
target: id,
date: Date.now(),
reason: "Failed to autosync server, assuming the invite is invalid.",
reason: "Failed to autosync server, assuming the invite is invalid, for another server, or can expire.",
reasonType: 5
});

Expand All @@ -235,7 +235,7 @@ router.get("/servers", async (req, res) => {
embed.setColor(0x2f3136);
embed.setTitle("Reason");
embed.setDescription(
"Failed to autosync server, assuming the invite is invalid."
"Failed to autosync server, assuming the invite is invalid, for another server, or can expire."
);

await discord.channels.logs.send({
Expand Down

0 comments on commit b02383d

Please sign in to comment.