Skip to content

Commit

Permalink
One more job board patch (#302)
Browse files Browse the repository at this point in the history
* Include message deletion in try/catch

* Add more logging details for messages that error, and remove them from the queue
  • Loading branch information
vcarl authored Aug 7, 2023
1 parent 528b694 commit 5998497
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/features/jobs-moderation/job-mod-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,19 +175,24 @@ export const deleteAgedPosts = async () => {
message,
extra: `Originally sent ${format(new Date(message.createdAt), "P p")}`,
});
await message.delete();
jobBoardMessageCache.shift();
console.log(
`[INFO]: deleteAgedPosts() deleted post ${constructDiscordLink(
message,
)}`,
);
} catch (e) {
logger.log(
"[DEBUG]",
`deleteAgedPosts() message '${constructDiscordLink(
message,
)}' not found`,
)}' not found, originally sent by ${
message.author.username
} at ${format(message.createdAt, "P p")}`,
);
jobBoardMessageCache.shift();
}
await message.delete();
jobBoardMessageCache.shift();
console.log(
`[INFO]: deleteAgedPosts() deleted post ${constructDiscordLink(message)}`,
);
}
};

Expand Down

0 comments on commit 5998497

Please sign in to comment.