Advertisement
Guest User

Untitled

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