diff --git a/main.py b/main.py index 0d7073b..40cd920 100644 --- a/main.py +++ b/main.py @@ -1,64 +1,14 @@ import os -from flask import Flask, render_template, request, redirect, url_for -from discord_webhook import DiscordWebhook, DiscordEmbed -from flask_bootstrap import Bootstrap4 -from flask_wtf import FlaskForm -from wtforms import StringField, IntegerField, TextAreaField, BooleanField, SubmitField, ValidationError -from wtforms.validators import DataRequired, NumberRange +from flask import Flask, render_template -webhook_url = os.environ.get('DISCORD_WEBHOOK_URL', "") +app = Flask( + __name__, static_url_path="", static_folder="static/", template_folder="templates/" +) -app = Flask(__name__,static_url_path='',static_folder='static/',template_folder='templates/') -SECRET_KEY = os.urandom(32) -app.config['SECRET_KEY'] = SECRET_KEY -bootstrap = Bootstrap4(app) -class ValidateMath(object): - def __init__(self, message=None): - self.message = message - - def __call__(self, form, field): - if field.data != 13: - raise ValidationError(self.message) - - -class ApplicationForm(FlaskForm): - minecraft_username = StringField("What is your Minecraft username?*",description="We need this information to eventually Whitelist you on the Server!", validators=[DataRequired()]) - discord_username = StringField("What is your Discord username?*", description="Please make sure you accept Friend Requests, Discord is where we will get in touch with you!", validators=[DataRequired()]) - why_would_you_like_to_join = TextAreaField("Why would you like to join?*", validators=[DataRequired()]) - favorite_aspect = TextAreaField("What is your favorite aspect of playing Minecraft online?*", validators=[DataRequired()]) - how_long_have_you_played = TextAreaField("How long have you been playing Minecraft?") - have_you_been_part_of_an_smp = TextAreaField("Have you been part of any SMP's before, if so why did you leave?") - age = IntegerField("What is your age?*", validators=[DataRequired(),NumberRange(min=16,max=200,message="Sorry, you are to Young to play with us :(")]) - math = IntegerField("What is Five plus Eight?*",validators=[DataRequired(),ValidateMath(message="Are you sure your Math is correct?")]) - rules_accepted = BooleanField("Do you accept the Rules?*", validators=[DataRequired()]) - submit = SubmitField() - - - -@app.route("/", methods=["GET", "POST"]) +@app.route("/") def home(): - form = ApplicationForm() - if request.method == "POST" and form.validate_on_submit(): #on form submission - webhook = DiscordWebhook(url=webhook_url) - embed = DiscordEmbed(title='Form Submission') - print(form.data) - for form_field in form.data: - print(f"{form_field}: {form.data[form_field]}") - embed.add_embed_field(name=form_field, value=form.data[form_field]) - # add embed object to webhook - webhook.add_embed(embed) - if webhook_url != "": - response = webhook.execute() - return redirect(location=url_for("success"),code=302) - elif form.errors: - return render_template("index.html", form=form, anchor=list(form.errors.keys())[0]) - else: - return render_template("index.html", form=form) - + return render_template("index.html") -@app.route("/success") -def success(): - return render_template("success.html") -app.run(host='0.0.0.0', port=5000) +app.run(host="0.0.0.0", port=5000) diff --git a/requirements.txt b/requirements.txt index 6379ade..7e10602 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1 @@ flask -discord-webhook -bootstrap-flask -flask-wtf diff --git a/static/img/screenshot-dragonfight.jpg b/static/img/screenshot-dragonfight.jpg deleted file mode 100644 index 2b003e1..0000000 Binary files a/static/img/screenshot-dragonfight.jpg and /dev/null differ diff --git a/static/img/screenshot-townsquare.jpg b/static/img/screenshot-townsquare.jpg deleted file mode 100644 index dab350c..0000000 Binary files a/static/img/screenshot-townsquare.jpg and /dev/null differ diff --git a/templates/index.html b/templates/index.html index 10efd69..2524888 100644 --- a/templates/index.html +++ b/templates/index.html @@ -98,7 +98,7 @@
Absolutely not! Our server does not have any Pay to Win elements that provide any advantages.
+Absolutely not! Our server does not have any Pay to Win elements!
Ready to dive into the adventure of Veiled Haven? Join our Discord and apply now to start your journey!
+ Join Veiled Haven on DiscordA Minecraft Server Project with a focus on keeping a vanilla gameplay experience and maintaining an adult community!
We'll contact you via Discord! Make sure that you are able to receive Friend Requests!
-You can now close this tab, or go back to the Homepage
-