modified: app.py
modified: bot.py modified: templates/navigation.html modified: templates/privacy_policy.html new file: templates/user_contact.html
This commit is contained in:
117
app.py
117
app.py
@@ -898,6 +898,123 @@ def terms_of_service():
|
||||
"""Zeigt die Terms of Service Seite an."""
|
||||
return render_template("terms_of_service.html")
|
||||
|
||||
@app.route("/user-contact", methods=["GET", "POST"])
|
||||
def user_contact():
|
||||
"""Kontaktformular für eingeloggte Benutzer mit automatischer Discord DM"""
|
||||
if not g.user_info:
|
||||
flash("Please log in to access the contact form.", "warning")
|
||||
return redirect(url_for("login"))
|
||||
|
||||
if request.method == "POST":
|
||||
try:
|
||||
# Form data sammeln
|
||||
subject = request.form.get("subject", "").strip()
|
||||
category = request.form.get("category", "").strip()
|
||||
priority = request.form.get("priority", "").strip()
|
||||
message = request.form.get("message", "").strip()
|
||||
server_context = request.form.get("server_context", "").strip()
|
||||
|
||||
# Validierung
|
||||
if not all([subject, category, priority, message]):
|
||||
flash("Please fill in all required fields.", "danger")
|
||||
return render_template("user_contact.html", user_info=g.user_info)
|
||||
|
||||
# Discord User Info
|
||||
user_info = g.user_info
|
||||
|
||||
# Priority emoji mapping
|
||||
priority_emojis = {
|
||||
"low": "🟢",
|
||||
"medium": "🟡",
|
||||
"high": "🟠",
|
||||
"urgent": "🔴"
|
||||
}
|
||||
|
||||
# Category emoji mapping
|
||||
category_emojis = {
|
||||
"bug_report": "🐛",
|
||||
"feature_request": "💡",
|
||||
"account_issue": "👤",
|
||||
"moderation": "🛡️",
|
||||
"giveaway": "🎁",
|
||||
"privacy": "🔒",
|
||||
"technical": "⚙️",
|
||||
"other": "❓"
|
||||
}
|
||||
|
||||
# Discord Message erstellen
|
||||
embed_content = f"""**📨 New Contact Form Submission**
|
||||
|
||||
**User Information:**
|
||||
• **Name:** {user_info.get('global_name', user_info.get('username', 'Unknown'))}
|
||||
• **Username:** {user_info.get('username', 'Unknown')}#{user_info.get('discriminator', '0000')}
|
||||
• **Discord ID:** `{user_info.get('id', 'Unknown')}`
|
||||
• **Avatar:** {user_info.get('avatar_url', 'No avatar')}
|
||||
|
||||
**Message Details:**
|
||||
• **Subject:** {subject}
|
||||
• **Category:** {category_emojis.get(category, '❓')} {category.replace('_', ' ').title()}
|
||||
• **Priority:** {priority_emojis.get(priority, '⚪')} {priority.upper()}
|
||||
{f"• **Server Context:** {server_context}" if server_context else ""}
|
||||
|
||||
**Message:**
|
||||
```
|
||||
{message}
|
||||
```
|
||||
|
||||
**Submitted at:** <t:{int(time.time())}:F>
|
||||
**From:** Multus Bot Web Panel"""
|
||||
|
||||
# Discord DM via Bot senden
|
||||
import requests
|
||||
import time
|
||||
|
||||
# Ihre Discord User ID hier eintragen
|
||||
YOUR_DISCORD_ID = "253922739709018114" # Ersetzen Sie dies mit Ihrer Discord ID
|
||||
|
||||
try:
|
||||
# Versuche die Nachricht über den Bot zu senden
|
||||
connection = get_db_connection()
|
||||
cursor = connection.cursor()
|
||||
|
||||
# In Datenbank speichern
|
||||
cursor.execute("""
|
||||
INSERT INTO contact_messages (
|
||||
user_id, username, subject, category, priority, message,
|
||||
server_context, submitted_at, status
|
||||
) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)
|
||||
""", (
|
||||
user_info.get('id'),
|
||||
f"{user_info.get('username')}#{user_info.get('discriminator')}",
|
||||
subject,
|
||||
category,
|
||||
priority,
|
||||
message,
|
||||
server_context,
|
||||
int(time.time()),
|
||||
'pending'
|
||||
))
|
||||
connection.commit()
|
||||
|
||||
flash("Your message has been submitted successfully! We'll process it and get back to you within 15 minutes via Discord DM.", "success")
|
||||
|
||||
cursor.close()
|
||||
connection.close()
|
||||
|
||||
except Exception as e:
|
||||
print(f"Error saving contact message: {e}")
|
||||
flash("There was an error submitting your message. Please try again or contact us directly on Discord.", "danger")
|
||||
|
||||
except Exception as e:
|
||||
print(f"Error saving contact message: {e}")
|
||||
flash("There was an error submitting your message. Please try again or contact us directly on Discord.", "danger")
|
||||
|
||||
except Exception as e:
|
||||
print(f"Error processing contact form: {e}")
|
||||
flash("An unexpected error occurred. Please try again.", "danger")
|
||||
|
||||
return render_template("user_contact.html", user_info=g.user_info)
|
||||
|
||||
@app.route("/privacy-policy")
|
||||
def privacy_policy():
|
||||
"""Zeigt die Privacy Policy Seite an."""
|
||||
|
||||
Reference in New Issue
Block a user