fixed moderator sql errors
This commit is contained in:
parent
3ca310ce5a
commit
3563828163
18
moderator.py
18
moderator.py
@ -78,7 +78,7 @@ def getmessage(moderatorid):
|
|||||||
if gottuple == None:
|
if gottuple == None:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
cur.execute("UPDATE berichten SET statusid = 2, moderatorid = (%s) WHERE berichtid = (%s)", (gottuple[0], moderatorid))
|
cur.execute("UPDATE berichten SET statusid = 2, moderatorid = (%s) WHERE berichtid = (%s)", (moderatorid, gottuple[0]))
|
||||||
conn.commit()
|
conn.commit()
|
||||||
return gottuple
|
return gottuple
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ def acceptmessage(berichtid, moderatorid):
|
|||||||
date = datetime.datetime.utcnow().strftime("%Y-%m-%d")
|
date = datetime.datetime.utcnow().strftime("%Y-%m-%d")
|
||||||
|
|
||||||
QUERY = "UPDATE berichten SET statusid = 4, datumgekeurd = (%s), tijdgekeurd = (%s), moderatorid = (%s) WHERE berichtid = (%s)"
|
QUERY = "UPDATE berichten SET statusid = 4, datumgekeurd = (%s), tijdgekeurd = (%s), moderatorid = (%s) WHERE berichtid = (%s)"
|
||||||
DATA = (date, time, berichtid, moderatorid)
|
DATA = (date, time, moderatorid, berichtid)
|
||||||
cur.execute(QUERY, DATA)
|
cur.execute(QUERY, DATA)
|
||||||
conn.commit()
|
conn.commit()
|
||||||
return True
|
return True
|
||||||
@ -104,7 +104,7 @@ def rejectmessage(berichtid, moderatorid):
|
|||||||
date = datetime.datetime.utcnow().strftime("%Y-%m-%d")
|
date = datetime.datetime.utcnow().strftime("%Y-%m-%d")
|
||||||
|
|
||||||
QUERY = "UPDATE berichten SET statusid = 3, datumgekeurd = (%s), tijdgekeurd = (%s), moderatorid = (%s) WHERE berichtid = (%s)"
|
QUERY = "UPDATE berichten SET statusid = 3, datumgekeurd = (%s), tijdgekeurd = (%s), moderatorid = (%s) WHERE berichtid = (%s)"
|
||||||
DATA = (date, time, berichtid, moderatorid)
|
DATA = (date, time, moderatorid, berichtid)
|
||||||
cur.execute(QUERY, DATA)
|
cur.execute(QUERY, DATA)
|
||||||
conn.commit()
|
conn.commit()
|
||||||
return True
|
return True
|
||||||
@ -121,10 +121,12 @@ def moderateloop():
|
|||||||
nadat de bericht is goedgekeurt direct de functie publishtwit(berichtid) en loopt weer verder
|
nadat de bericht is goedgekeurt direct de functie publishtwit(berichtid) en loopt weer verder
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
moderatorid = 1
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
exitvar = False
|
exitvar = False
|
||||||
|
|
||||||
bericht = getmessage()
|
bericht = getmessage(moderatorid)
|
||||||
|
|
||||||
if bericht == False:
|
if bericht == False:
|
||||||
print('Er zijn geen berichten meer om te weergeven, probeer het later opnieuw')
|
print('Er zijn geen berichten meer om te weergeven, probeer het later opnieuw')
|
||||||
@ -137,13 +139,15 @@ def moderateloop():
|
|||||||
try:
|
try:
|
||||||
modinput = input('r = reject, a = accept, q = quit: ').lower()
|
modinput = input('r = reject, a = accept, q = quit: ').lower()
|
||||||
if modinput == 'r':
|
if modinput == 'r':
|
||||||
rejectmessage(bericht[0])
|
rejectmessage(bericht[0], moderatorid)
|
||||||
exitvar = True
|
exitvar = True
|
||||||
elif modinput == 'a':
|
elif modinput == 'a':
|
||||||
acceptmessage(bericht[0])
|
acceptmessage(bericht[0], moderatorid)
|
||||||
exitvar = True
|
exitvar = True
|
||||||
elif modinput == 'q':
|
elif modinput == 'q':
|
||||||
unlockmessage(bericht[0])
|
unlockmessage(bericht[0])
|
||||||
return True
|
return True
|
||||||
except:
|
except:
|
||||||
print('Ongeldige invoer')
|
print('Ongeldige invoer')
|
||||||
|
|
||||||
|
moderateloop()
|
Reference in New Issue
Block a user