[base] Little mise a jour

This commit is contained in:
Fomys 2019-08-11 18:07:58 +02:00
parent 5612fac842
commit 6d3944b76a
Signed by: fomys
GPG Key ID: 1ECA046A9615ABA0
3 changed files with 7 additions and 3 deletions

View File

@ -74,6 +74,7 @@ class Module:
return False
with open(os.path.join("modules", self.name, "version.json")) as file:
versions = json.load(file)
print(versions)
if "version" not in versions.keys():
return False
if "dependencies" not in versions.keys():
@ -275,7 +276,6 @@ class LBI(discord.Client):
if dep not in self.modules.keys():
if dep != "base":
self.load_module(dep)
if MODULES[module].type == "python":
try:
self.info("Start loading module {module}...".format(module=module))

View File

@ -181,3 +181,6 @@ class BaseClass:
else:
# Run event
asyncio.ensure_future(self.client._run_event(coro, method, *args, **kwargs), loop=self.client.loop)
async def on_error(self, event_method, *args, **kwargs):
pass

View File

@ -1,11 +1,12 @@
import os
import shutil
import aiohttp
import aiofiles
import zipfile
class Api:
def __init__(self, host="localhost:8000"):
def __init__(self, host="localhost:5000"):
self.host = host
self.basepath = "http://"+host+"/api/current"
@ -30,6 +31,6 @@ class Api:
async def download(self, module, version):
await self._download("modules/"+module+"/"+version, filename="temp.zip")
shutil.rmtree(os.path.join("modules, module"))
with zipfile.ZipFile('temp.zip', "r") as z:
z.extractall(os.path.join("modules", module))
#78.200.118.13:8000