Esempio n. 1
0
from pyrogram import Client, filters from pyrogram.errors import * from pyrogram.raw.types import InputUser from pyrogram.raw.functions.users import GetFullUser from fancy_text import fancy import random api_hash = "7e9d3275afbd7659a8bdafe87bf26508" api_id = 1332882 ubot = Client("userbot", api_id, api_hash)

prefix = [".", "/", ",", "$", "&", "-"]

@ubot.on_message(filters.command("info", prefixes = prefix) & filters.me) async def get_info(ub, msg): if len(msg.command) > 1: try: user = await ubot.get_users(msg.command[1]) except Exception as e: print(e) if msg.reply_to_message: user = msg.reply_to_message.from_user else: user = await ubot.get_me() else: if msg.reply_to_message: user = msg.reply_to_message.from_user else: user = await ubot.get_me() try: fulluser = await ubot.send(GetFullUser(id = InputUser(user_id = (await ubot.resolve_peer(user.id)).user_id, access_hash = (await ubot.resolve_peer(user.id)).access_hash))) mention = f'{user.first_name}' await msg.edit_text(f'''ℹ️User info 🆔ID: {user.id} 🎗First name: {user.first_name} 🏵Last name: {user.last_name} 🌀Username: {user.username} ✍️Bio: {fulluser.about} 🛑Blocked: {fulluser.blocked} 🤝Common chats count: {fulluser.common_chats_count} 📎Mention: {mention} 🌏Datacenter: {user.dc_id} 🤖Bot: {user.is_bot} ''') except Exception as e: msg.reply(f"Errore: {e}") @ubot.on_message(filters.command("chatid", prefixes = prefix) & filters.me) async def chatid(ub, msg): await msg.edit_text(f"Chat id:\n{msg.chat.id}") @ubot.on_message(filters.command('fancy', prefixes = prefix) & filters.me) async def format(ub, msg): format_list = ["light", "box", "bold", "sorcerer"] if len(msg.command) < 2: if msg.reply_to_message: form = random.choice(format_list) if not msg.media: text = msg.reply_to_message.text else: if message.caption: text = message.caption else: return; else: await msg.edit_text('Stili possibili:\n-Light(𝔈𝔰𝔢𝔪𝔭𝔦𝔬)\n-Bold(𝕰𝖘𝖊𝖒𝖕𝖎𝖔)\n-Box(🅴🆂🅴🅼🅿️🅸🅾️)\n-Sorcerer(ɛֆɛʍքɨօ)') return; elif len(msg.command) < 3: if msg.command[1].lower() in format_list: form = msg.command[1].lower() if msg.reply_to_message: if not msg.media: text = msg.reply_to_message.text else: if message.caption: text = message.caption else: return; else: form = random.choice(format_list) text = msg.command[1] else: form = random.choice(format_list) text = msg.command[1] else: if msg.command[1].lower() in format_list: form = msg.command[1].lower() text = " ".join(msg.command[2::]) else: form = random.choice(format_list) text = " ".join(msg.command[1::]) if form == "light": fancytext = fancy.light(text) if form == "box": fancytext = fancy.box(text) if form == "bold": fancytext = fancy.bold(text) if form == "sorcerer": fancytext = fancy.sorcerer(text) await msg.edit_text(f"{fancytext}")

ubot.run()
Esempio n. 2
0
 def __init__(self, client: pyrogram.Client, receive_calls=True):
     self.client = client
     self.incoming_call_handlers = []
     if receive_calls:
         client.add_handler(RawUpdateHandler(self.update_handler), -1)
     client.on_message()
Esempio n. 3
0
        filename = os.path.basename(link)
        dl_path = DOWNLOAD_DIRECTORY
      LOGGER.info(f'Download:{user_id}: {link}')
      sent_message.edit(Messages.DOWNLOADING.format(link))
      result, file_path = download_file(link, dl_path)
      if result == True:
        sent_message.edit(Messages.DOWNLOADED_SUCCESSFULLY.format(os.path.basename(file_path), humanbytes(os.path.getsize(file_path))))
        msg = GoogleDrive(user_id).upload_file(file_path)
        sent_message.edit(msg)
        LOGGER.info(f'Deleteing: {file_path}')
        os.remove(file_path)
      else:
        sent_message.edit(Messages.DOWNLOAD_ERROR.format(file_path, link))


@Client.on_message(filters.private & filters.incoming & (filters.document | filters.audio | filters.video) & CustomFilters.auth_users)
def _telegram_file(client, message):
  user_id = message.from_user.id
  sent_message = message.reply_text('🕵️**Checking File...**', quote=True)
  if message.document:
    file = message.document
  elif message.video:
    file = message.video
  elif message.audio:
    file = message.audio
  sent_message.edit(Messages.DOWNLOAD_TG_FILE.format(file.file_name, humanbytes(file.file_size), file.mime_type))
  LOGGER.info(f'Download:{user_id}: {file.file_id}')
  try:
    file_path = message.download(file_name=DOWNLOAD_DIRECTORY)
    sent_message.edit(Messages.DOWNLOADED_SUCCESSFULLY.format(os.path.basename(file_path), humanbytes(os.path.getsize(file_path))))
    msg = GoogleDrive(user_id).upload_file(file_path, file.mime_type)