Thread gates
Thread gates set who can reply to a post.
The available rules are:
- app.bsky.feed.threadgate#mentionRule: Allow replies from actors mentioned in your post.
- app.bsky.feed.threadgate#followingRule: Allow replies from actors you follow.
- app.bsky.feed.threadgate#followerRule: Allow replies from actors following you.
- app.bsky.feed.threadgate#listRule: Allow replies from actors on a list.
A thread gate may have up to 5 rules.
Setting a thread gate
- TypeScript
- Python
You set a thread gate by creating a app.bsky.feed.threadgate record with the same rkey as the post you're gating.
import { currentDatetimeString } from '@atproto/lex'
import { AtUri } from '@atproto/syntax'
import { app } from '@bsky/sdk/lexicons'
const {rkey} = new AtUri(postUri)
await client.create(app.bsky.feed.threadgate, {
post: postUri,
allow: [
// allow mentioned users
{$type: 'app.bsky.feed.threadgate#mentionRule'},
// allow followed users
{$type: 'app.bsky.feed.threadgate#followingRule'},
// allow list members
{$type: 'app.bsky.feed.threadgate#listRule', list: listUri},
],
createdAt: currentDatetimeString()
}, { rkey })
If a thread gate record is present but empty, then nobody can reply.
await client.create(app.bsky.feed.threadgate, {
post: postUri,
// empty allow-list, nobody can reply
allow: [],
createdAt: currentDatetimeString()
}, { rkey })
If a thread gate record is not present, then anybody can reply.
You set a thread gate by creating a app.bsky.feed.threadgate record with the same rkey as the post you're gating.
from atproto import AtUri
rkey = AtUri.from_str(post_uri).rkey
record = models.AppBskyFeedThreadgate.Record(
post=post_uri,
allow=[
# allow mentioned users
models.AppBskyFeedThreadgate.MentionRule(),
# allow followed users
models.AppBskyFeedThreadgate.FollowingRule(),
# allow list members
models.AppBskyFeedThreadgate.ListRule(list=listUri),
],
created_at=client.get_current_time_iso(),
)
client.app.bsky.feed.threadgate.create(client.me.did, record, rkey)
If a thread gate record is present but empty, then nobody can reply.
record = models.AppBskyFeedThreadgate.Record(
post=post_uri,
allow=[], # empty allow-list, nobody can reply
created_at=client.get_current_time_iso(),
)
client.app.bsky.feed.threadgate.create(client.me.did, record, rkey)
If a thread gate record is not present, then anybody can reply.