Ejemplo n.º 1
0
def setup_finished():
    if request.method == 'POST':
        error = None
        token = request.form.get('token')
        if (token == ""):
            error = "Please fill out all the required fields"
            return render_template("setup.html", error=error)
        else:
            bot_thread.write_json("token", token)
            return redirect(url_for("home"))
Ejemplo n.º 2
0
def prefix_finished():
        if request.method == 'POST':
            error = None
            custom_prefix = request.form.get('custom_prefix')
            if(custom_prefix == ""): 
                 error = "Please fill out all the required fields"
                 return render_template("custom_prefix.html", error=error)
            else:
                bot_thread.write_json("custom_prefix", custom_prefix)
                return redirect(url_for("home"))
Ejemplo n.º 3
0
def custom_list():
    error = False
    if request.method == "POST":
        if(request.form.get("new_pokemon")):
            n_p = request.form.get("new_pokemon")
            with open (os.path.join(pth_r,'Lists','hashes.json')) as check:
                check_read = json.load(check)
                check.close()
            if (n_p in check_read):
                add_pokemon(n_p)
                return redirect(url_for("custom_list"))
            else:
                error = n_p 
        elif(request.form.get("custom_list_state")):
            if(request.form.get("custom_list_state") == "custom_list_true"):
                bot_thread.write_json("custom_list", "True")
            elif(request.form.get("custom_list_state") == "custom_list_false"):
                bot_thread.write_json("custom_list", "False")
    with open (os.path.join(pth_r,'User','customs.json')) as c:
        cl = json.load(c)
        c.close()
    return render_template("custom_list.html", cl=cl, err=error)
Ejemplo n.º 4
0
def setup_finished():
    if request.method == 'POST':
        error = None
        token = request.form.get('token')
        auto_spam = request.form.get('auto_spam')
        if auto_spam == "auto_spam_true":
            auto_spam = "True"
        else:
            auto_spam = False
        channel_id = request.form.get('channel_id')
        spam_interval = request.form.get('spam_interval')
        spam_text = request.form.get('spam_text')
        if (token == "" or channel_id == "" or spam_interval == ""
                or spam_text == ""):
            error = "Please fill out all the required fields"
            return render_template("setup.html", error=error)
        else:
            bot_thread.write_json("token", token)
            bot_thread.write_json("auto_spam", auto_spam)
            bot_thread.write_json("auto_spam_channel", channel_id)
            bot_thread.write_json("auto_spam_interval", spam_interval)
            bot_thread.write_json("auto_spam_text", spam_text)
            return redirect(url_for("home"))