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