mirror of
https://github.com/skylanix/MamieHenriette.git
synced 2026-02-06 23:10:36 +01:00
Premlier essai de humble bundle, j'arrive pas à lister les canauxx dans la page de configuration
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
from flask import Flask
|
||||
from discordbot import bot
|
||||
|
||||
webapp = Flask(__name__)
|
||||
|
||||
|
||||
@@ -2,10 +2,20 @@ from flask import render_template, request, redirect, url_for
|
||||
from webapp import webapp
|
||||
from database import db
|
||||
from database.models import Configuration
|
||||
from discordbot import bot
|
||||
|
||||
@webapp.route("/configurations")
|
||||
def openConfigurations():
|
||||
return render_template("configurations.html")
|
||||
all = Configuration.query.all()
|
||||
configurations = {conf.key: conf for conf in all}
|
||||
|
||||
return render_template("configurations.html", configurations = configurations, channels = bot.get_all_channels())
|
||||
|
||||
@webapp.route("/updateConfiguration", methods=['POST'])
|
||||
def updateConfiguration():
|
||||
|
||||
return redirect(url_for('openConfigurations'))
|
||||
|
||||
|
||||
@webapp.route('/configurations/set/<key>', methods=['POST'])
|
||||
def setConfiguration(key):
|
||||
|
||||
@@ -3,6 +3,19 @@
|
||||
{% block content %}
|
||||
<h1>Configuration de Mamie.</h1>
|
||||
|
||||
<h2>Humble Bundle</h2>
|
||||
<form action="{{ url_for('updateConfiguration') }}" method="POST">
|
||||
<label for="humble_bundle_channel">Api Discord (cachée)</label>
|
||||
{{channels}}
|
||||
<select name="humble_bundle_channel">
|
||||
{% for channel in channels %}
|
||||
<option value="{{channel.id}}">{{channel.name}}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<input type="Submit" value="Définir">
|
||||
</form>
|
||||
|
||||
|
||||
<h2>Api</h2>
|
||||
<form action="{{ url_for('setConfiguration', key = 'discord_token') }}" method="POST">
|
||||
<label for="value">Api Discord (cachée)</label>
|
||||
|
||||
Reference in New Issue
Block a user