@elizaos/plugin-twitter 1.0.0-beta.1 → 1.0.0-beta.12
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/LICENSE +1 -1
- package/dist/index.js +23 -4
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2025 Shaw Walters
|
|
3
|
+
Copyright (c) 2025 Shaw Walters and elizaOS Contributors
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/dist/index.js
CHANGED
|
@@ -8642,7 +8642,15 @@ var TwitterPostClient = class {
|
|
|
8642
8642
|
logger8.info(`[DRY RUN] Would post tweet: ${content.text}`);
|
|
8643
8643
|
return [];
|
|
8644
8644
|
}
|
|
8645
|
+
if (content.text.includes("Error: Missing")) {
|
|
8646
|
+
logger8.error("Error: Missing some context", content);
|
|
8647
|
+
return [];
|
|
8648
|
+
}
|
|
8645
8649
|
const result = await this.postToTwitter(content.text, content.mediaData);
|
|
8650
|
+
if (result === null) {
|
|
8651
|
+
logger8.info("Skipped posting duplicate tweet");
|
|
8652
|
+
return [];
|
|
8653
|
+
}
|
|
8646
8654
|
const tweetId = result.rest_id || result.id_str || result.legacy?.id_str;
|
|
8647
8655
|
if (result) {
|
|
8648
8656
|
const postedTweetId = createUniqueUuid6(this.runtime, tweetId);
|
|
@@ -8668,7 +8676,7 @@ var TwitterPostClient = class {
|
|
|
8668
8676
|
}
|
|
8669
8677
|
return [];
|
|
8670
8678
|
} catch (error) {
|
|
8671
|
-
logger8.error("Error posting tweet:", error);
|
|
8679
|
+
logger8.error("Error posting tweet:", error, content);
|
|
8672
8680
|
return [];
|
|
8673
8681
|
}
|
|
8674
8682
|
};
|
|
@@ -8677,7 +8685,8 @@ var TwitterPostClient = class {
|
|
|
8677
8685
|
callback,
|
|
8678
8686
|
worldId,
|
|
8679
8687
|
userId,
|
|
8680
|
-
roomId
|
|
8688
|
+
roomId,
|
|
8689
|
+
source: "twitter"
|
|
8681
8690
|
});
|
|
8682
8691
|
} catch (error) {
|
|
8683
8692
|
logger8.error("Error generating tweet:", error);
|
|
@@ -8691,6 +8700,16 @@ var TwitterPostClient = class {
|
|
|
8691
8700
|
*/
|
|
8692
8701
|
async postToTwitter(text, mediaData = []) {
|
|
8693
8702
|
try {
|
|
8703
|
+
const lastPost = await this.runtime.getCache(
|
|
8704
|
+
`twitter/${this.client.profile?.username}/lastPost`
|
|
8705
|
+
);
|
|
8706
|
+
if (lastPost) {
|
|
8707
|
+
const lastTweet = await this.client.getTweet(lastPost.id);
|
|
8708
|
+
if (lastTweet && lastTweet.text === text) {
|
|
8709
|
+
logger8.warn("Tweet is a duplicate of the last post. Skipping to avoid duplicate.");
|
|
8710
|
+
return null;
|
|
8711
|
+
}
|
|
8712
|
+
}
|
|
8694
8713
|
const mediaIds = [];
|
|
8695
8714
|
if (mediaData && mediaData.length > 0) {
|
|
8696
8715
|
for (const media of mediaData) {
|
|
@@ -8721,7 +8740,7 @@ var TwitterPostClient = class {
|
|
|
8721
8740
|
|
|
8722
8741
|
// src/tests.ts
|
|
8723
8742
|
import {
|
|
8724
|
-
ModelType as
|
|
8743
|
+
ModelType as ModelType5,
|
|
8725
8744
|
createUniqueUuid as createUniqueUuid7,
|
|
8726
8745
|
logger as logger9,
|
|
8727
8746
|
stringToUuid as stringToUuid2
|
|
@@ -8998,7 +9017,7 @@ var TwitterTestSuite = class {
|
|
|
8998
9017
|
- A lighthearted take on everyday situations.
|
|
8999
9018
|
Do not include hashtags or emojis.`;
|
|
9000
9019
|
}
|
|
9001
|
-
return await runtime.useModel(
|
|
9020
|
+
return await runtime.useModel(ModelType5.TEXT_SMALL, {
|
|
9002
9021
|
prompt
|
|
9003
9022
|
});
|
|
9004
9023
|
}
|