diff --git a/.gitmodules b/.gitmodules index ac5bd60d..f72ea2ba 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,9 +1,9 @@ -[submodule "shd-bot/src/bot/config"] - path = shd-bot/src/bot/config +[submodule "bot/src/bot/config"] + path = bot/src/bot/config url = https://git.sh-edraft.de/sh-edraft.de/sh_discord_bot.config.git -[submodule "shb-bot/src/bot_api/config"] - path = shb-bot/src/bot_api/config +[submodule "bot/src/bot_api/config"] + path = bot/src/bot_api/config url = https://git.sh-edraft.de/sh-edraft.de/sh_discord_bot.api.config.git -[submodule "shb-bot/bot/docker"] - path = shb-bot/bot/docker +[submodule "bot/docker"] + path = bot/docker url = https://git.sh-edraft.de/sh-edraft.de/sh_discord_bot.docker.git diff --git a/bot/LICENSE b/bot/LICENSE new file mode 100644 index 00000000..374f2e3a --- /dev/null +++ b/bot/LICENSE @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) 2022-2023 sh-edraft.de + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/bot/README.md b/bot/README.md new file mode 100644 index 00000000..72b3dd33 --- /dev/null +++ b/bot/README.md @@ -0,0 +1,2 @@ +# kd_discord_bot + diff --git a/bot/cpl-workspace.json b/bot/cpl-workspace.json new file mode 100644 index 00000000..833b19a0 --- /dev/null +++ b/bot/cpl-workspace.json @@ -0,0 +1,46 @@ +{ + "WorkspaceSettings": { + "DefaultProject": "bot", + "Projects": { + "bot": "src/bot/bot.json", + "bot-api": "src/bot_api/bot-api.json", + "bot-core": "src/bot_core/bot-core.json", + "bot-data": "src/bot_data/bot-data.json", + "bot-graphql": "src/bot_graphql/bot-graphql.json", + "achievements": "src/modules/achievements/achievements.json", + "auto-role": "src/modules/auto_role/auto-role.json", + "base": "src/modules/base/base.json", + "boot-log": "src/modules/boot_log/boot-log.json", + "config": "src/modules/config/config.json", + "database": "src/modules/database/database.json", + "level": "src/modules/level/level.json", + "permission": "src/modules/permission/permission.json", + "technician": "src/modules/technician/technician.json", + "short-role-name": "src/modules/short_role_name/short-role-name.json", + "special-offers": "src/modules/special_offers/special-offers.json", + "checks": "tools/checks/checks.json", + "get-version": "tools/get_version/get-version.json", + "post-build": "tools/post_build/post-build.json", + "set-version": "tools/set_version/set-version.json" + }, + "Scripts": { + "format": "black ./", + "sv": "cpl set-version $ARGS", + "set-version": "cpl run set-version $ARGS --dev; echo '';", + "gv": "cpl get-version", + "get-version": "export VERSION=$(cpl run get-version --dev); echo $VERSION;", + "pre-build": "cpl set-version $ARGS; black ./;", + "post-build": "cpl run post-build --dev; black ./;", + "pre-prod": "cpl build", + "prod": "export KDB_ENVIRONMENT=production; export KDB_NAME=KDB-Prod; cpl start;", + "pre-stage": "cpl build", + "stage": "export KDB_ENVIRONMENT=staging; export KDB_NAME=KDB-Stage; cpl start;", + "pre-dev": "cpl build", + "dev": "export KDB_ENVIRONMENT=development; export KDB_NAME=KDB-Dev; cpl start;", + "docker-build": "cpl build $ARGS; docker build -t sh-edraft.de/kdb-bot:$(cpl gv) .;", + "dc-up": "docker-compose up -d", + "dc-down": "docker-compose down", + "docker": "cpl dc-down; cpl docker-build; cpl dc-up;" + } + } +} \ No newline at end of file diff --git a/bot/dockerfile b/bot/dockerfile new file mode 100644 index 00000000..478bf7e7 --- /dev/null +++ b/bot/dockerfile @@ -0,0 +1,21 @@ +# syntax=docker/dockerfile:1 +FROM python:3.10.4-alpine + +WORKDIR /app +COPY ./dist/bot/build/kdb-bot/ . +COPY ./dist/bot/build/requirements.txt . + +RUN python -m pip install --upgrade pip + +RUN apk update +RUN apk add --update alpine-sdk linux-headers +RUN apk add bash +RUN apk add nano + +RUN pip install -r requirements.txt --extra-index-url https://pip.sh-edraft.de +RUN pip install flask[async] + +# RUN pip install dnspython==2.2.1 # https://stackoverflow.com/questions/75137717/eventlet-dns-python-attribute-error-module-dns-rdtypes-has-no-attribute-any +# ^ probably fixed py package updates + +CMD [ "bash", "/app/bot/bot"] diff --git a/bot/pyproject.toml b/bot/pyproject.toml new file mode 100644 index 00000000..e34796ec --- /dev/null +++ b/bot/pyproject.toml @@ -0,0 +1,2 @@ +[tool.black] +line-length = 120 \ No newline at end of file