Skip to content

Commit

Permalink
use DEFAULT_MAX_TWEET_LENGTH
Browse files Browse the repository at this point in the history
  • Loading branch information
oxSaturn committed Dec 10, 2024
1 parent ba06423 commit 055e89c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/client-twitter/src/environment.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { IAgentRuntime } from "@ai16z/eliza";
import { z } from "zod";

const DEFAULT_MAX_TWEET_LENGTH = 280;
export const DEFAULT_MAX_TWEET_LENGTH = 280;

export const twitterEnvSchema = z.object({
TWITTER_DRY_RUN: z
Expand Down
4 changes: 3 additions & 1 deletion packages/client-twitter/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Content, Memory, UUID } from "@ai16z/eliza";
import { stringToUuid } from "@ai16z/eliza";
import { ClientBase } from "./base";
import { elizaLogger } from "@ai16z/eliza";
import { DEFAULT_MAX_TWEET_LENGTH } from "./environment";

export const wait = (minTime: number = 1000, maxTime: number = 3000) => {
const waitTime =
Expand Down Expand Up @@ -170,7 +171,8 @@ export async function sendTweet(
): Promise<Memory[]> {
const tweetChunks = splitTweetContent(
content.text,
Number(client.runtime.getSetting("MAX_TWEET_LENGTH"))
Number(client.runtime.getSetting("MAX_TWEET_LENGTH")) ||
DEFAULT_MAX_TWEET_LENGTH
);
const sentTweets: Tweet[] = [];
let previousTweetId = inReplyTo;
Expand Down

0 comments on commit 055e89c

Please sign in to comment.