From 473b33ff59adca8e564a46049fe57de7c2e82caf Mon Sep 17 00:00:00 2001 From: Xe Iaso Date: Mon, 24 Apr 2023 17:02:12 -0400 Subject: [PATCH] the bot can fart Signed-off-by: Xe Iaso --- package-lock.json | 12 ++++++------ package.json | 2 +- src/index.ts | 22 +++++++++++++++++++++- tsconfig.json | 7 ++++--- 4 files changed, 32 insertions(+), 11 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2fc7a72..1142812 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,7 +7,7 @@ "": { "name": "@cadey/yasomi", "version": "0.0.1", - "license": "SEE LICENSE IN LICENSE", + "license": "MIT", "dependencies": { "@atproto/api": "^0.2.8", "commander": "^10.0.0", @@ -21,7 +21,7 @@ "lint-staged": "^13.2.1", "mocha": "^10.2.0", "prettier": "2.8.7", - "typescript": "^5.0.4" + "typescript": "^4.9.5" } }, "node_modules/@atproto/api": { @@ -2093,16 +2093,16 @@ } }, "node_modules/typescript": { - "version": "5.0.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz", - "integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==", + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", "dev": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" }, "engines": { - "node": ">=12.20" + "node": ">=4.2.0" } }, "node_modules/uint8arrays": { diff --git a/package.json b/package.json index 9af0108..ad8ad95 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "lint-staged": "^13.2.1", "mocha": "^10.2.0", "prettier": "2.8.7", - "typescript": "^5.0.4" + "typescript": "^4.9.5" }, "dependencies": { "@atproto/api": "^0.2.8", diff --git a/src/index.ts b/src/index.ts index 563633e..b5d31dc 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,24 @@ -import { } from "@atproto/api"; import * as dotenv from "dotenv"; +import bsky from "@atproto/api"; +const { BskyAgent, RichText } = bsky; + dotenv.config(); + +const agent = new BskyAgent({ + service: process.env.BLUESKY_ENDPOINT as string, +}); +await agent.login({ + identifier: process.env.BLUESKY_EMAIL as string, + password: process.env.BLUESKY_PASSWORD as string, +}); + +const rt = new RichText({ text: "Hello Bluesky!" }); +await rt.detectFacets(agent); +const postRecord = { + $type: "app.bsky.feed.post", + text: rt.text, + facets: rt.facets, + createdAt: new Date().toISOString(), +}; +await agent.post(postRecord); diff --git a/tsconfig.json b/tsconfig.json index 0a3b2f2..2bc2282 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,13 +3,14 @@ "compilerOptions": { "esModuleInterop": true, "lib": ["es2020", "es2022", "dom"], - "module": "es2022", + "module": "esnext", "preserveConstEnums": true, - "moduleResolution": "node", + "moduleResolution": "node16", "strict": true, "sourceMap": true, - "target": "es2022", + "target": "esnext", "types": ["node"], + "skipLibCheck": true, "outDir": "dist" }, "include": ["src/**/*", "tests/**/*", "types/**/*"],