Skip to content

Commit

Permalink
More logging and bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dcadenas committed May 2, 2024
1 parent 5f7d1ea commit abdebeb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/lib/duplicationHandling.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ export default class DuplicationHandling {
console.log(`Event ${event.id} already flagged. Skipping`);
return;
}
console.log(
`Event ${event.id} already seen but not flagged. Processing.`
);

// Event was already seen and not flagged but now the user requests manual verification
onlySlack = true;
Expand Down
4 changes: 3 additions & 1 deletion src/lib/nostr.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,13 @@ export default class Nostr {
static async isAlreadyFlagged(id) {
await connectedPromise;
const user = await userPromise;
console.log("Checking if event is already flagged", id);
const event = await ndk.fetchEvent({
"#e": [id],
kinds: [REPORT_KIND],
authors: [user.pubkey],
authors: [user.hexpubkey],
});
console.log(`Event ${id} already flagged:`, !!event);

return !!event;
}
Expand Down
1 change: 1 addition & 0 deletions src/lib/slack.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { WebClient } from "@slack/web-api";
import OPENAI_CATEGORIES from "./openAICategories.js";
import Nostr from "./nostr.js";

if (!process.env.SLACK_TOKEN) {
throw new Error("SLACK_TOKEN environment variable is required");
Expand Down

0 comments on commit abdebeb

Please sign in to comment.