add orgy modactions

pull/211/head
Aevann 2023-10-05 19:28:17 +03:00
parent aac2bfed38
commit c7c3999223
2 changed files with 32 additions and 1 deletions

View File

@ -306,6 +306,16 @@ MODACTION_TYPES = {
"icon": 'fa-eye-slash',
"color": 'bg-danger'
},
'start_orgy': {
"str": 'started orgy',
"icon": 'fa-tv',
"color": 'bg-success'
},
'stop_orgy': {
"str": 'stopped orgy',
"icon": 'fa-tv',
"color": 'bg-danger'
},
'unchud': {
"str": 'unchudded {self.target_link}',
"icon": 'fa-snooze',

View File

@ -1990,6 +1990,13 @@ def start_orgy(v):
)
g.db.add(orgy)
ma = ModAction(
kind="start_orgy",
user_id=v.id,
_note=data,
)
g.db.add(ma)
g.db.commit()
requests.post('http://localhost:5001/refresh_chat', headers={"Host": SITE})
@ -1998,6 +2005,20 @@ def start_orgy(v):
@app.post("/admin/stop_orgy")
@admin_level_required(PERMS['ORGIES'])
def stop_orgy(v):
g.db.query(Orgy).delete()
orgy = g.db.query(Orgy).one_or_none()
if not orgy:
abort(400, "There is no orgy in progress right now!")
ma = ModAction(
kind="stop_orgy",
user_id=v.id,
_note=orgy.data,
)
g.db.add(ma)
g.db.delete(orgy)
requests.post('http://localhost:5001/refresh_chat', headers={"Host": SITE})
return {"message": "Orgy stopped successfully!"}