mezoAgent 0.6.5__tar.gz → 0.7.1__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (24) hide show
  1. {mezoagent-0.6.5 → mezoagent-0.7.1}/PKG-INFO +1 -1
  2. {mezoagent-0.6.5 → mezoagent-0.7.1}/mezoAgent.egg-info/PKG-INFO +1 -1
  3. {mezoagent-0.6.5 → mezoagent-0.7.1}/mezoAgent.egg-info/SOURCES.txt +2 -0
  4. {mezoagent-0.6.5 → mezoagent-0.7.1}/mezo_agent/__init__.py +3 -1
  5. mezoagent-0.7.1/mezo_agent/twitter_client.py +80 -0
  6. mezoagent-0.7.1/mezo_agent/twitter_manager.py +0 -0
  7. {mezoagent-0.6.5 → mezoagent-0.7.1}/setup.py +1 -1
  8. {mezoagent-0.6.5 → mezoagent-0.7.1}/MANIFEST.in +0 -0
  9. {mezoagent-0.6.5 → mezoagent-0.7.1}/README.md +0 -0
  10. {mezoagent-0.6.5 → mezoagent-0.7.1}/mezoAgent.egg-info/dependency_links.txt +0 -0
  11. {mezoagent-0.6.5 → mezoagent-0.7.1}/mezoAgent.egg-info/requires.txt +0 -0
  12. {mezoagent-0.6.5 → mezoagent-0.7.1}/mezoAgent.egg-info/top_level.txt +0 -0
  13. {mezoagent-0.6.5 → mezoagent-0.7.1}/mezo_agent/characters.py +0 -0
  14. {mezoagent-0.6.5 → mezoagent-0.7.1}/mezo_agent/chat.py +0 -0
  15. {mezoagent-0.6.5 → mezoagent-0.7.1}/mezo_agent/config.py +0 -0
  16. {mezoagent-0.6.5 → mezoagent-0.7.1}/mezo_agent/data/new_router.json +0 -0
  17. {mezoagent-0.6.5 → mezoagent-0.7.1}/mezo_agent/parsing.py +0 -0
  18. {mezoagent-0.6.5 → mezoagent-0.7.1}/mezo_agent/swap_musd_btc.py +0 -0
  19. {mezoagent-0.6.5 → mezoagent-0.7.1}/mezo_agent/token_balance_tool.py +0 -0
  20. {mezoagent-0.6.5 → mezoagent-0.7.1}/mezo_agent/token_price_tool.py +0 -0
  21. {mezoagent-0.6.5 → mezoagent-0.7.1}/mezo_agent/token_utils.py +0 -0
  22. {mezoagent-0.6.5 → mezoagent-0.7.1}/mezo_agent/transaction.py +0 -0
  23. {mezoagent-0.6.5 → mezoagent-0.7.1}/mezo_agent/utils.py +0 -0
  24. {mezoagent-0.6.5 → mezoagent-0.7.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mezoAgent
3
- Version: 0.6.5
3
+ Version: 0.7.1
4
4
  Summary: A Python package for Mezo Agent transactions with LangChain tools
5
5
  Author: Dreadwulf, Duck, Digi
6
6
  Requires-Dist: python-dotenv
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mezoAgent
3
- Version: 0.6.5
3
+ Version: 0.7.1
4
4
  Summary: A Python package for Mezo Agent transactions with LangChain tools
5
5
  Author: Dreadwulf, Duck, Digi
6
6
  Requires-Dist: python-dotenv
@@ -16,5 +16,7 @@ mezo_agent/token_balance_tool.py
16
16
  mezo_agent/token_price_tool.py
17
17
  mezo_agent/token_utils.py
18
18
  mezo_agent/transaction.py
19
+ mezo_agent/twitter_client.py
20
+ mezo_agent/twitter_manager.py
19
21
  mezo_agent/utils.py
20
22
  mezo_agent/data/new_router.json
@@ -4,7 +4,8 @@ from .chat import mezo_character_chat
4
4
  from .characters import get_character_prompt
5
5
  from .token_balance_tool import mezo_agent_token_balance_tool
6
6
  from .token_price_tool import mezo_agent_token_price_tool
7
- from .token_utils import get_token_address_by_symbol # ✅ Expose new module
7
+ from .token_utils import get_token_address_by_symbol
8
+ from .twitter_manager import TwitterManager
8
9
 
9
10
  __all__ = [
10
11
  "mezo_agent_transaction_btc",
@@ -14,5 +15,6 @@ __all__ = [
14
15
  "mezo_agent_token_balance_tool",
15
16
  "mezo_agent_token_price_tool",
16
17
  "get_token_address_by_symbol",
18
+ "TwitterManager",
17
19
  "get_character_prompt"
18
20
  ]
@@ -0,0 +1,80 @@
1
+ import tweepy
2
+ import time
3
+ import random
4
+ from datetime import datetime, timedelta
5
+ from threading import Thread
6
+ from mezo_agent.config import load_dotenv
7
+ import os
8
+
9
+ # Load environment variables
10
+ load_dotenv()
11
+
12
+ class TwitterClient:
13
+ """
14
+ A modular Twitter client for MezoAgent that allows characters to tweet automatically with personality.
15
+ """
16
+
17
+ def __init__(self, character_name: str, api_key: str, api_secret: str, access_token: str, access_secret: str, personality: str):
18
+ """
19
+ Initializes the Twitter client for a given character.
20
+
21
+ :param character_name: Name of the AI character.
22
+ :param api_key: Twitter API Key.
23
+ :param api_secret: Twitter API Secret Key.
24
+ :param access_token: Twitter Access Token.
25
+ :param access_secret: Twitter Access Token Secret.
26
+ :param personality: Custom personality description for AI-generated tweets.
27
+ """
28
+ self.character_name = character_name
29
+ self.personality = personality # ✅ Store personality
30
+
31
+ # Authenticate with Twitter API
32
+ auth = tweepy.OAuthHandler(api_key, api_secret)
33
+ auth.set_access_token(access_token, access_secret)
34
+ self.api = tweepy.API(auth, wait_on_rate_limit=True)
35
+
36
+ # Schedule tweets
37
+ self.schedule_tweets()
38
+
39
+ def generate_tweet(self) -> str:
40
+ """
41
+ Generates a tweet using AI for the character based on its personality.
42
+ This function can be modified to pull from AI-generated content.
43
+
44
+ :return: A string containing the tweet.
45
+ """
46
+ tweet_templates = [
47
+ f"{self.character_name} - {self.personality}: \"Thinking about the future of DeFi... 🚀\"",
48
+ f"{self.character_name} - {self.personality}: \"GM! Stay bullish today. 🌞\"",
49
+ f"{self.character_name} - {self.personality}: \"On-chain or it didn't happen! ⛓️\"",
50
+ f"{self.character_name} - {self.personality}: \"Stacking sats and stacking wisdom. 💡\"",
51
+ f"{self.character_name} - {self.personality}: \"Wen moon? HODL tight! 🌙\""
52
+ ]
53
+ return random.choice(tweet_templates)
54
+
55
+ def post_tweet(self):
56
+ """
57
+ Posts a tweet for the character.
58
+ """
59
+ try:
60
+ tweet_content = self.generate_tweet()
61
+ self.api.update_status(tweet_content)
62
+ print(f"✅ {self.character_name} tweeted: {tweet_content}")
63
+ except Exception as e:
64
+ print(f"❌ Failed to post tweet for {self.character_name}: {e}")
65
+
66
+ def schedule_tweets(self):
67
+ """
68
+ Schedules tweets to be sent 5 times per 24-hour period.
69
+ Runs in a separate thread to avoid blocking the main agent process.
70
+ """
71
+ def tweet_scheduler():
72
+ while True:
73
+ for _ in range(5): # Post 5 tweets per day
74
+ self.post_tweet()
75
+ sleep_time = (24 * 60 * 60) // 5 # Spread tweets across 24 hours
76
+ print(f"⏳ Next tweet in {sleep_time // 60} minutes...")
77
+ time.sleep(sleep_time)
78
+
79
+ thread = Thread(target=tweet_scheduler, daemon=True)
80
+ thread.start()
File without changes
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="mezoAgent",
5
- version="0.6.5",
5
+ version="0.7.1",
6
6
  packages=find_packages(),
7
7
  include_package_data=True,
8
8
  package_data={
File without changes
File without changes
File without changes
File without changes
File without changes