From e41a25fa17a5201e0ca4e4da5d45845c72ff3773 Mon Sep 17 00:00:00 2001 From: Daniel Holmgren Date: Mon, 8 Jan 2024 17:49:31 -0600 Subject: [PATCH] Automod: create reports using emitModerationAction (#2025) * create reports using emitModerationAction * fix input * dont build --- packages/bsky/src/auto-moderator/index.ts | 25 +++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/packages/bsky/src/auto-moderator/index.ts b/packages/bsky/src/auto-moderator/index.ts index dc246f0a3d4..48a14ca8f3d 100644 --- a/packages/bsky/src/auto-moderator/index.ts +++ b/packages/bsky/src/auto-moderator/index.ts @@ -139,11 +139,17 @@ export class AutoModerator { uri: subject.uri.toString(), cid: subject.cid.toString(), } - await this.pushAgent.api.com.atproto.moderation.createReport({ - reasonType: REASONOTHER, - reason: `Automatically flagged for possible slurs: ${matches.join(', ')}`, + + await this.pushAgent.api.com.atproto.admin.emitModerationEvent({ + event: { + $type: 'com.atproto.admin.defs#modEventReport', + comment: `Automatically flagged for possible slurs: ${matches.join( + ', ', + )}`, + reportType: REASONOTHER, + }, subject: formattedSubject, - reportedBy: this.ctx.cfg.serverDid, + createdBy: this.ctx.cfg.serverDid, }) } @@ -198,15 +204,18 @@ export class AutoModerator { 'hard takedown of record (and blobs) based on auto-matching', ) - await this.pushAgent.com.atproto.moderation.createReport({ - reportedBy: this.ctx.cfg.serverDid, - reasonType: REASONVIOLATION, + await this.pushAgent.api.com.atproto.admin.emitModerationEvent({ + event: { + $type: 'com.atproto.admin.defs#modEventReport', + comment: reportReason, + reportType: REASONVIOLATION, + }, subject: { $type: 'com.atproto.repo.strongRef', uri: uri.toString(), cid: recordCid.toString(), }, - reason: reportReason, + createdBy: this.ctx.cfg.serverDid, }) await this.pushAgent.com.atproto.admin.emitModerationEvent({