A chill Bluesky bot, with responses powered by Gemini.
at main 1.1 kB view raw
1import { muted_threads } from "../db/schema"; 2import { AtUri } from "@atproto/syntax"; 3import { Type } from "@google/genai"; 4import bot from "../bot"; 5import db from "../db"; 6import z from "zod"; 7 8export const definition = { 9 name: "mute_thread", 10 description: 11 "Mutes a thread permanently, preventing you from further interaction in said thread.", 12 parameters: { 13 type: Type.OBJECT, 14 properties: { 15 uri: { 16 type: Type.STRING, 17 description: "The URI of the thread.", 18 }, 19 }, 20 required: ["uri"], 21 }, 22}; 23 24export const validator = z.object({ 25 uri: z.string(), 26}); 27 28export async function handler(args: z.infer<typeof validator>) { 29 //@ts-ignore: NSID is valid 30 const record = await bot.createRecord("dev.indexx.echo.threadmute", { 31 $type: "dev.indexx.echo.threadmute", 32 uri: args.uri, 33 createdAt: new Date().toISOString(), 34 }); 35 36 await db 37 .insert(muted_threads) 38 .values([ 39 { 40 uri: args.uri, 41 rkey: new AtUri(record.uri).rkey, 42 }, 43 ]); 44 45 return { 46 thread_is_muted: true, 47 }; 48}