Skip to content

Explain why auto-deletion didn't take place #129

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/components/starboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,20 +255,25 @@ export default class Starboard extends BotComponent {
);
const max_non_negative = Math.max(...non_negative_reactions.map(([_, count]) => count)); // -inf if |a|=0
let do_delete = true;
let no_delete_reason = null;
if (![this.wheatley.channels.memes.id, this.wheatley.channels.cursed_code.id].includes(message.channel.id)) {
do_delete = false;
no_delete_reason = "not possible in this channel";
}
if (trigger_reaction.count <= max_non_negative) {
do_delete = false;
no_delete_reason = "greater or equal amount of non-negative reactions";
}
if (this.wheatley.is_root(message.author) || message.author.bot) {
do_delete = false;
no_delete_reason = "author is immune from deletions";
}
if (this.deletes_in_last_24h() >= max_deletes_in_24h) {
do_delete = false;
no_delete_reason = "24-hour age threshold exceeded";
this.wheatley.info(">> DELETE IN 24H THRESHOLD EXCEEDED");
}
const action = do_delete ? "Auto-deleting" : "Auto-delete threshold reached";
const action = do_delete ? "Auto-deleting" : `Auto-delete threshold reached, but no deletion (${no_delete_reason}) of`;
M.log(`${action} ${message.url} for ${trigger_reaction.count} ${trigger_reaction.emoji.name} reactions`);
let flag_message: Discord.Message | null = null;
try {
Expand Down
Loading