Spaces:
Runtime error
Runtime error
Update bot.py
Browse files
bot.py
CHANGED
|
@@ -3,6 +3,21 @@ import asyncio
|
|
| 3 |
import os
|
| 4 |
import re
|
| 5 |
from telethon.network import ConnectionHttp
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
async def main():
|
| 8 |
if not BOT_TOKEN or not API_ID or not API_HASH:
|
|
|
|
| 3 |
import os
|
| 4 |
import re
|
| 5 |
from telethon.network import ConnectionHttp
|
| 6 |
+
from telethon import TelegramClient, events, Button # Re-add imports
|
| 7 |
+
|
| 8 |
+
# --- CONFIGURATION FROM ENV ---
|
| 9 |
+
# Hugging Face Secrets must be set: BOT_TOKEN, ADMIN_ID, API_ID, API_HASH
|
| 10 |
+
BOT_TOKEN = os.environ.get("BOT_TOKEN")
|
| 11 |
+
ADMIN_ID = int(os.environ.get("ADMIN_ID", 0))
|
| 12 |
+
API_ID = int(os.environ.get("API_ID", 0))
|
| 13 |
+
API_HASH = os.environ.get("API_HASH")
|
| 14 |
+
|
| 15 |
+
# Setup Logging
|
| 16 |
+
logging.basicConfig(
|
| 17 |
+
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
|
| 18 |
+
level=logging.INFO
|
| 19 |
+
)
|
| 20 |
+
logger = logging.getLogger("LandingBot")
|
| 21 |
|
| 22 |
async def main():
|
| 23 |
if not BOT_TOKEN or not API_ID or not API_HASH:
|