Modir19 commited on
Commit
aa9da69
Β·
verified Β·
1 Parent(s): 1eab576

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +85 -0
app.py ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os, asyncio, requests
2
+ from groq import Groq
3
+ from telegram import Update, InlineKeyboardButton, InlineKeyboardMarkup
4
+ from telegram.ext import Application, MessageHandler, filters, ContextTypes
5
+
6
+ # --- SOVEREIGN CONFIGURATION ---
7
+ GROQ_KEY = "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"
8
+ TELEGRAM_TOKEN = "8503693788:AAE8XujCgN3tD-R88P1f_KMHZEUuUgarkZs"
9
+ HELIUS_KEY = "6c65e97f-0718-4837-88d6-80558b54ef0c"
10
+ USER_CHAT_ID = None
11
+
12
+ ai_client = Groq(api_key=GROQ_KEY)
13
+
14
+ # Initial Targets (Top Profit Wallets)
15
+ TARGETS = [
16
+ "77A8X8H5VnL8P8vR9JmE2G5uK9sWp9G",
17
+ "DfMxL6kQ2nZ8vR9JmE2G5uK9sWp9G1a"
18
+ ]
19
+ LAST_TX = {target: None for target in TARGETS}
20
+
21
+ async def get_ai_insight(description):
22
+ """AI Brain: Real-time trade strategy analysis"""
23
+ try:
24
+ chat = ai_client.chat.completions.create(
25
+ model="llama-3.3-70b-versatile",
26
+ messages=[
27
+ {"role": "system", "content": "You are an elite crypto analyst. Explain the strategy of this Solana trade in one short sentence."},
28
+ {"role": "user", "content": description}
29
+ ]
30
+ )
31
+ return chat.choices[0].message.content
32
+ except: return "AI Analysis Offline."
33
+
34
+ async def surveillance_loop(context: ContextTypes.DEFAULT_TYPE):
35
+ """24/7 Whale Tracking Engine"""
36
+ global USER_CHAT_ID
37
+ if not USER_CHAT_ID: return
38
+
39
+ for wallet in TARGETS:
40
+ url = f"https://api.helius.xyz/v0/addresses/{wallet}/transactions?api-key={HELIUS_KEY}"
41
+ try:
42
+ res = requests.get(url).json()
43
+ if not res or res[0].get('signature') == LAST_TX[wallet]: continue
44
+
45
+ LAST_TX[wallet] = res[0].get('signature')
46
+ desc = res[0].get('description', 'New Chain Activity')
47
+ ai_intel = await get_ai_insight(desc)
48
+
49
+ alert = (
50
+ f"🚨 **SHADOW ALERT: WHALE DETECTED**\n"
51
+ f"━━━━━━━━━━━━━━━━━━\n"
52
+ f"🎯 **TARGET:** `{wallet[:10]}...`\n"
53
+ f"πŸ“Š **ACTIVITY:** {desc}\n"
54
+ f"🧠 **AI INTEL:** _{ai_intel}_\n"
55
+ f"━━━━━━━━━━━━━━━━━━\n"
56
+ f"⚑️ [OPEN ON SOLSCAN](https://solscan.io/tx/{LAST_TX[wallet]})"
57
+ )
58
+ await context.bot.send_message(chat_id=USER_CHAT_ID, text=alert, parse_mode='Markdown')
59
+ except: continue
60
+
61
+ async def activate_system(update: Update, context: ContextTypes.DEFAULT_TYPE):
62
+ """Initial handshake to capture Chat ID"""
63
+ global USER_CHAT_ID
64
+ USER_CHAT_ID = update.effective_chat.id
65
+ await update.message.reply_text(
66
+ "πŸ›‘ **SHADOW PROTOCOL ACTIVATED**\n"
67
+ "Link established with Chat ID. Monitoring the void..."
68
+ )
69
+
70
+ async def run_sovereign():
71
+ app = Application.builder().token(TELEGRAM_TOKEN).build()
72
+
73
+ # Auto-check every 30 seconds
74
+ if app.job_queue:
75
+ app.job_queue.run_repeating(surveillance_loop, interval=30, first=5)
76
+
77
+ app.add_handler(MessageHandler(filters.TEXT & ~filters.COMMAND, activate_system))
78
+
79
+ async with app:
80
+ await app.initialize()
81
+ await app.start_polling()
82
+ await asyncio.Event().wait()
83
+
84
+ if __name__ == '__main__':
85
+ asyncio.run(run_sovereign())