← Back
"""
AlphaPulse Bot — Configuration & Constants
"""

import os
from telegram import InlineKeyboardButton, InlineKeyboardMarkup

# ─── Main Config ──────────────────────────────────────────────────────────────
CONFIG = {
    'bot_token':         os.environ.get('TELEGRAM_BOT_TOKEN', ''),
    'channel_id':        '@alphapulsexp',
    'openrouter_key':    os.environ.get('OPENROUTER_API_KEY', ''),
    'posting_schedule':  [2, 8, 11, 13, 15, 18, 21, 23],  # Vancouver hours (13 & 23 = extra news slots)
    'enable_polls':      True,
    'poll_frequency':    4,                  # every Nth post is a poll
    'retention_days':    30,
    'health_port':       8090,
    'affiliate_binance': os.environ.get(
        'BINANCE_AFFILIATE_LINK',
        'https://www.binance.com/referral/earn-together/refer2earn-usdc/claim?ref=GRO_28502_B62SR'
    ),
}

AI_RETRY_COUNT = 3
AI_RETRY_DELAY = 5   # seconds between retries

# ─── Affiliate Links (rotated in posts) ─────────────────────────────────────
AFFILIATE_LINKS = [
    {
        'name': 'Binance',
        'url': CONFIG['affiliate_binance'],
        'cta': '💼 Trade on Binance',
        'weight': 0.5,
    },
    {
        'name': 'Bybit',
        'url': os.environ.get('BYBIT_AFFILIATE_LINK', 'https://www.bybit.com/'),
        'cta': '💼 Trade on Bybit',
        'weight': 0.3,
    },
    {
        'name': 'OKX',
        'url': os.environ.get('OKX_AFFILIATE_LINK', 'https://www.okx.com/'),
        'cta': '💼 Trade on OKX',
        'weight': 0.2,
    },
]

# ─── Premium Teasers (shown randomly after data posts) ──────────────────────
PREMIUM_TEASERS = [
    "🔒 Want real-time alerts? Premium coming soon → @alphapulsexp",
    "🔒 Premium: whale alerts, early signals, no noise → soon",
    "🔒 Funding spike detected — premium members get alerts instantly",
    "📊 Full analysis with entry/exit levels — coming to Premium",
    "⚡ Premium members see this data 30 min earlier",
]

# How often to show affiliate (1 = every post, 3 = every 3rd)
AFFILIATE_FREQUENCY = 3
# How often to show premium teaser (1 in N data posts)
PREMIUM_TEASER_FREQUENCY = 5

# ─── RSS Sources (12 total) ──────────────────────────────────────────────────
# TheBlock removed (rss.xml returns 403 on any UA since ~Jun 2026).
RSS_SOURCES = {
    'CoinDesk':       'https://www.coindesk.com/arc/outboundfeeds/rss/',
    'Cointelegraph':  'https://cointelegraph.com/rss',
    'Decrypt':        'https://decrypt.co/feed',
    'BeInCrypto':     'https://beincrypto.com/feed/',
    'BitcoinMag':     'https://bitcoinmagazine.com/.rss/full/',
    'TheDefiant':     'https://thedefiant.io/feed',
    'CryptoSlate':    'https://cryptoslate.com/feed/',
    'Blockworks':     'https://blockworks.co/feed',
    'Bankless':       'https://www.bankless.com/rss/feed',
    'DLNews':         'https://www.dlnews.com/arc/outboundfeeds/rss/',
    'CryptoBriefing': 'https://cryptobriefing.com/feed/',
    'AMBCrypto':      'https://ambcrypto.com/feed/',
}

# ─── Post format weights (11 formats) ────────────────────────────────────────
POST_FORMATS = {
    'hot':         0.13,
    'analysis':    0.15,
    'sarcasm':     0.12,
    'facts':       0.15,
    'signal':      0.10,
    'thread':      0.08,
    'hot_take':    0.05,
    'deep_dive':   0.05,
    'eli5':        0.07,
    'prediction':  0.06,
    'why_matters': 0.04,
}

# ─── Time-based themes ───────────────────────────────────────────────────────
TIME_THEMES = {
    2:  {'emoji': '🌅', 'theme': 'Early Morning'},
    8:  {'emoji': '☕', 'theme': 'Morning Digest'},
    11: {'emoji': '☀️', 'theme': 'Midday Update'},
    13: {'emoji': '🔔', 'theme': 'Afternoon News'},
    15: {'emoji': '📊', 'theme': 'Afternoon Digest'},
    18: {'emoji': '🌆', 'theme': 'Evening Update'},
    21: {'emoji': '🌙', 'theme': 'Night Wrap'},
    23: {'emoji': '🦉', 'theme': 'Late Night'},
}

BASE_HASHTAGS = '#crypto #bitcoin #altcoins #BTC #trading #cryptonews'

# ─── Inline keyboard for news posts ──────────────────────────────────────────
QUICK_ACTIONS_KEYBOARD = InlineKeyboardMarkup([[
    InlineKeyboardButton("📊 Price",    callback_data="cb_price"),
    InlineKeyboardButton("😱 Fear",     callback_data="cb_fear"),
    InlineKeyboardButton("🔥 Trending", callback_data="cb_trending"),
]])

# ─── Smart hashtag keywords ──────────────────────────────────────────────────
TOPIC_TAGS = {
    'defi':        '#DeFi',
    'decentralized finance': '#DeFi',
    'nft':         '#NFT',
    'layer 2':     '#Layer2',
    'layer2':      '#Layer2',
    'l2':          '#Layer2',
    'ethereum':    '#ETH',
    'solana':      '#SOL',
    'binance':     '#BNB',
    'xrp':         '#XRP',
    'ripple':      '#XRP',
    'cardano':     '#ADA',
    'regulation':  '#Regulation',
    'sec':         '#SEC',
    'etf':         '#ETF',
    'hack':        '#SecurityAlert',
    'exploit':     '#SecurityAlert',
    'breach':      '#SecurityAlert',
    'airdrop':     '#Airdrop',
    'staking':     '#Staking',
    'halving':     '#Halving',
    'mining':      '#Mining',
    'ai':          '#AI',
    'artificial intelligence': '#AI',
    'stablecoin':  '#Stablecoin',
    'cbdc':        '#CBDC',
    'web3':        '#Web3',
    'metaverse':   '#Metaverse',
}

# ─── Known tickers ───────────────────────────────────────────────────────────
KNOWN_TICKERS = {
    'btc', 'eth', 'sol', 'bnb', 'xrp', 'ada', 'dot', 'avax',
    'matic', 'link', 'uni', 'atom', 'ltc', 'doge', 'shib',
    'trx', 'near', 'algo', 'xlm', 'icp', 'apt', 'arb', 'op',
    'sui', 'sei', 'inj', 'ton', 'pepe', 'wld', 'rndr',
}

# ─── News type auto-detection ────────────────────────────────────────────────
NEWS_TYPE_SIGNALS = {
    'hot': [
        'breaking', 'hack', 'exploit', 'breach', 'crash', 'surge', 'soars',
        'plunges', 'collapses', 'emergency', 'alert', 'warning', 'ban',
        'arrested', 'shutdown', 'halted',
    ],
    'analysis': [
        'etf', 'regulation', 'sec', 'federal', 'macro', 'inflation',
        'interest rate', 'institutional', 'adoption', 'partnership',
        'upgrade', 'hard fork', 'roadmap', 'report', 'research',
    ],
    'signal': [
        'price target', 'bullish', 'bearish', 'support', 'resistance',
        'all-time high', 'ath', 'bottom', 'top', 'rally', 'correction',
        'dip', 'pump', 'dump', 'prediction', 'forecast',
    ],
    'sarcasm': [
        'meme', 'rug', 'scam', 'celebrity', 'influencer', 'moon',
        'lambo', 'laser eyes', 'diamond hands', 'paper hands',
    ],
    'thread': [
        'everything you need to know', 'explained', 'breakdown',
        'guide', 'how to', 'what is', 'reasons why', 'things to know',
    ],
}

📜 Git History

cb43e70feat: add 3 post formats for content variety (eli5, prediction, why_matters)3 weeks ago
7d70780feat: refresh RSS sources — drop dead TheBlock, add 4 live feeds3 weeks ago
a09f02fchore: initial commit — version control setup5 weeks ago
Show last diff
Loading...