Advertisement
Guest User

Untitled

a guest
Jul 1st, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.60 KB | None | 0 0
  1. from pyrogram import Client
  2. from pyrogram.api import functions, types
  3. import logging
  4. import time
  5. import random
  6.  
  7. '''logging.basicConfig(
  8.    level=logging.DEBUG,
  9.    format='[%(threadName)s/%(levelname)s, %(asctime)s] %(name)s:%(lineno)d: %(message)s'
  10. )'''
  11.  
  12. def phone_code_callback(phone_number):
  13.     code = input('code :')  # Get your code programmatically
  14.     return code  # e.g., "12345"
  15.  
  16.  
  17. app = Client(
  18.     session_name="85267208984",
  19.     #phone_number="85267208984",
  20.     #phone_code=phone_code_callback,  # Note the missing parentheses
  21.     #first_name="Pyrogram",
  22.     #last_name="",
  23.     api_id="17349",
  24.     api_hash="344583e45741c457fe1862106095a5eb",
  25.     proxy=dict(
  26.         hostname="5.188.143.176",
  27.         port=3001,
  28.         username="DGnRDP",
  29.         password="PbePbBEP0mI"
  30.     )
  31. )
  32.  
  33. app.start()
  34.  
  35. print(app.get_me())
  36. test = app.send(functions.messages.CheckChatInvite('JA5tAUn3oys5ZJkSJ2Befw'))
  37. print(test)
  38. id = test.chat.id
  39. try:
  40.     chat = app.join_chat('https://t.me/joinchat/JA5tAUn3oys5ZJkSJ2Befw')
  41. except Exception as e:
  42.     print(str(e))
  43. user = [line.rstrip('\n') for line in open('base.txt', encoding="utf-8-sig")]
  44. while True:
  45.     s = []
  46.     for i in range(50):
  47.         print('work '+str(i))
  48.         time.sleep(random.randint(1,3))
  49.         try:
  50.             a = user[i]
  51.             u = app.resolve_peer(a)
  52.             app.send(functions.messages.AddChatUser(id,u,100))
  53.             s.append(u)
  54.             user.remove(a)
  55.         except Exception as e:
  56.             user.remove(a)
  57.             print(str(e))
  58.     time.sleep(random.randint(3,5))
  59. print(update)
  60.  
  61. app.stop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement