From fd92b7ed6ac8b17f9aabc8c8943fe8d6019da6ad Mon Sep 17 00:00:00 2001 From: AM Date: Wed, 1 Nov 2023 11:34:32 +0100 Subject: [PATCH 1/9] updgrade --- Dockerfile | 2 +- LICENSE.md | 56 +++++++++++++++++++ README.md | 56 +++++++++++++++++++ pom.xml | 20 +++++-- .../java/helper/PaypalLinkGenerator.java | 3 +- .../hertlhendl/HertlHendlBot.java | 3 +- .../hertlhendl/dal/HertlBotRootDao.java | 30 +++++----- 7 files changed, 148 insertions(+), 22 deletions(-) create mode 100644 LICENSE.md create mode 100644 README.md diff --git a/Dockerfile b/Dockerfile index eebacab..bf5a5ec 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM eclipse-temurin:17.0.1_12-jdk-focal +FROM eclipse-temurin:21-jammy LABEL maintainer="AMDev" RUN groupadd --system -g 1001 telegrambot && adduser --uid 1001 --gid 1001 --disabled-password --shell /bin/false telegrambot diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..a2fecaf --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,56 @@ + + +Apache License + +Version 2.0, January 2004 + +http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. + +"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: + + You must give any other recipients of the Work or Derivative Works a copy of this License; and + You must cause any modified files to carry prominent notices stating that You changed the files; and + You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and + If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. + + You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS diff --git a/README.md b/README.md new file mode 100644 index 0000000..290f577 --- /dev/null +++ b/README.md @@ -0,0 +1,56 @@ +# How to + +## Developer how to use: + +Create your Ownbot : + + +Start the Bot like this. + + java -cp java.telegrambots-0.9-FINAL.jar:./lib/* de.bigamgamen.java.telegrambots.hertlhendl.HertlHendlBot TOKEN bot_name CREATOR_ID + +Or test it with this bot: @herthaehnchen_bot + +## User how to use: + +type /help and choose a command. + +Usecase: Make an order: + + /neuebestellung + /bestellungenkeyboard + +choose a Button + + /bestellung 0 + +add article to order with Buttons + + /addposition 1/2-Hähnchen 0 + /addposition Krautsalat 0 + +Commit your order + + /commitorder 0 + +## Admin how to use: + + /adminoffnenebestellungen + +# Copyright and Licensing + +Copyright © 2023 Arne Meier + +Licensed under the Apache License, Version 2.0 (the "License"); you may +not use this file except in compliance with the License. You may obtain +a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +See the [LICENSE](#LICENSE.md#) file for details. diff --git a/pom.xml b/pom.xml index f78d115..dc53120 100644 --- a/pom.xml +++ b/pom.xml @@ -10,9 +10,10 @@ UTF-8 - 11 - 11 + 17 + 17 5.4.0 + 08.01.01-MS-GA @@ -34,15 +35,22 @@ ${telegram.bot.version} + one.microstream - storage.embedded - 04.00.00-MS-GA + microstream-storage-embedded + ${microstream.version} + one.microstream - storage.embedded.configuration - 04.00.00-MS-GA + microstream-storage-embedded-configuration + ${microstream.version} + + + one.microstream + microstream-persistence-binary-jdk17 + ${microstream.version} org.apache.commons diff --git a/src/main/java/de/bigamgamen/java/helper/PaypalLinkGenerator.java b/src/main/java/de/bigamgamen/java/helper/PaypalLinkGenerator.java index 99257f8..3e7e639 100644 --- a/src/main/java/de/bigamgamen/java/helper/PaypalLinkGenerator.java +++ b/src/main/java/de/bigamgamen/java/helper/PaypalLinkGenerator.java @@ -1,6 +1,7 @@ package de.bigamgamen.java.helper; import java.net.MalformedURLException; +import java.net.URI; import java.net.URL; import de.bigamgamen.java.telegrambots.hertlhendl.domain.HertlBotOrder; @@ -33,7 +34,7 @@ public URL generatePayPalLinkForOrder(final HertlBotOrder order, String adminEma sb.append(ITEM_NAME).append(order.getPayPalDescription()); sb.append(CURRENCY_CODE).append(DEFAULT_CURRENCY); - final URL paylpalLink = new URL(sb.toString()); + final URL paylpalLink = URI.create(sb.toString()).toURL(); return paylpalLink; } diff --git a/src/main/java/de/bigamgamen/java/telegrambots/hertlhendl/HertlHendlBot.java b/src/main/java/de/bigamgamen/java/telegrambots/hertlhendl/HertlHendlBot.java index 9c918ee..8d28a85 100644 --- a/src/main/java/de/bigamgamen/java/telegrambots/hertlhendl/HertlHendlBot.java +++ b/src/main/java/de/bigamgamen/java/telegrambots/hertlhendl/HertlHendlBot.java @@ -24,6 +24,7 @@ import java.io.IOException; import java.io.InputStream; import java.math.BigInteger; +import java.net.URI; import java.net.URISyntaxException; import java.net.URL; import java.util.ArrayList; @@ -606,7 +607,7 @@ private InputStream makingScreenshotOfHertlHomepage() try { - final URL u = new URL(HERTL_URL); + final URL u = URI.create(HERTL_URL).toURL(); return u.openStream(); diff --git a/src/main/java/de/bigamgamen/java/telegrambots/hertlhendl/dal/HertlBotRootDao.java b/src/main/java/de/bigamgamen/java/telegrambots/hertlhendl/dal/HertlBotRootDao.java index 9820803..f804f60 100644 --- a/src/main/java/de/bigamgamen/java/telegrambots/hertlhendl/dal/HertlBotRootDao.java +++ b/src/main/java/de/bigamgamen/java/telegrambots/hertlhendl/dal/HertlBotRootDao.java @@ -1,5 +1,13 @@ package de.bigamgamen.java.telegrambots.hertlhendl.dal; +import de.bigamgamen.java.telegrambots.hertlhendl.domain.HertlBotOrder; +import de.bigamgamen.java.telegrambots.hertlhendl.domain.HertlBotRoot; +import de.bigamgamen.java.telegrambots.hertlhendl.domain.HertlBotUser; +import one.microstream.persistence.binary.jdk17.types.BinaryHandlersJDK17; +import one.microstream.storage.embedded.configuration.types.EmbeddedStorageConfiguration; +import one.microstream.storage.embedded.types.EmbeddedStorageFoundation; +import one.microstream.storage.embedded.types.EmbeddedStorageManager; + import java.nio.file.Paths; import java.time.LocalDate; import java.util.ArrayList; @@ -8,13 +16,6 @@ import java.util.function.Predicate; import java.util.stream.Collectors; -import de.bigamgamen.java.telegrambots.hertlhendl.domain.HertlBotOrder; -import de.bigamgamen.java.telegrambots.hertlhendl.domain.HertlBotRoot; -import de.bigamgamen.java.telegrambots.hertlhendl.domain.HertlBotUser; -import one.microstream.storage.configuration.Configuration; -import one.microstream.storage.types.EmbeddedStorageFoundation; -import one.microstream.storage.types.EmbeddedStorageManager; - public class HertlBotRootDao { @@ -35,12 +36,15 @@ public HertlBotRootDao() private static EmbeddedStorageManager createStorageManager() { - final Configuration configuration = Configuration.Default(); - configuration.setBaseDirectory(Paths.get("data", "microstream", "storage").toString()); - configuration.setChannelCount(2); - - final EmbeddedStorageFoundation foundation = configuration.createEmbeddedStorageFoundation(); - + final EmbeddedStorageFoundation foundation = EmbeddedStorageConfiguration.Builder() + .setStorageDirectory(Paths.get("data", "microstream", "storage").toString()) + .setChannelCount(Math.max( + 1, // minimum one channel, if only 1 core is available + Integer.highestOneBit(Runtime.getRuntime().availableProcessors() - 1) + )) + .createEmbeddedStorageFoundation(); + + foundation.onConnectionFoundation(BinaryHandlersJDK17::registerJDK17TypeHandlers); final EmbeddedStorageManager storageManager = foundation.createEmbeddedStorageManager().start(); if (storageManager.root() == null) From cbdb04e1b77b6db4bb8213e75ba1f40069d04702 Mon Sep 17 00:00:00 2001 From: AM Date: Wed, 1 Nov 2023 12:07:14 +0100 Subject: [PATCH 2/9] Telegram update --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index dc53120..7d9c911 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ UTF-8 17 17 - 5.4.0 + 6.4.0 08.01.01-MS-GA From bf3e189e9a98900ce30509d2a5fcab4e1da34915 Mon Sep 17 00:00:00 2001 From: AM Date: Wed, 1 Nov 2023 19:35:57 +0100 Subject: [PATCH 3/9] github update to 17 --- .github/workflows/build_java.yml | 4 ++-- .github/workflows/build_java_docker.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_java.yml b/.github/workflows/build_java.yml index edb67d1..03bf11a 100644 --- a/.github/workflows/build_java.yml +++ b/.github/workflows/build_java.yml @@ -23,10 +23,10 @@ jobs: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v2 - - name: Set up JDK 11 + - name: Set up JDK 17 uses: actions/setup-java@v2 with: - java-version: '11' + java-version: '17' distribution: 'adopt' - name: Build with Maven run: mvn clean package \ No newline at end of file diff --git a/.github/workflows/build_java_docker.yml b/.github/workflows/build_java_docker.yml index 5c336dd..88e238f 100644 --- a/.github/workflows/build_java_docker.yml +++ b/.github/workflows/build_java_docker.yml @@ -26,10 +26,10 @@ jobs: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v3 - - name: Set up JDK 11 + - name: Set up JDK 17 uses: actions/setup-java@v3 with: - java-version: '11' + java-version: '17' distribution: 'adopt' - name: Build with Maven run: mvn clean package From 6f4bf46c9147a3f3d91e410b873d2b9649ee5437 Mon Sep 17 00:00:00 2001 From: AM Date: Wed, 1 Nov 2023 19:41:44 +0100 Subject: [PATCH 4/9] Update actions --- .github/workflows/build_java.yml | 4 ++-- .github/workflows/build_java_docker.yml | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build_java.yml b/.github/workflows/build_java.yml index 03bf11a..ae5aac8 100644 --- a/.github/workflows/build_java.yml +++ b/.github/workflows/build_java.yml @@ -21,10 +21,10 @@ jobs: # Steps represent a sequence of tasks that will be executed as part of the job steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up JDK 17 - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 with: java-version: '17' distribution: 'adopt' diff --git a/.github/workflows/build_java_docker.yml b/.github/workflows/build_java_docker.yml index 88e238f..5f10db3 100644 --- a/.github/workflows/build_java_docker.yml +++ b/.github/workflows/build_java_docker.yml @@ -24,7 +24,7 @@ jobs: # Steps represent a sequence of tasks that will be executed as part of the job steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up JDK 17 uses: actions/setup-java@v3 @@ -49,10 +49,10 @@ jobs: id: git-branch-name uses: EthanSK/git-branch-name-action@v2 - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/download-artifact@v3 with: From 522cedef5428544dc419b4d3598f78278f3bee8f Mon Sep 17 00:00:00 2001 From: AM Date: Wed, 1 Nov 2023 20:56:54 +0100 Subject: [PATCH 5/9] downgrade gitbranch action --- .github/workflows/build_java_docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_java_docker.yml b/.github/workflows/build_java_docker.yml index 5f10db3..e8b32bd 100644 --- a/.github/workflows/build_java_docker.yml +++ b/.github/workflows/build_java_docker.yml @@ -47,7 +47,7 @@ jobs: steps: - name: Git branch name id: git-branch-name - uses: EthanSK/git-branch-name-action@v2 + uses: EthanSK/git-branch-name-action@v1 - name: Checkout uses: actions/checkout@v4 From acdd9ffc249a1844f7d5a18b2a4f7f39e2359c2c Mon Sep 17 00:00:00 2001 From: AM Date: Thu, 2 Nov 2023 21:45:34 +0100 Subject: [PATCH 6/9] docker downgrade to 17 --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index bf5a5ec..5bdffd3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM eclipse-temurin:21-jammy +FROM eclipse-temurin:17-jammy LABEL maintainer="AMDev" RUN groupadd --system -g 1001 telegrambot && adduser --uid 1001 --gid 1001 --disabled-password --shell /bin/false telegrambot From 72f9ad1209c0ec3b328923bc6d9e71a1bcfedd67 Mon Sep 17 00:00:00 2001 From: AM Date: Sun, 5 Nov 2023 11:13:27 +0100 Subject: [PATCH 7/9] update depolyment --- .github/workflows/build_java_docker.yml | 2 +- create_volume.sh | 11 +++- .../hertlhendl/HertlHendlBot.java | 60 +++++++++---------- 3 files changed, 39 insertions(+), 34 deletions(-) diff --git a/.github/workflows/build_java_docker.yml b/.github/workflows/build_java_docker.yml index e8b32bd..9c97359 100644 --- a/.github/workflows/build_java_docker.yml +++ b/.github/workflows/build_java_docker.yml @@ -105,4 +105,4 @@ jobs: SSH_PRIVATE_KEY: ${{secrets.SSH_PRIVATE_KEY}} SSH_KNOWN_HOSTS: ${{secrets.SSH_KNOWN_HOSTS}} - name: start docker with ssh - run: ssh -i ~/private.key -p 19999 bigmama@bigamgamen.de '/home/bigmama/progs/docker/start_bot_${{ env.GIT_BRANCH_NAME }}.sh' + run: ssh -i ~/private.key -p 19999 bigmama@bigamgamen.de 'docker remove -f bot-${{ env.GIT_BRANCH_NAME }} 2> /dev/null && docker run -v chatbotvol-${{ env.GIT_BRANCH_NAME }}:/opt/telegrambot/data --env-file ~/chatbot/env_${{ env.GIT_BRANCH_NAME }} --restart unless-stopped --name bot-${{ env.GIT_BRANCH_NAME }} amgamen/chatbot:${{ env.GIT_BRANCH_NAME }}' diff --git a/create_volume.sh b/create_volume.sh index 653c94b..5490bc2 100644 --- a/create_volume.sh +++ b/create_volume.sh @@ -1,2 +1,9 @@ -docker volume create --opt type=none --opt o=bind --opt device=~/data/chatbotvol-develop --name chatbotvol-develop -chown 1001:1001 ~/data/chatbotvol-develop \ No newline at end of file +mkdir -p /home/bigmama/chatbot/data/chatbotvol-develop +chown 1001:1001 /home/bigmama/chatbot/data/chatbotvol-develop +docker volume create --opt type=none --opt o=bind --opt device=/home/bigmama/chatbot/data/chatbotvol-develop --name chatbotvol-develop +mkdir -p /home/bigmama/chatbot/data/chatbotvol-staging +chown 1001:1001 /home/bigmama/chatbot/data/chatbotvol-staging +docker volume create --opt type=none --opt o=bind --opt device=/home/bigmama/chatbot/data/chatbotvol-staging --name chatbotvol-staging +mkdir -p /home/bigmama/chatbot/data/chatbotvol-main +chown 1001:1001 /home/bigmama/chatbot/data/chatbotvol-main +docker volume create --opt type=none --opt o=bind --opt device=/home/bigmama/chatbot/data/chatbotvol-main --name chatbotvol-main diff --git a/src/main/java/de/bigamgamen/java/telegrambots/hertlhendl/HertlHendlBot.java b/src/main/java/de/bigamgamen/java/telegrambots/hertlhendl/HertlHendlBot.java index 8d28a85..55ee61d 100644 --- a/src/main/java/de/bigamgamen/java/telegrambots/hertlhendl/HertlHendlBot.java +++ b/src/main/java/de/bigamgamen/java/telegrambots/hertlhendl/HertlHendlBot.java @@ -18,21 +18,21 @@ package de.bigamgamen.java.telegrambots.hertlhendl; -import static org.telegram.abilitybots.api.objects.Locality.ALL; -import static org.telegram.abilitybots.api.objects.Privacy.PUBLIC; - -import java.io.IOException; -import java.io.InputStream; -import java.math.BigInteger; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.URL; -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; - -import javax.xml.parsers.ParserConfigurationException; - +import com.google.common.annotations.VisibleForTesting; +import de.bigamgamen.java.helper.IOHelper; +import de.bigamgamen.java.helper.PaypalLinkGenerator; +import de.bigamgamen.java.telegrambots.hertlhendl.api.RightController; +import de.bigamgamen.java.telegrambots.hertlhendl.api.RoleController; +import de.bigamgamen.java.telegrambots.hertlhendl.builder.TelegramKeyBoardBuilder; +import de.bigamgamen.java.telegrambots.hertlhendl.controller.HertlRightController; +import de.bigamgamen.java.telegrambots.hertlhendl.controller.HertlRoleController; +import de.bigamgamen.java.telegrambots.hertlhendl.dal.HertlBotRootDao; +import de.bigamgamen.java.telegrambots.hertlhendl.domain.HertlBotArticle; +import de.bigamgamen.java.telegrambots.hertlhendl.domain.HertlBotOrder; +import de.bigamgamen.java.telegrambots.hertlhendl.domain.HertlBotUser; +import de.bigamgamen.java.telegrambots.hertlhendl.helper.OrderHelper; +import de.bigamgamen.java.telegrambots.hertlhendl.helper.TelegramHelper; +import de.bigamgamen.java.telegrambots.hertlhendl.init.InitArticles; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.telegram.abilitybots.api.bot.AbilityBot; @@ -50,22 +50,19 @@ import org.telegram.telegrambots.updatesreceivers.DefaultBotSession; import org.xml.sax.SAXException; -import com.google.common.annotations.VisibleForTesting; +import javax.xml.parsers.ParserConfigurationException; +import java.io.IOException; +import java.io.InputStream; +import java.math.BigInteger; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; -import de.bigamgamen.java.helper.IOHelper; -import de.bigamgamen.java.helper.PaypalLinkGenerator; -import de.bigamgamen.java.telegrambots.hertlhendl.api.RightController; -import de.bigamgamen.java.telegrambots.hertlhendl.api.RoleController; -import de.bigamgamen.java.telegrambots.hertlhendl.builder.TelegramKeyBoardBuilder; -import de.bigamgamen.java.telegrambots.hertlhendl.controller.HertlRightController; -import de.bigamgamen.java.telegrambots.hertlhendl.controller.HertlRoleController; -import de.bigamgamen.java.telegrambots.hertlhendl.dal.HertlBotRootDao; -import de.bigamgamen.java.telegrambots.hertlhendl.domain.HertlBotArticle; -import de.bigamgamen.java.telegrambots.hertlhendl.domain.HertlBotOrder; -import de.bigamgamen.java.telegrambots.hertlhendl.domain.HertlBotUser; -import de.bigamgamen.java.telegrambots.hertlhendl.helper.OrderHelper; -import de.bigamgamen.java.telegrambots.hertlhendl.helper.TelegramHelper; -import de.bigamgamen.java.telegrambots.hertlhendl.init.InitArticles; +import static org.telegram.abilitybots.api.objects.Locality.ALL; +import static org.telegram.abilitybots.api.objects.Privacy.PUBLIC; public class HertlHendlBot extends AbilityBot @@ -104,8 +101,9 @@ public class HertlHendlBot extends AbilityBot private final static String ADMIN_DEFAULT_NAME = "Admin"; private static Integer CREATOR_ID = 0; + //NOTE needs an screenshot server like this https://hub.docker.com/r/rootzoll/web-screenshot private static String HERTL_URL = - "http://ks3266365.kimsufi.com:2341/?url=https://hertel-haehnchen.de/standplatzsuche?search=92637"; + "http://ks3266365.kimsufi.com:2341/?url=https://hertel-grillgenuss.de/standortsuche?search=92637&day=All"; private static HertlBotRootDao hertlBotDao; private final TelegramKeyBoardBuilder keyBoardBuilder; From 61b62432f5985743bff814bbae1e62d9b5d2f202 Mon Sep 17 00:00:00 2001 From: AM Date: Sun, 5 Nov 2023 11:59:25 +0100 Subject: [PATCH 8/9] update url --- .github/workflows/build_java_docker.yml | 2 +- .../java/telegrambots/hertlhendl/HertlHendlBot.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_java_docker.yml b/.github/workflows/build_java_docker.yml index 9c97359..ebb5ec1 100644 --- a/.github/workflows/build_java_docker.yml +++ b/.github/workflows/build_java_docker.yml @@ -105,4 +105,4 @@ jobs: SSH_PRIVATE_KEY: ${{secrets.SSH_PRIVATE_KEY}} SSH_KNOWN_HOSTS: ${{secrets.SSH_KNOWN_HOSTS}} - name: start docker with ssh - run: ssh -i ~/private.key -p 19999 bigmama@bigamgamen.de 'docker remove -f bot-${{ env.GIT_BRANCH_NAME }} 2> /dev/null && docker run -v chatbotvol-${{ env.GIT_BRANCH_NAME }}:/opt/telegrambot/data --env-file ~/chatbot/env_${{ env.GIT_BRANCH_NAME }} --restart unless-stopped --name bot-${{ env.GIT_BRANCH_NAME }} amgamen/chatbot:${{ env.GIT_BRANCH_NAME }}' + run: ssh -i ~/private.key -p 19999 bigmama@bigamgamen.de 'docker remove -f bot-${{ env.GIT_BRANCH_NAME }} && docker run -v chatbotvol-${{ env.GIT_BRANCH_NAME }}:/opt/telegrambot/data --env-file ~/chatbot/env_${{ env.GIT_BRANCH_NAME }} --restart unless-stopped --name bot-${{ env.GIT_BRANCH_NAME }} amgamen/chatbot:${{ env.GIT_BRANCH_NAME }}' diff --git a/src/main/java/de/bigamgamen/java/telegrambots/hertlhendl/HertlHendlBot.java b/src/main/java/de/bigamgamen/java/telegrambots/hertlhendl/HertlHendlBot.java index 55ee61d..be44bc4 100644 --- a/src/main/java/de/bigamgamen/java/telegrambots/hertlhendl/HertlHendlBot.java +++ b/src/main/java/de/bigamgamen/java/telegrambots/hertlhendl/HertlHendlBot.java @@ -101,9 +101,9 @@ public class HertlHendlBot extends AbilityBot private final static String ADMIN_DEFAULT_NAME = "Admin"; private static Integer CREATOR_ID = 0; - //NOTE needs an screenshot server like this https://hub.docker.com/r/rootzoll/web-screenshot + //NOTE needs an screenshot server like this https://hub.docker.com/r/branchard/website-screenshot-microservice private static String HERTL_URL = - "http://ks3266365.kimsufi.com:2341/?url=https://hertel-grillgenuss.de/standortsuche?search=92637&day=All"; + "http://bigamgamen.de:1082/?url=https://hertel-grillgenuss.de/standortsuche?search=92637&day=All"; private static HertlBotRootDao hertlBotDao; private final TelegramKeyBoardBuilder keyBoardBuilder; From c6ae1c7317d2c7855e70443a36324a8a3c64eb48 Mon Sep 17 00:00:00 2001 From: AM Date: Sun, 5 Nov 2023 13:18:48 +0100 Subject: [PATCH 9/9] starting detached --- .github/workflows/build_java_docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_java_docker.yml b/.github/workflows/build_java_docker.yml index ebb5ec1..83f9633 100644 --- a/.github/workflows/build_java_docker.yml +++ b/.github/workflows/build_java_docker.yml @@ -105,4 +105,4 @@ jobs: SSH_PRIVATE_KEY: ${{secrets.SSH_PRIVATE_KEY}} SSH_KNOWN_HOSTS: ${{secrets.SSH_KNOWN_HOSTS}} - name: start docker with ssh - run: ssh -i ~/private.key -p 19999 bigmama@bigamgamen.de 'docker remove -f bot-${{ env.GIT_BRANCH_NAME }} && docker run -v chatbotvol-${{ env.GIT_BRANCH_NAME }}:/opt/telegrambot/data --env-file ~/chatbot/env_${{ env.GIT_BRANCH_NAME }} --restart unless-stopped --name bot-${{ env.GIT_BRANCH_NAME }} amgamen/chatbot:${{ env.GIT_BRANCH_NAME }}' + run: ssh -i ~/private.key -p 19999 bigmama@bigamgamen.de 'docker remove -f bot-${{ env.GIT_BRANCH_NAME }} && docker run -d -v chatbotvol-${{ env.GIT_BRANCH_NAME }}:/opt/telegrambot/data --env-file ~/chatbot/env_${{ env.GIT_BRANCH_NAME }} --restart unless-stopped --name bot-${{ env.GIT_BRANCH_NAME }} amgamen/chatbot:${{ env.GIT_BRANCH_NAME }}'