Advertisement
Guest User

Untitled

a guest
Jun 29th, 2018
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.38 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. print(test)
  36. id = test.chat.id
  37. try:
  38.     chat = app.join_chat('https://t.me/joinchat/JA5tAQ5_tOp03a101D7f6Q')
  39. except Exception as e:
  40.     print(str(e))
  41. user = [line.rstrip('\n') for line in open('base.txt', encoding="utf-8-sig")]
  42. s = []
  43. for i in range(5):
  44.     a = user[i]
  45.     u = app.resolve_peer(a)
  46.     s.append(u)
  47.     user.remove(a)
  48. update = app.send(
  49.     functions.channels.InviteToChannel(
  50.         channel=id,  # ID or Username
  51.         users=s
  52.     )
  53. )
  54. print(update)
  55.  
  56. app.stop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement