From e2976f9e8a6f9e08c6677265578ab3f316f5f75b Mon Sep 17 00:00:00 2001 From: louis chauvet Date: Mon, 20 Aug 2018 18:27:52 +0200 Subject: [PATCH] Repair load_module, and smshandler --- SMSHandler.py | 5 ++++- config_sms.py | 2 -- main.py | 2 +- requirements.txt | 1 + 4 files changed, 6 insertions(+), 4 deletions(-) delete mode 100644 config_sms.py diff --git a/SMSHandler.py b/SMSHandler.py index ee02042..9f9441b 100644 --- a/SMSHandler.py +++ b/SMSHandler.py @@ -7,6 +7,9 @@ import os class SMSHandler(logging.Handler): def emit(self, record): msg = urllib.parse.quote(self.format(record).encode('utf8')) - urllib.request.urlopen("https://smsapi.free-mobile.fr/sendmsg?user=" + + try: + urllib.request.urlopen("https://smsapi.free-mobile.fr/sendmsg?user=" + os.environ.get("FREE_SMS_USER", "") + "&pass=" + os.environ.get("FREE_SMS_PASS", "") + "&msg=" + msg) + except urllib.error.HTTPError: + pass diff --git a/config_sms.py b/config_sms.py deleted file mode 100644 index 867c750..0000000 --- a/config_sms.py +++ /dev/null @@ -1,2 +0,0 @@ -user = "" -password = "" \ No newline at end of file diff --git a/main.py b/main.py index da4226d..3fe310a 100644 --- a/main.py +++ b/main.py @@ -132,7 +132,7 @@ class FoBot(discord.Client): def load_modules(self): for module in os.listdir('modules'): - if module != "__pycache__": + if module != "__pycache__" and module.endswith(".py"): imported = importlib.import_module('modules.' + module[:-3]) self.modules.update({module[:-3]: imported.MainClass}) diff --git a/requirements.txt b/requirements.txt index ca79c3f..8923509 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,3 +10,4 @@ pycparser==2.18 six==1.11.0 websockets==6.0 yarl==1.2.6 +fs \ No newline at end of file