mirror of
https://github.com/skylanix/MamieHenriette.git
synced 2026-02-06 06:40:35 +01:00
je passe sur des thread et ca marche, mystere
This commit is contained in:
@@ -11,8 +11,8 @@ from database.models import Configuration, GameBundle, Humeur
|
|||||||
class DiscordBot(discord.Client):
|
class DiscordBot(discord.Client):
|
||||||
async def on_ready(self):
|
async def on_ready(self):
|
||||||
logging.info(f'Logged in as {self.user} (ID: {self.user.id})')
|
logging.info(f'Logged in as {self.user} (ID: {self.user.id})')
|
||||||
# for c in self.get_all_channels() :
|
for c in self.get_all_channels() :
|
||||||
# print(f'{c.id} {c.name}')
|
logging.info(f'{c.id} {c.name}')
|
||||||
|
|
||||||
self.loop.create_task(self.updateStatus())
|
self.loop.create_task(self.updateStatus())
|
||||||
self.loop.create_task(self.updateHumbleBundle())
|
self.loop.create_task(self.updateHumbleBundle())
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
import locale
|
import locale
|
||||||
import logging
|
import logging
|
||||||
import multiprocessing
|
import threading
|
||||||
from webapp import webapp
|
from webapp import webapp
|
||||||
from discordbot import bot
|
from discordbot import bot
|
||||||
|
|
||||||
@@ -20,13 +20,10 @@ if __name__ == '__main__':
|
|||||||
locale.setlocale(locale.LC_TIME, 'fr_FR.UTF-8')
|
locale.setlocale(locale.LC_TIME, 'fr_FR.UTF-8')
|
||||||
|
|
||||||
jobs = []
|
jobs = []
|
||||||
jobs.append(multiprocessing.Process(target=start_discord_bot))
|
jobs.append(threading.Thread(target=start_discord_bot))
|
||||||
jobs.append(multiprocessing.Process(target=start_server))
|
jobs.append(threading.Thread(target=start_server))
|
||||||
|
|
||||||
for job in jobs: job.start()
|
for job in jobs: job.start()
|
||||||
|
|
||||||
print(bot.get_all_channels())
|
|
||||||
|
|
||||||
for job in jobs: job.join()
|
for job in jobs: job.join()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
from flask import Flask
|
from flask import Flask
|
||||||
from discordbot import bot
|
|
||||||
|
|
||||||
webapp = Flask(__name__)
|
webapp = Flask(__name__)
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ from discordbot import bot
|
|||||||
def openConfigurations():
|
def openConfigurations():
|
||||||
all = Configuration.query.all()
|
all = Configuration.query.all()
|
||||||
configurations = {conf.key: conf for conf in all}
|
configurations = {conf.key: conf for conf in all}
|
||||||
|
|
||||||
return render_template("configurations.html", configurations = configurations, channels = bot.get_all_channels())
|
return render_template("configurations.html", configurations = configurations, channels = bot.get_all_channels())
|
||||||
|
|
||||||
@webapp.route("/updateConfiguration", methods=['POST'])
|
@webapp.route("/updateConfiguration", methods=['POST'])
|
||||||
|
|||||||
Reference in New Issue
Block a user