mezoAgent 0.7.2__tar.gz → 0.7.3__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {mezoagent-0.7.2 → mezoagent-0.7.3}/PKG-INFO +1 -1
- {mezoagent-0.7.2 → mezoagent-0.7.3}/mezoAgent.egg-info/PKG-INFO +1 -1
- {mezoagent-0.7.2 → mezoagent-0.7.3}/mezo_agent/__init__.py +6 -2
- mezoagent-0.7.3/mezo_agent/twitter_manager.py +63 -0
- {mezoagent-0.7.2 → mezoagent-0.7.3}/setup.py +1 -1
- mezoagent-0.7.2/mezo_agent/twitter_manager.py +0 -0
- {mezoagent-0.7.2 → mezoagent-0.7.3}/MANIFEST.in +0 -0
- {mezoagent-0.7.2 → mezoagent-0.7.3}/README.md +0 -0
- {mezoagent-0.7.2 → mezoagent-0.7.3}/mezoAgent.egg-info/SOURCES.txt +0 -0
- {mezoagent-0.7.2 → mezoagent-0.7.3}/mezoAgent.egg-info/dependency_links.txt +0 -0
- {mezoagent-0.7.2 → mezoagent-0.7.3}/mezoAgent.egg-info/requires.txt +0 -0
- {mezoagent-0.7.2 → mezoagent-0.7.3}/mezoAgent.egg-info/top_level.txt +0 -0
- {mezoagent-0.7.2 → mezoagent-0.7.3}/mezo_agent/characters.py +0 -0
- {mezoagent-0.7.2 → mezoagent-0.7.3}/mezo_agent/chat.py +0 -0
- {mezoagent-0.7.2 → mezoagent-0.7.3}/mezo_agent/config.py +0 -0
- {mezoagent-0.7.2 → mezoagent-0.7.3}/mezo_agent/data/new_router.json +0 -0
- {mezoagent-0.7.2 → mezoagent-0.7.3}/mezo_agent/parsing.py +0 -0
- {mezoagent-0.7.2 → mezoagent-0.7.3}/mezo_agent/swap_musd_btc.py +0 -0
- {mezoagent-0.7.2 → mezoagent-0.7.3}/mezo_agent/token_balance_tool.py +0 -0
- {mezoagent-0.7.2 → mezoagent-0.7.3}/mezo_agent/token_price_tool.py +0 -0
- {mezoagent-0.7.2 → mezoagent-0.7.3}/mezo_agent/token_utils.py +0 -0
- {mezoagent-0.7.2 → mezoagent-0.7.3}/mezo_agent/transaction.py +0 -0
- {mezoagent-0.7.2 → mezoagent-0.7.3}/mezo_agent/twitter_client.py +0 -0
- {mezoagent-0.7.2 → mezoagent-0.7.3}/mezo_agent/utils.py +0 -0
- {mezoagent-0.7.2 → mezoagent-0.7.3}/setup.cfg +0 -0
@@ -5,7 +5,11 @@ 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
7
|
from .token_utils import get_token_address_by_symbol
|
8
|
-
|
8
|
+
|
9
|
+
# ✅ Move TwitterManager import inside a function to avoid circular import
|
10
|
+
def get_twitter_manager():
|
11
|
+
from .twitter_manager import TwitterManager
|
12
|
+
return TwitterManager
|
9
13
|
|
10
14
|
__all__ = [
|
11
15
|
"mezo_agent_transaction_btc",
|
@@ -15,6 +19,6 @@ __all__ = [
|
|
15
19
|
"mezo_agent_token_balance_tool",
|
16
20
|
"mezo_agent_token_price_tool",
|
17
21
|
"get_token_address_by_symbol",
|
18
|
-
"
|
22
|
+
"get_twitter_manager",
|
19
23
|
"get_character_prompt"
|
20
24
|
]
|
@@ -0,0 +1,63 @@
|
|
1
|
+
import os
|
2
|
+
import json
|
3
|
+
|
4
|
+
class TwitterManager:
|
5
|
+
"""
|
6
|
+
Manages Twitter clients for MezoAgent characters.
|
7
|
+
"""
|
8
|
+
|
9
|
+
def __init__(self, config_file="twitter_config.json"):
|
10
|
+
"""
|
11
|
+
Initializes the Twitter Manager.
|
12
|
+
|
13
|
+
:param config_file: The JSON file that stores character Twitter credentials.
|
14
|
+
"""
|
15
|
+
self.config_file = config_file
|
16
|
+
self.characters = {}
|
17
|
+
self.load_characters()
|
18
|
+
|
19
|
+
def load_characters(self):
|
20
|
+
"""
|
21
|
+
Loads characters and their Twitter credentials from a JSON config file.
|
22
|
+
"""
|
23
|
+
if os.path.exists(self.config_file):
|
24
|
+
with open(self.config_file, "r") as f:
|
25
|
+
self.characters = json.load(f)
|
26
|
+
|
27
|
+
def save_characters(self):
|
28
|
+
"""
|
29
|
+
Saves character Twitter credentials to a JSON config file.
|
30
|
+
"""
|
31
|
+
with open(self.config_file, "w") as f:
|
32
|
+
json.dump(self.characters, f, indent=4)
|
33
|
+
|
34
|
+
def add_character(self, character_name: str, api_key: str, api_secret: str, access_token: str, access_secret: str, personality: str):
|
35
|
+
"""
|
36
|
+
Registers a character with Twitter API credentials and starts their Twitter client.
|
37
|
+
|
38
|
+
:param character_name: Name of the character.
|
39
|
+
:param api_key: Twitter API Key.
|
40
|
+
:param api_secret: Twitter API Secret Key.
|
41
|
+
:param access_token: Twitter Access Token.
|
42
|
+
:param access_secret: Twitter Access Token Secret.
|
43
|
+
:param personality: Custom personality description for AI-generated tweets.
|
44
|
+
"""
|
45
|
+
from mezo_agent.twitter_client import TwitterClient # ✅ Move import inside the function
|
46
|
+
|
47
|
+
if character_name in self.characters:
|
48
|
+
print(f"❌ Character '{character_name}' already has a Twitter client.")
|
49
|
+
return
|
50
|
+
|
51
|
+
self.characters[character_name] = {
|
52
|
+
"api_key": api_key,
|
53
|
+
"api_secret": api_secret,
|
54
|
+
"access_token": access_token,
|
55
|
+
"access_secret": access_secret,
|
56
|
+
"personality": personality
|
57
|
+
}
|
58
|
+
self.save_characters()
|
59
|
+
print(f"✅ Character '{character_name}' registered for Twitter with personality!")
|
60
|
+
|
61
|
+
# Start the Twitter client with personality
|
62
|
+
TwitterClient(character_name, api_key, api_secret, access_token, access_secret, personality)
|
63
|
+
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|