Skip to content

Commit b9d819e

Browse files
authored
Merge pull request elizaOS#1347 from 0x330a/main
Update farcaster client max cast length
2 parents e15dd54 + 86194df commit b9d819e

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

packages/client-farcaster/src/post.ts

+6-8
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
} from "@ai16z/eliza";
99
import { FarcasterClient } from "./client";
1010
import { formatTimeline, postTemplate } from "./prompts";
11-
import { castUuid } from "./utils";
11+
import {castUuid, MAX_CAST_LENGTH} from "./utils";
1212
import { createCastMemory } from "./memory";
1313
import { sendCast } from "./actions";
1414

@@ -100,22 +100,20 @@ export class FarcasterPostManager {
100100

101101
const slice = newContent.replaceAll(/\\n/g, "\n").trim();
102102

103-
const contentLength = 240;
103+
let content = slice.slice(0, MAX_CAST_LENGTH);
104104

105-
let content = slice.slice(0, contentLength);
106-
107-
// if its bigger than 280, delete the last line
108-
if (content.length > 280) {
105+
// if it's bigger than the max limit, delete the last line
106+
if (content.length > MAX_CAST_LENGTH) {
109107
content = content.slice(0, content.lastIndexOf("\n"));
110108
}
111109

112-
if (content.length > contentLength) {
110+
if (content.length > MAX_CAST_LENGTH) {
113111
// slice at the last period
114112
content = content.slice(0, content.lastIndexOf("."));
115113
}
116114

117115
// if it's still too long, get the period before the last period
118-
if (content.length > contentLength) {
116+
if (content.length > MAX_CAST_LENGTH) {
119117
content = content.slice(0, content.lastIndexOf("."));
120118
}
121119

packages/client-farcaster/src/utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { stringToUuid } from "@ai16z/eliza";
22

3-
const MAX_CAST_LENGTH = 280; // Updated to Twitter's current character limit
3+
export const MAX_CAST_LENGTH = 1024; // Updated to Twitter's current character limit
44

55
export function castId({ hash, agentId }: { hash: string; agentId: string }) {
66
return `${hash}-${agentId}`;

0 commit comments

Comments
 (0)