49 lines
1.3 KiB
Python
49 lines
1.3 KiB
Python
# Telegram Temp SMS Bot Checker
|
|
# Проверяет доступность бесплатных номеров в TG ботах
|
|
|
|
import sys
|
|
import asyncio
|
|
from telethon import TelegramClient
|
|
from telethon.errors import SessionPasswordNeededError
|
|
|
|
# Конфиг — свои api_id/api_hash от my.telegram.org
|
|
API_ID = 0 # FILL
|
|
API_HASH = "" # FILL
|
|
|
|
BOTS = [
|
|
"@ReceiveSMSRobot",
|
|
"@SMSPVA_COM_BOT",
|
|
]
|
|
|
|
async def check_bot(client, bot_username):
|
|
"""Проверить, работает ли бот."""
|
|
try:
|
|
entity = await client.get_entity(bot_username)
|
|
# Отправить /start
|
|
await client.send_message(entity, "/start")
|
|
await asyncio.sleep(2)
|
|
# Получить ответ
|
|
messages = await client.get_messages(entity, limit=3)
|
|
for msg in messages:
|
|
if msg.text:
|
|
print(f" {bot_username}: {msg.text[:100]}")
|
|
break
|
|
return True
|
|
except Exception as e:
|
|
print(f" ❌ {bot_username}: {e}")
|
|
return False
|
|
|
|
|
|
async def main():
|
|
client = TelegramClient("temp_sms_checker", API_ID, API_HASH)
|
|
await client.start()
|
|
print(f"✅ Logged in as: {(await client.get_me()).username}\n")
|
|
|
|
for bot in BOTS:
|
|
await check_bot(client, bot)
|
|
|
|
await client.disconnect()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(main()) |