Created
December 25, 2018 16:41
-
-
Save skilldeliver/30b178c1f9d07105bfc72790765107f2 to your computer and use it in GitHub Desktop.
Send message to all facebook friends
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Special for the SoftUni python group | |
# Python 3.5 / 3.6 required | |
# fbchat required | |
from fbchat import Client | |
from fbchat.models import * | |
from getpass import getpass | |
client = Client('[email protected]', getpass()) | |
users = client.fetchAllUsers() | |
for user in users: | |
try: | |
if user.uid != 0 and user.is_friend: | |
mess = Message(text="%s, весели празници!" % (user.first_name)) | |
client.send(mess, thread_id=user.uid, thread_type=ThreadType.USER) | |
except Exception as e: | |
try: | |
print('Not sent to %s' % (user.first_name)) | |
except: | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment