Conditionally set chat declaration
This commit is contained in:
@@ -154,15 +154,18 @@ export async function createAgentAndCreateAccount(
|
||||
id: TID.nextStr(),
|
||||
},
|
||||
])
|
||||
await agent.api.com.atproto.repo.putRecord({
|
||||
repo: account.did,
|
||||
collection: 'chat.bsky.actor.declaration',
|
||||
rkey: 'self',
|
||||
record: {
|
||||
$type: 'chat.bsky.actor.declaration',
|
||||
allowIncoming: getAge(birthDate) < 18 ? 'none' : 'following',
|
||||
},
|
||||
})
|
||||
|
||||
if (getAge(birthDate) < 18) {
|
||||
await agent.api.com.atproto.repo.putRecord({
|
||||
repo: account.did,
|
||||
collection: 'chat.bsky.actor.declaration',
|
||||
rkey: 'self',
|
||||
record: {
|
||||
$type: 'chat.bsky.actor.declaration',
|
||||
allowIncoming: 'none',
|
||||
},
|
||||
})
|
||||
}
|
||||
})
|
||||
} catch (e: any) {
|
||||
logger.error(e, {
|
||||
|
||||
Reference in New Issue
Block a user