From bc213e65f09c506165bd93c60de2c7809b209f08 Mon Sep 17 00:00:00 2001 From: fomys Date: Thu, 9 May 2019 01:39:33 +0200 Subject: [PATCH] Une autre partie --- .gitignore | 5 +++++ modules/modules/__init__.py | 9 +++++++-- modules/modules/api.py | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 8e55ee3..8157f2e 100644 --- a/.gitignore +++ b/.gitignore @@ -63,3 +63,8 @@ target/ .*.kate-swp .swp.* +temp.zip +storage/* +config/* +.idea/* + diff --git a/modules/modules/__init__.py b/modules/modules/__init__.py index 02788b9..d1a99f6 100644 --- a/modules/modules/__init__.py +++ b/modules/modules/__init__.py @@ -3,7 +3,7 @@ import os import discord from modules.base import BaseClass - +from modules.modules.api import Api class MainClass(BaseClass): @@ -25,6 +25,7 @@ class MainClass(BaseClass): def __init__(self, client): super().__init__(client) self.storage.mkdir("modules") + self.api = Api() def get_all_modules(self): all_items = os.listdir("modules") @@ -112,4 +113,8 @@ class MainClass(BaseClass): await message.channel.send(embed=embed) async def com_web_list(self, message, args, kwargs): - pass + modules = self.api.list() + text = "" + for module, versions in modules.items(): + text += module + " - " + ", ".join(versions) + await message.channel.send(text) diff --git a/modules/modules/api.py b/modules/modules/api.py index e895e93..af30000 100644 --- a/modules/modules/api.py +++ b/modules/modules/api.py @@ -5,7 +5,7 @@ import aiofiles import zipfile class Api: - def __init__(self, host): + def __init__(self, host="localhost:8000"): self.host = host self.basepath = "http://"+host+"/api/current"