Added /cammiechat
This commit is contained in:
parent
e8c86b5a5e
commit
488eb7f275
2 changed files with 12 additions and 2 deletions
11
app/app.py
11
app/app.py
|
@ -5,7 +5,6 @@ from flask_sqlalchemy import SQLAlchemy
|
|||
import requests
|
||||
import config
|
||||
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
app.config['SQLALCHEMY_DATABASE_URI'] = config.DATABASE_URL
|
||||
|
@ -128,3 +127,13 @@ def door(username):
|
|||
tokens = request.values.get('text').strip().split()
|
||||
command = tokens[0].lower()
|
||||
return mattermost_response(slotmachien_request(username, command), ephemeral=True)
|
||||
|
||||
@app.route('/cammiechat', methods=['POST'])
|
||||
@requires_token('cammiechat')
|
||||
@requires_regular
|
||||
def cammiechat(username):
|
||||
headers = {
|
||||
"X-Username": username
|
||||
}
|
||||
requests.post("https://kelder.zeus.ugent.be/messages/", data=request.values.get('text').strip(), headers=headers)
|
||||
return mattermost_response("Message sent", ephemeral=True)
|
||||
|
|
|
@ -2,7 +2,8 @@ DATABASE_URL = 'sqlite:////tmp/mattermost.db'
|
|||
tokens = {
|
||||
'authorize': '123',
|
||||
'door': '123',
|
||||
'revoke': '123'
|
||||
'revoke': '123',
|
||||
'cammiechat': '123'
|
||||
}
|
||||
slotmachien_url = 'https://kelder.zeus.ugent.be/slotmachien/slack/'
|
||||
slotmachien_token = '123'
|
||||
|
|
Loading…
Reference in a new issue