forked from the-vishal/Fb_Automated_Birthday_Wisher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBackground.py
40 lines (30 loc) · 1.03 KB
/
Background.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#Automatic Birthday wisher on facebook background version i.e
# not showing window and gui to user.
#One time set up, Paste it into Startup folder.
import re
from fbchat import Client
from fbchat.models import *
import datetime
now= datetime.datetime.now()
k=now.strftime("%d-%m")
file = open("Database.txt", 'r')
cont = file.read()
if k in cont:
patt1=r"([\w]+) ([\w]+):"+k
mat=re.search(patt1,cont)
#print(mat.group())
patt=r"([\w]+) ([\w]+)"
match = re.search(patt,mat.group())
if match:
#print(match.group())
name=match.group()
#print("Match Found")
client = Client('USERNAME', 'PASSWORD')
users = client.searchForUsers(name)
user = users[0]
#print("User's ID: {}".format(user.uid))
# client.sendMessage('Happy Birthday '+name,thread_id=user.uid,thread_type=ThreadType.USER)
client.sendLocalImage("cake.jpg", 'Happy Birthday' + name, thread_id=user.uid, thread_type=ThreadType.USER)
#print("Message sent")
else:
pass