from telethon import TelegramClient
from telethon.tl.functions.users import GetFullUserRequest
import asyncio
from time import time
async def check_uname(username, client):
try:
temp = await client(GetFullUserRequest(username))
print(f'Username "{username}" is already taken')
return
except ValueError:
print(f'Username "{username}" is free!')
return
async def main():
api_id = # укажи свой
api_hash = # укажи свой
client = TelegramClient('bot', api_id, api_hash)
await client.connect()
while True:
username = input('Telegram username: ')
start = time()
async with client:
await check_uname(username, client)
end = time()
res = end - start
print(f'Time elapsed: {round(res, 2)}')
if __name__ == '__main__':
asyncio.run(main())
дорабатывайте скрипт как вам угодно, фантазируйте)