diff --git a/files/helpers/config/modaction_types.py b/files/helpers/config/modaction_types.py index e711bca04..0acaa8e34 100644 --- a/files/helpers/config/modaction_types.py +++ b/files/helpers/config/modaction_types.py @@ -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', diff --git a/files/routes/admin.py b/files/routes/admin.py index 81a490dfa..2270475b5 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -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!"}