Remove autodeleting messages
This commit is contained in:
parent
253c0f5f3f
commit
1ee37eb100
2 changed files with 1 additions and 25 deletions
20
app/app.py
20
app/app.py
|
@ -7,7 +7,7 @@ from datetime import datetime
|
||||||
import requests
|
import requests
|
||||||
import config
|
import config
|
||||||
import random
|
import random
|
||||||
from mattermostdriver import Driver
|
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
|
@ -21,13 +21,6 @@ response_setting = "in_channel"
|
||||||
|
|
||||||
from app import models
|
from app import models
|
||||||
|
|
||||||
driver = Driver({
|
|
||||||
'port': 443,
|
|
||||||
'url': config.server_url,
|
|
||||||
'token': config.personal_auth_token
|
|
||||||
})
|
|
||||||
|
|
||||||
driver.login()
|
|
||||||
|
|
||||||
def check_regular(username):
|
def check_regular(username):
|
||||||
'''Check if a user has the permissions of a regular user.'''
|
'''Check if a user has the permissions of a regular user.'''
|
||||||
|
@ -130,17 +123,6 @@ def slotmachien_request(username, command):
|
||||||
'username': username, 'token': config.slotmachien_token, 'text': command})
|
'username': username, 'token': config.slotmachien_token, 'text': command})
|
||||||
return r.text
|
return r.text
|
||||||
|
|
||||||
def is_bestuur(username):
|
|
||||||
return username in config.bestuur
|
|
||||||
|
|
||||||
@app.route('/new_message', methods=['POST'])
|
|
||||||
def new_message():
|
|
||||||
if not is_bestuur(request.values.get("user_name")):
|
|
||||||
delete_message(request.values.get("post_id"))
|
|
||||||
return ""
|
|
||||||
|
|
||||||
def delete_message(message_id):
|
|
||||||
driver.posts.delete_post(message_id)
|
|
||||||
|
|
||||||
@app.route('/door', methods=['POST'])
|
@app.route('/door', methods=['POST'])
|
||||||
@requires_token('door')
|
@requires_token('door')
|
||||||
|
|
|
@ -8,9 +8,3 @@ tokens = {
|
||||||
}
|
}
|
||||||
slotmachien_url = 'https://kelder.zeus.ugent.be/slotmachien/slack/'
|
slotmachien_url = 'https://kelder.zeus.ugent.be/slotmachien/slack/'
|
||||||
slotmachien_token = '123'
|
slotmachien_token = '123'
|
||||||
personal_auth_token='zeusbot-auth-token'
|
|
||||||
server_url='mattermost.myserver.com'
|
|
||||||
bestuur = [
|
|
||||||
"user1",
|
|
||||||
"user2"
|
|
||||||
]
|
|
||||||
|
|
Loading…
Reference in a new issue