MCPcopy Create free account
hub / github.com/dedsec1121fk/DedSec / groups

Function groups

Scripts/ButSystem.py:14354–14394  ·  view source on GitHub ↗

List groups for the current user (with auto-heal schema).

()

Source from the content-addressed store, hash-verified

14352 return redirect(url_for("chat_with", username=username))
14353
14354 # Prefer an explicit file; otherwise accept GIF as a file attachment.
14355 chosen_file = (
14356 upfile if (upfile and getattr(upfile, "filename", "")) else (gif if (gif and getattr(gif, "filename", "")) else None)
14357 )
14358
14359 if voice and getattr(voice, "filename", ""):
14360 try:
14361 _validate_chat_voice_upload(voice)
14362 except ValueError as ve:
14363 msg = "Unsupported voice file type."
14364 if str(ve) == "forbidden_type":
14365 msg = "Forbidden file type."
14366 if is_ajax:
14367 return jsonify(ok=False, error=msg), 400
14368 flash(msg)
14369 return redirect(url_for("chat_with", username=username))
14370 if chosen_file and getattr(chosen_file, "filename", ""):
14371 try:
14372 _validate_chat_file_upload(chosen_file)
14373 except ValueError as ve:
14374 msg = "Unsupported file type."
14375 if str(ve) == "forbidden_type":
14376 msg = "Forbidden file type."
14377 if is_ajax:
14378 return jsonify(ok=False, error=msg), 400
14379 flash(msg)
14380 return redirect(url_for("chat_with", username=username))
14381
14382 has_voice = bool(voice and getattr(voice, "filename", ""))
14383 has_file = bool(chosen_file and getattr(chosen_file, "filename", ""))
14384 has_gif_url = bool(gif_url)
14385
14386 if (not body) and (not has_voice) and (not has_file) and (not has_gif_url):
14387 if is_ajax:
14388 return jsonify(ok=False, error="Write a message or attach voice/file."), 400
14389 flash("Write a message or attach voice/file.")
14390 return redirect(url_for("chat_with", username=username))
14391
14392 conn = db_connect()
14393 saved_paths = []
14394 try:
14395 exists = conn.execute("SELECT 1 FROM users WHERE username=?", (username,)).fetchone()
14396 if not exists:
14397 raise ValueError("User not found")

Callers

nothing calls this directly

Calls 4

current_userFunction · 0.70
db_initFunction · 0.70
_fetch_rowsFunction · 0.70
ObjClass · 0.70

Tested by

no test coverage detected