Premlier essai de humble bundle, j'arrive pas à lister les canauxx dans la page de configuration

This commit is contained in:
Kepka Ludovic
2025-08-11 01:03:00 +02:00
parent d242639855
commit 82faed0991
8 changed files with 94 additions and 30 deletions

View File

@@ -1,4 +1,5 @@
from flask import Flask
from discordbot import bot
webapp = Flask(__name__)

View File

@@ -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):

View File

@@ -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>