From ea5c01bd04988d94f437281d145796c759f68b71 Mon Sep 17 00:00:00 2001 From: H4CK3R-01 Date: Tue, 26 Apr 2022 09:12:21 +0200 Subject: [PATCH 1/5] Update Dockerfile and pipeline --- .woodpecker/pipeline.yml | 19 +------------------ telegram_bot/{Dockerfile.bot => Dockerfile} | 2 +- telegram_bot/Dockerfile.updates | 14 -------------- 3 files changed, 2 insertions(+), 33 deletions(-) rename telegram_bot/{Dockerfile.bot => Dockerfile} (84%) delete mode 100644 telegram_bot/Dockerfile.updates diff --git a/.woodpecker/pipeline.yml b/.woodpecker/pipeline.yml index 8551885..7a0d6a1 100644 --- a/.woodpecker/pipeline.yml +++ b/.woodpecker/pipeline.yml @@ -39,24 +39,7 @@ pipeline: from_secret: password registry: from_secret: registry - dockerfile: telegram_bot/Dockerfile.bot - platforms: linux/amd64 - when: - path: "telegram_bot/**" - event: push - - build_bot_updates: - image: woodpeckerci/plugin-docker-buildx - settings: - repo: - from_secret: repo_bot_updates - username: - from_secret: username - password: - from_secret: password - registry: - from_secret: registry - dockerfile: telegram_bot/Dockerfile.updates + dockerfile: telegram_bot/Dockerfile platforms: linux/amd64 when: path: "telegram_bot/**" diff --git a/telegram_bot/Dockerfile.bot b/telegram_bot/Dockerfile similarity index 84% rename from telegram_bot/Dockerfile.bot rename to telegram_bot/Dockerfile index 58002cc..de4bda8 100644 --- a/telegram_bot/Dockerfile.bot +++ b/telegram_bot/Dockerfile @@ -11,4 +11,4 @@ RUN pip install -r requirements.txt --src /usr/local/src --no-warn-script-locati COPY telegram_bot /srv/flask_app # Run the application -CMD ["/usr/local/bin/python", "bot.py"] +ENTRYPOINT ["/bin/sh" "-c" "python bot.py && python bot_updates.py"] diff --git a/telegram_bot/Dockerfile.updates b/telegram_bot/Dockerfile.updates deleted file mode 100644 index 0f7e630..0000000 --- a/telegram_bot/Dockerfile.updates +++ /dev/null @@ -1,14 +0,0 @@ -FROM python:3.10-slim - -# Change the working directory to the root of the project -WORKDIR /srv/flask_app - -# Install the dependencies -COPY telegram_bot/requirements.txt /srv/flask_app/ -RUN pip install -r requirements.txt --src /usr/local/src --no-warn-script-location - -# Copy the source code to the working directory -COPY telegram_bot /srv/flask_app - -# Run the application -CMD ["/usr/local/bin/python", "bot_updates.py"] -- 2.47.2 From 8f60bc5f160f1f0f0edf076a15dd7a4423a81c19 Mon Sep 17 00:00:00 2001 From: H4CK3R-01 Date: Tue, 26 Apr 2022 09:15:10 +0200 Subject: [PATCH 2/5] Update Dockerfile --- telegram_bot/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/telegram_bot/Dockerfile b/telegram_bot/Dockerfile index de4bda8..e5c4106 100644 --- a/telegram_bot/Dockerfile +++ b/telegram_bot/Dockerfile @@ -11,4 +11,4 @@ RUN pip install -r requirements.txt --src /usr/local/src --no-warn-script-locati COPY telegram_bot /srv/flask_app # Run the application -ENTRYPOINT ["/bin/sh" "-c" "python bot.py && python bot_updates.py"] +ENTRYPOINT ["/bin/sh", "-c", "python bot.py && python bot_updates.py"] -- 2.47.2 From 1786cf8df0dfdcadde99f9e8ed4146e5a75d0d48 Mon Sep 17 00:00:00 2001 From: H4CK3R-01 Date: Tue, 26 Apr 2022 09:19:46 +0200 Subject: [PATCH 3/5] Update Dockerfile and docker-compose --- deploy/aktienbot/.env.bot | 3 +++ deploy/aktienbot/docker-compose.yml | 5 ----- telegram_bot/Dockerfile | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/deploy/aktienbot/.env.bot b/deploy/aktienbot/.env.bot index c64cd3c..8b67787 100644 --- a/deploy/aktienbot/.env.bot +++ b/deploy/aktienbot/.env.bot @@ -1,3 +1,6 @@ BOT_API_KEY= NEWS_API_KEY= SECRET_KEY= + +BOT_EMAIL= +BOT_PASSWORD= \ No newline at end of file diff --git a/deploy/aktienbot/docker-compose.yml b/deploy/aktienbot/docker-compose.yml index 991bbdf..46aee48 100644 --- a/deploy/aktienbot/docker-compose.yml +++ b/deploy/aktienbot/docker-compose.yml @@ -30,11 +30,6 @@ services: env_file: - ${PWD}/.env.bot - aktienbot_bot_updates: - image: registry.flokaiser.com/aktienbot/bot_updates - env_file: - - ${PWD}/.env.bot - mariadb: image: mariadb volumes: diff --git a/telegram_bot/Dockerfile b/telegram_bot/Dockerfile index e5c4106..c2fc640 100644 --- a/telegram_bot/Dockerfile +++ b/telegram_bot/Dockerfile @@ -11,4 +11,4 @@ RUN pip install -r requirements.txt --src /usr/local/src --no-warn-script-locati COPY telegram_bot /srv/flask_app # Run the application -ENTRYPOINT ["/bin/sh", "-c", "python bot.py && python bot_updates.py"] +ENTRYPOINT ["/bin/sh", "-c", "'python bot.py && python bot_updates.py'"] -- 2.47.2 From eac839f0bdb02df3c43a1414a79d069663f264b5 Mon Sep 17 00:00:00 2001 From: Florian Kellermann Date: Tue, 26 Apr 2022 09:31:25 +0200 Subject: [PATCH 4/5] Removed default value in bot --- telegram_bot/bot.py | 2 +- telegram_bot/bot_updates.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/telegram_bot/bot.py b/telegram_bot/bot.py index 9e97a09..684f96c 100644 --- a/telegram_bot/bot.py +++ b/telegram_bot/bot.py @@ -267,7 +267,7 @@ def update_for_user(message): send_to_user("No shares found for your account. Check https://gruppe1.testsites.info to change your settings and add shares.", pUser_id=p_user_id) -def send_to_user(pText, pUser_id = 1770205310): +def send_to_user(pText, pUser_id): """ Send message to user :type pText: string diff --git a/telegram_bot/bot_updates.py b/telegram_bot/bot_updates.py index 47cefa7..6d81fcd 100644 --- a/telegram_bot/bot_updates.py +++ b/telegram_bot/bot_updates.py @@ -19,7 +19,6 @@ import sys from multiprocessing import Process from apscheduler.schedulers.background import BackgroundScheduler from api_handling.api_handler import API_Handler -from news.news_fetcher import format_article ''' -- 2.47.2 From 9e344c4f9ab003c57a8b6c8bad7178605b7f3ac1 Mon Sep 17 00:00:00 2001 From: Florian Kellermann Date: Tue, 26 Apr 2022 09:36:25 +0200 Subject: [PATCH 5/5] update to isin --- telegram_bot/bot.py | 6 +++--- telegram_bot/bot_updates.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/telegram_bot/bot.py b/telegram_bot/bot.py index 684f96c..a2cc2a6 100644 --- a/telegram_bot/bot.py +++ b/telegram_bot/bot.py @@ -250,9 +250,9 @@ def update_for_user(message): my_portfolio = p_my_handler.get_user_portfolio(p_user_id) for element in my_portfolio: - if element["count"] != '' and element["symbol"]!= '': - print(element["count"], element["symbol"]) - share_symbols.append(element["symbol"]) + if element["count"] != '' and element["isin"]!= '': + print(element["count"], element["isin"]) + share_symbols.append(element["isin"]) share_amounts.append(element["count"]) share_courses.append(element["current_price"]) diff --git a/telegram_bot/bot_updates.py b/telegram_bot/bot_updates.py index 6d81fcd..46df917 100644 --- a/telegram_bot/bot_updates.py +++ b/telegram_bot/bot_updates.py @@ -132,9 +132,9 @@ def update_for_user(p_user_id, p_my_handler): my_portfolio = p_my_handler.get_user_portfolio(p_user_id) for element in my_portfolio: - if element["count"] != '' and element["symbol"]!= '': - print(element["count"], element["symbol"]) - share_symbols.append(element["symbol"]) + if element["count"] != '' and element["isin"]!= '': + print(element["count"], element["isin"]) + share_symbols.append(element["isin"]) share_amounts.append(element["count"]) share_courses.append(element["current_price"]) -- 2.47.2