From 872701f4972db6b03f4ed37fa8e1efacba335ceb Mon Sep 17 00:00:00 2001 From: jin <32600939+madjin@users.noreply.github.com> Date: Sat, 28 Dec 2024 22:17:43 -0500 Subject: [PATCH] docs: Add JSDoc documentation to post.ts --- packages/plugin-twitter/src/actions/post.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/packages/plugin-twitter/src/actions/post.ts b/packages/plugin-twitter/src/actions/post.ts index 6b737921fc..73a591430e 100644 --- a/packages/plugin-twitter/src/actions/post.ts +++ b/packages/plugin-twitter/src/actions/post.ts @@ -13,6 +13,13 @@ import { Scraper } from "agent-twitter-client"; import { tweetTemplate } from "../templates"; import { isTweetContent, TweetSchema } from "../types"; +/** + * Composes a tweet based on a provided memory message and optional state. + * @param {IAgentRuntime} runtime - The agent runtime object. + * @param {Memory} _message - The memory message to compose the tweet from. + * @param {State} [state] - The optional state object. + * @returns {Promise} The composed tweet content. + */ async function composeTweet( runtime: IAgentRuntime, _message: Memory, @@ -60,6 +67,13 @@ async function composeTweet( } } +/** + * Posts a tweet on Twitter using the provided content. + * + * @param {string} content - The content of the tweet to be posted. + * @returns {Promise} - A boolean indicating whether the tweet was successfully posted or not. + */ + async function postTweet(content: string): Promise { try { const scraper = new Scraper();