freeall / create-repository

Automatically creates and sets up a new github repository
MIT License
77 stars 189 forks source link

Sss #428

Open ssaaoo11 opened 2 hours ago

ssaaoo11 commented 2 hours ago

Nooo

ssaaoo11 commented 2 hours ago

import telebot import re import urllib.request

‎# استبدل 'Sappoxj_bot' بالتوكن الخاص ببوتك bot = telebot.TeleBot('YOUR_BOT_TOKEN')

@bot.message_handler(commands=['start']) def start(message): bot.reply_to(message, "• Add user the boy .")

@bot.message_handler(func=lambda message: True) def get_user_info(message): if message.text: username = message.text.replace("@", "") url = f"https://t.me/{username}" try: with urllib.request.urlopen(url) as response: html = response.read().decode('utf-8') name = re.findall('

(.)', html) description = re.findall('
(.)
', html) photo = re.findall('tgme_page_photo_image" src="(.*)">', html) if name and description: caption = f"• Name : {name[0]}\n" \ f"• Description : {description[0]}\n" \ f"• UserName : {username}\n" if photo: bot.send_photo(chat_id=message.chat.id, photo=photo[0], caption=caption) else: bot.reply_to(message, f"{caption}\n• Profile picture not found .") else: bot.reply_to(message, "• Unable to extract user information .") except Exception as e: bot.reply_to(message, "• Error fetching user information .") bot.polling()