[mod modules] Ajout des erreurs de l'api
This commit is contained in:
parent
1556746010
commit
9925169c8e
@ -1,6 +1,7 @@
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
import discord
|
import discord
|
||||||
|
from aiohttp import ClientConnectorError
|
||||||
|
|
||||||
from modules.base import BaseClassPython
|
from modules.base import BaseClassPython
|
||||||
from modules.modules.api import Api
|
from modules.modules.api import Api
|
||||||
@ -118,11 +119,18 @@ class MainClass(BaseClassPython):
|
|||||||
await message.channel.send(embed=embed)
|
await message.channel.send(embed=embed)
|
||||||
|
|
||||||
async def com_web_list(self, message, args, kwargs):
|
async def com_web_list(self, message, args, kwargs):
|
||||||
modules = await self.api.list()
|
try:
|
||||||
|
modules = await self.api.list()
|
||||||
|
except ClientConnectorError:
|
||||||
|
await message.channel.send("Connection impossible au serveur.")
|
||||||
|
return
|
||||||
text = ""
|
text = ""
|
||||||
for module, versions in modules.items():
|
for module, versions in modules.items():
|
||||||
text += module + " - " + ", ".join(versions)
|
text += module + " - " + ", ".join(versions)
|
||||||
await message.channel.send(text)
|
await message.channel.send(text)
|
||||||
|
|
||||||
async def com_web_dl(self, message, args, kwargs):
|
async def com_web_dl(self, message, args, kwargs):
|
||||||
await self.api.download(args[1], args[2])
|
try:
|
||||||
|
await self.api.download(args[1], args[2])
|
||||||
|
except ClientConnectorError:
|
||||||
|
await message.channel.send("Connection impossible au serveur.")
|
||||||
|
Loading…
Reference in New Issue
Block a user