Repository navigation
Expand file tree
/
Copy pathtelegram_bot.py
More file actions
51 lines (42 loc) · 1.54 KB
/
Copy pathtelegram_bot.py
File metadata and controls
51 lines (42 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import asyncio
import logging
from typing import List
import dotenv
from alphaswarm.agent.agent import AlphaSwarmAgent
from alphaswarm.agent.clients.telegram_bot import TelegramBot
from alphaswarm.config import Config
from alphaswarm.core.tool import AlphaSwarmToolBase
from alphaswarm.tools.alchemy import GetAlchemyPriceHistoryByAddress, GetAlchemyPriceHistoryBySymbol
from alphaswarm.tools.cookie import (
GetCookieMetricsByContract,
GetCookieMetricsBySymbol,
GetCookieMetricsByTwitter,
GetCookieMetricsPaged,
)
from alphaswarm.tools.core import GetTokenAddress, GetUsdPrice
from alphaswarm.tools.exchanges import ExecuteTokenSwap, GetTokenPrice
logging.getLogger("smolagents").setLevel(logging.ERROR)
async def main() -> None:
dotenv.load_dotenv()
config = Config()
tools: List[AlphaSwarmToolBase] = [
GetUsdPrice(),
GetTokenAddress(config),
GetTokenPrice(config),
GetAlchemyPriceHistoryByAddress(),
GetAlchemyPriceHistoryBySymbol(),
GetCookieMetricsByContract(),
GetCookieMetricsBySymbol(),
GetCookieMetricsByTwitter(),
GetCookieMetricsPaged(),
ExecuteTokenSwap(config),
] # Add your tools here
llm_config = config.get_default_llm_config("anthropic")
agent = AlphaSwarmAgent(tools=tools, model_id=llm_config.model_id)
bot_token = config.get("telegram", {}).get("bot_token")
tg_bot = TelegramBot(bot_token=bot_token, agent=agent)
await asyncio.gather(
tg_bot.start(),
)
if __name__ == "__main__":
asyncio.run(main())