-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
37 lines (32 loc) · 804 Bytes
/
main.py
File metadata and controls
37 lines (32 loc) · 804 Bytes
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
from datetime import *
from pytz import *
from telegram import *
from telegram.ext import *
birthdays = {
"26-01":["Jay", "Jack"],
"29-06": ["Jill","John"],
"06-06": ["Sam", "Samantha"]
}
today = datetime.now(timezone('Asia/kolkata'))
today_string = today.strftime("%d-%m")
API_Key = "<BOT API KEY HERE>"
CHAT_ID = "<CHAT ID HERE>"
bot = Bot(API_Key)
updater = Updater(API_Key, use_context=True)
updater.start_polling()
if today_string in birthdays:
message = "Birthday Notification\n"
for i in birthdays[today_string]:
message += i +'\n'
print(message)
bot.send_message(
chat_id = CHAT_ID,
text = message
)
else:
message = "No birthdays today."
bot.send_message(
chat_id = CHAT_ID,
text = message
)
updater.stop()