@elizaos/plugin-twitter 1.2.17 → 1.2.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +13 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9096,9 +9096,19 @@ var postTweetAction = {
|
|
|
9096
9096
|
handler: async (runtime, message, state, _options, callback) => {
|
|
9097
9097
|
logger10.info("Executing POST_TWEET action");
|
|
9098
9098
|
try {
|
|
9099
|
-
const
|
|
9100
|
-
if (!
|
|
9101
|
-
|
|
9099
|
+
const twitterService = runtime.getService("twitter");
|
|
9100
|
+
if (!twitterService) {
|
|
9101
|
+
throw new Error("Twitter service not available");
|
|
9102
|
+
}
|
|
9103
|
+
const twitterClient = twitterService.twitterClient;
|
|
9104
|
+
if (!twitterClient || !twitterClient.client) {
|
|
9105
|
+
throw new Error("Twitter client not initialized in service");
|
|
9106
|
+
}
|
|
9107
|
+
const client = twitterClient.client;
|
|
9108
|
+
if (!client.profile) {
|
|
9109
|
+
throw new Error(
|
|
9110
|
+
"Twitter client not properly initialized - no profile found"
|
|
9111
|
+
);
|
|
9102
9112
|
}
|
|
9103
9113
|
let text = message.content?.text?.trim();
|
|
9104
9114
|
if (!text) {
|
|
@@ -9125,11 +9135,6 @@ var postTweetAction = {
|
|
|
9125
9135
|
text = truncated.trim() || text.substring(0, 277) + "...";
|
|
9126
9136
|
logger10.info(`Truncated tweet: ${text}`);
|
|
9127
9137
|
}
|
|
9128
|
-
if (!client.profile) {
|
|
9129
|
-
throw new Error(
|
|
9130
|
-
"Twitter client not properly initialized - no profile found"
|
|
9131
|
-
);
|
|
9132
|
-
}
|
|
9133
9138
|
let finalTweetText = text;
|
|
9134
9139
|
if (text.length < 50 || text.toLowerCase().includes("post") || text.toLowerCase().includes("tweet")) {
|
|
9135
9140
|
const tweetPrompt = `You are ${runtime.character.name}.
|