-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
76 lines (55 loc) · 1.61 KB
/
main.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
## main.py
## Gather infos from API's and send them to Slack via a Bot.
## Created by Maxime Princelle (https://contact.princelle.org)
## ------
import os
import requests
import random
import grandPere
import hibiki
import kebab
import msgs
import pipio
import ptitCafe
import houblo
from dotenv import load_dotenv
load_dotenv()
# To Get Google Place ID :
# Go to : https://developers.google.com/places/web-service/place-id
slackURL = "https://hooks.slack.com/services/" + os.getenv('SLACK_URL_TOKEN')
## Functions Send
def sendMsg(msg):
dataPOST = {'text': msg}
req = requests.post(slackURL, json=dataPOST)
# print(req.status_code)
def sendAttachment(msg):
dataPOST = {'attachments': msg}
req = requests.post(slackURL, json=dataPOST)
# print(req.status_code)
## Menus
print("Getting Menu from : P'tit Cafe")
ptitCafeMenu = ptitCafe.getLastMenu()
print("Getting Menu from : La Houblonnière")
houbloMenu = houblo.getLastMenu()
print("Getting Menu from : Grand Pere")
grandPereMenu = grandPere.getLastMenu()
print("Getting Menu from : Chez Victor")
kebabMenu = kebab.getLastMenu()
print("Getting Menu from : Chez Pipio")
pipioMenu = pipio.getLastMenu()
# print("Getting Menu from : Japonais HiBiKi")
# hibikiMenu = hibiki.getLastMenu()
## SEND EVERYTHING !
print("Sending...")
# Welcome
sendMsg(random.choice(msgs.welcomeTitle) + "\n" + random.choice(msgs.welcomeMsg))
# Menus
sendAttachment(ptitCafeMenu)
sendAttachment(houbloMenu)
sendAttachment(grandPereMenu)
sendAttachment(kebabMenu)
sendAttachment(pipioMenu)
# sendAttachment(hibikiMenu)
# Bye
sendMsg(random.choice(msgs.goodbyeMsg))
print("Sent.")