calfred2808

fbchat #Python

Jul 17th, 2020
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.44 KB | None | 0 0
  1. import fbchat
  2. from fbchat import Client
  3. from getpass import getpass
  4. username = "youremail@mail.com"
  5.  
  6.  
  7. client = fbchat.Client(username,getpass())
  8. no_of_friends = int(input("Number of friends: "))
  9.  
  10. for i in range(no_of_friends):
  11.             name = str(input("Name: "))
  12.             friends = client.SearchForUsers(name)
  13.             friend = friends[0]
  14.             msg = str(input("Message: "))
  15.             sent = client.send(fbchat.models.Message(msg),friend.uid)
  16.             if sent:
  17.                 print("Message Sent!")
Add Comment
Please, Sign In to add comment