Files
microdao-daarion/scripts/get-admin-chat-id.py
Apple 0c8bef82f4 feat: Add Alateya, Clan, Eonarch agents + fix gateway-router connection
## Agents Added
- Alateya: R&D, biotech, innovations
- Clan (Spirit): Community spirit agent
- Eonarch: Consciousness evolution agent

## Changes
- docker-compose.node1.yml: Added tokens for all 3 new agents
- gateway-bot/http_api.py: Added configs and webhook endpoints
- gateway-bot/clan_prompt.txt: New prompt file
- gateway-bot/eonarch_prompt.txt: New prompt file

## Fixes
- Fixed ROUTER_URL from :9102 to :8000 (internal container port)
- All 9 Telegram agents now working

## Documentation
- Created PROJECT-MASTER-INDEX.md - single entry point
- Added various status documents and scripts

Tokens configured:
- Helion, NUTRA, Agromatrix (existing)
- Alateya, Clan, Eonarch (new)
- Druid, GreenFood, DAARWIZZ (configured)
2026-01-28 06:40:34 -08:00

99 lines
3.7 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env python3
"""
Отримати chat_id для адмін-сповіщень
Запустити бота і надіслати йому /start від адміна
"""
import os
import sys
import asyncio
import httpx
BOT_TOKEN = os.getenv("ADMIN_TELEGRAM_BOT_TOKEN", "8589292566:AAEmPvS6nY9e-Y-TZm04CAHWlaFnWVxajE4")
async def get_updates():
"""Отримати останні updates від бота"""
url = f"https://api.telegram.org/bot{BOT_TOKEN}/getUpdates"
async with httpx.AsyncClient() as client:
response = await client.get(url)
response.raise_for_status()
data = response.json()
if not data.get("ok"):
print(f"❌ Помилка: {data}")
return
updates = data.get("result", [])
if not updates:
print("⚠️ Немає повідомлень.")
print("\n📱 Щоб отримати chat_id:")
print("1. Знайдіть бота Sofia в Telegram")
print("2. Надішліть йому /start")
print("3. Запустіть цей скрипт знову")
return
print(f"\n✅ Знайдено {len(updates)} повідомлень:\n")
for update in updates[-5:]: # Показати останні 5
message = update.get("message", {})
from_user = message.get("from", {})
chat = message.get("chat", {})
text = message.get("text", "")
chat_id = chat.get("id")
username = from_user.get("username", "")
first_name = from_user.get("first_name", "")
print(f"Chat ID: {chat_id}")
print(f"From: {first_name} (@{username})")
print(f"Message: {text}")
print("-" * 50)
# Показати останній chat_id
last_update = updates[-1]
last_chat_id = last_update.get("message", {}).get("chat", {}).get("id")
print(f"\n✅ Використовуйте цей chat_id: {last_chat_id}")
print(f"\n📝 Команда для оновлення .env:")
print(f"sed -i 's/ADMIN_CHAT_ID=.*/ADMIN_CHAT_ID={last_chat_id}/' /opt/microdao-daarion/.env")
async def send_test_message(chat_id: int):
"""Відправити тестове повідомлення"""
url = f"https://api.telegram.org/bot{BOT_TOKEN}/sendMessage"
message = (
"🤖 *Sofia Monitoring Bot Active*\n\n"
"✅ Система моніторингу підключена!\n"
"Ви будете отримувати алерти при критичних проблемах:\n\n"
"• Порожні Qdrant колекції\n"
"• Втрата даних (>10%)\n"
"• Проблеми з бекапами\n"
"• Критичні помилки сервісів\n\n"
"_Моніторинг запускається кожні 6 годин_"
)
payload = {
"chat_id": chat_id,
"text": message,
"parse_mode": "Markdown"
}
async with httpx.AsyncClient() as client:
response = await client.post(url, json=payload)
response.raise_for_status()
print("✅ Тестове повідомлення надіслано!")
async def main():
"""Головна функція"""
if len(sys.argv) > 1:
# Якщо передано chat_id, відправити тест
chat_id = int(sys.argv[1])
await send_test_message(chat_id)
else:
# Отримати chat_id
await get_updates()
if __name__ == "__main__":
asyncio.run(main())