From df03b931b1f90e76751e187df2b26a73384a1ab2 Mon Sep 17 00:00:00 2001 From: Joa Roque Date: Sat, 5 Aug 2023 18:44:11 +0100 Subject: [PATCH] :boom: fix: fixing error in middlware --- .gitignore | 3 ++- main.py | 10 +++++++--- utils/middleware.py | 5 +++++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 3a50127..3467c42 100644 --- a/.gitignore +++ b/.gitignore @@ -161,4 +161,5 @@ cython_debug/ # Ini config file *.ini -.DS_Store \ No newline at end of file +*.DS_Store +*.session \ No newline at end of file diff --git a/main.py b/main.py index a31326c..ddc8ff8 100644 --- a/main.py +++ b/main.py @@ -83,9 +83,13 @@ async def on_message(ws): if channel_id == channel_id_to_monitor and message != '': logging.info(f"Message received from Discord: {message}") - if should_send(message): - # comment this line if you dont want to use middlware - await send_to_telegram(f"{message}") + # comment this line if you dont want to use middlware + cleaned_message = should_send(message) + if cleaned_message: + await send_to_telegram(f"{cleaned_message}") + + # await send_to_telegram(f"{message}") + elif op_code == 9: logging.info("Invalid session. Starting a new session...") diff --git a/utils/middleware.py b/utils/middleware.py index dfd6b22..388c40c 100644 --- a/utils/middleware.py +++ b/utils/middleware.py @@ -7,6 +7,11 @@ important_keywords = [ + "SL", + "TP", + "SELL", + "BUY", + "ENTRY", "EURGBP", "AUDJPY", "EURAUD",