Skip to content

Commit 7b609df

Browse files
authored
Merge pull request elizaOS#1323 from oxSaturn/fix/max-tweet-length
fix: use MAX_TWEET_LENGTH from setting
2 parents faf7163 + 6551ac3 commit 7b609df

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

packages/client-twitter/src/post.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { generateTweetActions } from "@ai16z/eliza";
1515
import { IImageDescriptionService, ServiceType } from "@ai16z/eliza";
1616
import { buildConversationThread } from "./utils.ts";
1717
import { twitterMessageHandlerTemplate } from "./interactions.ts";
18+
import { DEFAULT_MAX_TWEET_LENGTH } from "./environment.ts";
1819

1920
const twitterPostTemplate = `
2021
# Areas of Expertise
@@ -58,8 +59,6 @@ Tweet:
5859
5960
# Respond with qualifying action tags only.` + postActionResponseFooter;
6061

61-
const MAX_TWEET_LENGTH = 240;
62-
6362
/**
6463
* Truncate text to fit within the Twitter character limit, ensuring it ends at a complete sentence.
6564
*/
@@ -280,7 +279,7 @@ export class TwitterPostClient {
280279
// Use the helper function to truncate to complete sentence
281280
const content = truncateToCompleteSentence(
282281
cleanedContent,
283-
MAX_TWEET_LENGTH
282+
parseInt(this.runtime.getSetting("MAX_TWEET_LENGTH")) || DEFAULT_MAX_TWEET_LENGTH
284283
);
285284

286285
const removeQuotes = (str: string) =>

0 commit comments

Comments
 (0)