Ajout du webserver
All checks were successful
Gitsokyo/bot-base/pipeline/head This commit looks good
All checks were successful
Gitsokyo/bot-base/pipeline/head This commit looks good
This commit is contained in:
parent
4deb837e0d
commit
843b48dfdc
@ -1 +1 @@
|
|||||||
import bot_base
|
from .bot_base import *
|
||||||
|
@ -1,20 +1,16 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import importlib
|
import asyncio
|
||||||
import inspect
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import sys
|
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
import discord
|
import discord
|
||||||
import toml
|
from aiohttp import web
|
||||||
from packaging.specifiers import SpecifierSet, InvalidSpecifier
|
|
||||||
|
|
||||||
from bot_base.modules import ModuleManager
|
from bot_base.modules import ModuleManager
|
||||||
from config import Config, config_types
|
from config import Config, config_types
|
||||||
from config.config_types import factory
|
from config.config_types import factory
|
||||||
import errors
|
|
||||||
|
|
||||||
__version__ = "0.2.0"
|
__version__ = "0.2.0"
|
||||||
|
|
||||||
@ -37,15 +33,20 @@ class BotBase(discord.Client):
|
|||||||
|
|
||||||
self.config = Config(path=os.path.join(data_folder, "config.toml"))
|
self.config = Config(path=os.path.join(data_folder, "config.toml"))
|
||||||
self.config.register("data_folder", factory(config_types.Str))
|
self.config.register("data_folder", factory(config_types.Str))
|
||||||
|
self.config.register("port", factory(config_types.Int))
|
||||||
|
|
||||||
self.config.set({
|
self.config.set({
|
||||||
"data_folder": data_folder,
|
"data_folder": data_folder,
|
||||||
|
"port": 8080,
|
||||||
}, no_save=True)
|
}, no_save=True)
|
||||||
|
|
||||||
self.config.load()
|
self.config.load()
|
||||||
|
|
||||||
self.modules = ModuleManager(self)
|
self.modules = ModuleManager(self)
|
||||||
|
|
||||||
|
self.webserver = web.Application()
|
||||||
|
self.loop.create_task(web._run_app(self.webserver, port=self.config["port"]), name="webserver")
|
||||||
|
|
||||||
async def on_ready(self):
|
async def on_ready(self):
|
||||||
self.info("Bot ready.")
|
self.info("Bot ready.")
|
||||||
self.modules.load_modules()
|
self.modules.load_modules()
|
||||||
|
Loading…
Reference in New Issue
Block a user