Skip to content

Commit

Permalink
create reports using emitModerationAction
Browse files Browse the repository at this point in the history
  • Loading branch information
dholms committed Jan 6, 2024
1 parent de2dbc2 commit c0c282a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build-and-push-bsky-aws.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
push:
branches:
- main
- auto-mod-tweak
env:
REGISTRY: ${{ secrets.AWS_ECR_REGISTRY_USEAST2_PACKAGES_REGISTRY }}
USERNAME: ${{ secrets.AWS_ECR_REGISTRY_USEAST2_PACKAGES_USERNAME }}
Expand Down
25 changes: 17 additions & 8 deletions packages/bsky/src/auto-moderator/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
', ',
)}`,
reasonType: REASONOTHER,
},
subject: formattedSubject,
reportedBy: this.ctx.cfg.serverDid,
createdBy: this.ctx.cfg.serverDid,
})
}

Expand Down Expand Up @@ -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,
reasonType: 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({
Expand Down

0 comments on commit c0c282a

Please sign in to comment.