10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/tempest/commands/follow.rb', line 10
def call(argv:, session:, client:, stdout:, stderr:)
handle = argv.first&.sub(/\A@/, "")
if handle.nil? || handle.empty?
stderr.puts "usage: tempest follow <handle>"
return 64
end
did = Tempest::HandleLookup.resolve(handle, client: client)
client.post(
"com.atproto.repo.createRecord",
body: {
"repo" => session.did,
"collection" => "app.bsky.graph.follow",
"record" => {
"$type" => "app.bsky.graph.follow",
"subject" => did,
"createdAt" => Time.now.utc.iso8601,
},
},
)
stdout.puts "Followed @#{handle}"
0
end
|