discord_peak_bot/app/web_server.py

22 lines
523 B
Python
Raw Permalink Normal View History

2024-08-03 11:18:28 +00:00
from flask import Flask, request, jsonify
import os
app = Flask(__name__)
@app.route('/debug', methods=['POST'])
def toggle_debug():
data = request.json
if 'enable' not in data:
return jsonify({'error': 'Invalid request'}), 400
if data['enable']:
open('debug_mode.txt', 'w').close()
else:
if os.path.exists('debug_mode.txt'):
os.remove('debug_mode.txt')
return jsonify({'success': True})
if __name__ == '__main__':
app.run(host='0.0.0.0', port=5000)