import re
import requests
from telebot import TeleBot
TELEGRAM_TOKEN = "YOUR_TELEGRAM_BOT_TOKEN"
CRYPTECH_API_KEY = "YOUR_CRYPTECH_API_KEY"
bot = TeleBot(TELEGRAM_TOKEN)
# Regex pattern for Ethereum / EVM contract addresses
ETH_ADDRESS_REGEX = r"0x[a-fA-F0-9]{40}"
@bot.message_handler(func=lambda message: True)
def handle_group_message(message):
text = message.text or ""
match = re.search(ETH_ADDRESS_REGEX, text)
if not match:
return
contract_address = match.group(0)
bot.reply_to(message, f"🔍 Auditing contract `{contract_address}`...")
try:
response = requests.post(
"https://api.cryptechtoday.com/api/v1/analyze",
headers={
"X-API-Key": CRYPTECH_API_KEY,
"Content-Type": "application/json"
},
json={"address": contract_address, "chain": "ethereum"},
timeout=10
)
if response.status_code != 200:
bot.reply_to(message, f"⚠️ Audit failed with status {response.status_code}.")
return
data = response.json()
raw = data.get("raw_summary", {})
sellability = data.get("sellability", {})
is_honeypot = "🚨 HONEYPOT" if raw.get("is_honeypot") else "✅ SAFE"
score = data.get("total_score", 0)
risk = data.get("risk_label", "UNKNOWN")
max_exit = sellability.get("max_safe_exit_usd", 0)
report = (
f"🛡️ *CrypTech Token Audit: {data.get('symbol', 'UNKNOWN')}*\n"
f"━━━━━━━━━━━━━━━━━━━\n"
f"• *Verdict*: {is_honeypot}\n"
f"• *Safety Score*: {score}/100 ({risk})\n"
f"• *Buy Tax*: {raw.get('buy_tax_pct', 0)}% | *Sell Tax*: {raw.get('sell_tax_pct', 0)}%\n"
f"• *Liquidity*: ${raw.get('liquidity_usd', 0):,.0f}\n"
f"• *Max Safe Exit*: ${max_exit:,.0f}\n"
f"• *LP Locked*: {'YES 🔒' if raw.get('lp_locked') else 'NO ⚠️'}\n"
f"━━━━━━━━━━━━━━━━━━━\n"
f"🔗 [View Live on CrypTech](https://app.cryptechtoday.com)"
)
bot.reply_to(message, report, parse_mode="Markdown", disable_web_page_preview=True)
except Exception as e:
bot.reply_to(message, f"⚠️ Error: {str(e)}")
if __name__ == "__main__":
print("🤖 CrypTech Telegram Bot is running...")
bot.infinity_polling()