This repository has been archived by the owner on Feb 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
80 lines (61 loc) · 2.07 KB
/
app.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
77
78
79
80
import os
from flask import abort, Flask, jsonify, request
app = Flask(__name__)
def is_request_valid(request):
is_token_valid = request.form['token'] == os.environ['SLACK_VERIFICATION_TOKEN']
is_team_id_valid = request.form['team_id'] == os.environ['SLACK_TEAM_ID']
return is_token_valid and is_team_id_valid
@app.route('/hello', methods=['POST'])
def hello():
if not is_request_valid(request):
abort(400)
return jsonify(
response_type='in_channel',
text='<https://icists.org|Welcome!>',
)
@app.route('/help', methods=['POST'])
def help():
if not is_request_valid(request):
abort(400)
return jsonify(
response_type='in_channel',
text='\
/hello : ICISTS 공식 홈페이지 링크를 출력합니다.\n\
/drive : ICISTS Github 링크를 출력합니다.\n\
/vectormeeting : 벡미록 링크를 출력합니다.\n\
/irs : IRS 링크를 출력합니다.\n\
/github : ICISTS Github 링크를 출력합니다.\n\
',
)
@app.route('/drive', methods=['POST'])
def drive():
if not is_request_valid(request):
abort(400)
return jsonify(
response_type='in_channel',
text='<https://drive.google.com/drive/u/0/folders/0B20dYYj1TLYDeTJaZERERnl4SFE|Google Drive>',
)
@app.route('/vectormeeting', methods=['POST'])
def vectormeeting():
if not is_request_valid(request):
abort(400)
return jsonify(
response_type='in_channel',
text='<https://drive.google.com/drive/u/0/folders/1VgZNinrKj0-Wt8Pj5nYFu2T4NuTq2YXh|벡미록>',
)
@app.route('/irs', methods=['POST'])
def irs():
if not is_request_valid(request):
abort(400)
return jsonify(
response_type='in_channel',
text='<https://drive.google.com/drive/u/0/folders/1cF4mAV3wsch5wTIirQAcvobSBwOWRrkK|IRS>',
)
@app.route('/github', methods=['POST'])
def github():
if not is_request_valid(request):
abort(400)
return jsonify(
response_type='in_channel',
text='<https://github.com/icists|Github>',
)