topTrending = deploy(
"tweetTopTrending",
async (req, res, context) => {
const hasSent = (await db.child(contentHash).once("value")).val() !== null;
if (hasSent) return res.send("Already sent");
else {
try {
const response = await postWithImage(
"trendingnotebooks.bsky.social",
context.secrets["BLUESKY_TRENDING_APP_PASSWORD"],
imgBlob,
text
);
await db.child(contentHash).set(true);
return res.send(JSON.stringify(response));
} catch (err) {
return res.status(400).send(err.message);
}
}
},
{
modifiers: ["orchestrator"],
secrets: ["endpointservices_BLUESKY_TRENDING_APP_PASSWORD"]
}
)