-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feat/monitoring
- Loading branch information
Showing
59 changed files
with
620 additions
and
1,240 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Download from crowdin | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: 0 * * * * | ||
|
||
jobs: | ||
download: | ||
runs-on: ubuntu-latest | ||
# secrets cannot be accessed inside an `if` so this needs to be checked in separate job | ||
name: dowload | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
ref: master | ||
|
||
- name: Install crowdin cli | ||
run: | | ||
wget -qO - https://artifacts.crowdin.com/repo/GPG-KEY-crowdin | sudo apt-key add - | ||
echo "deb https://artifacts.crowdin.com/repo/deb/ /" | sudo tee -a /etc/apt/sources.list.d/crowdin.list | ||
sudo apt-get update && sudo apt-get install crowdin3 | ||
- name: Download translations | ||
shell: bash | ||
run: | | ||
crowdin download --all | ||
env: | ||
CROWDIN_API_KEY: ${{ secrets.CROWDIN_API_KEY }} | ||
|
||
- uses: tibdex/github-app-token@v1 | ||
id: generate-token | ||
with: | ||
app_id: ${{ secrets.APP_ID }} | ||
private_key: ${{ secrets.APP_PRIVATE_KEY }} | ||
|
||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v5 | ||
with: | ||
token: ${{ steps.generate-token.outputs.token }} | ||
commit-message: "PO files added." | ||
branch: auto/crowdin | ||
title: "Update translations" | ||
add-paths: "**.po" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Upload to crowdin | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: [master] | ||
paths: | ||
- "**.py" | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: master | ||
|
||
- name: Install crowdin cli | ||
run: | | ||
wget -qO - https://artifacts.crowdin.com/repo/GPG-KEY-crowdin | sudo apt-key add - | ||
echo "deb https://artifacts.crowdin.com/repo/deb/ /" | sudo tee -a /etc/apt/sources.list.d/crowdin.list | ||
sudo apt-get update && sudo apt-get install crowdin3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.11" | ||
cache: pip | ||
|
||
- name: babel extract (pot file generation) | ||
run: | | ||
pip install babel | ||
sh ./bin/pot-generation.sh | ||
- name: Upload sources | ||
shell: bash | ||
run: | | ||
crowdin upload | ||
env: | ||
CROWDIN_API_KEY: ${{ secrets.CROWDIN_API_KEY }} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,29 @@ | ||
FROM python:3.11.2 as base | ||
FROM python:3.12.0-alpine as build | ||
RUN python -m venv /opt/venv | ||
ENV PATH="/opt/venv/bin:$PATH" | ||
RUN --mount=type=cache,target=/var/cache/apk/ \ | ||
--mount=type=cache,target=/root/.cache/pip \ | ||
--mount=type=bind,source=requirements.txt,target=requirements.txt \ | ||
: \ | ||
&& apk add gcc musl-dev linux-headers \ | ||
&& pip install -U -r requirements.txt | ||
|
||
|
||
FROM python:3.12.0-alpine as base | ||
WORKDIR /app | ||
COPY --from=build /opt/venv /opt/venv | ||
COPY ./alembic.ini ./src ./ | ||
COPY ./alembic ./alembic | ||
ENV PATH="/opt/venv/bin:$PATH" | ||
ENV PYTHONUNBUFFERED=0 | ||
COPY requirements.txt alembic.ini ./ | ||
RUN pip install -U -r requirements.txt | ||
|
||
|
||
FROM base as prod | ||
COPY ./src ./ | ||
CMD ["/bin/bash", "-c", "alembic upgrade head && python ./main.py bot --sync -c ./config.toml"] | ||
CMD ["/bin/sh", "-c", "alembic upgrade head && python ./main.py bot --sync -c ./config.toml"] | ||
|
||
|
||
FROM base as debug | ||
ENV DEBUG=1 | ||
ENV LOG_LEVEL=DEBUG | ||
RUN pip install debugpy | ||
CMD ["/bin/bash", "-c", "alembic upgrade head && python -m debugpy --wait-for-client --listen 0.0.0.0:5678 ./src/main.py bot -c ./config.toml"] | ||
CMD ["/bin/sh", "-c", "alembic upgrade head && python -m debugpy --wait-for-client --listen 0.0.0.0:5678 ./main.py bot -c ./config.toml"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,40 @@ | ||
# mybot | ||
<img src="https://bannermd.airopi.dev/banner?title=MyBot&desc=An%20original%20Discord%20bot!&repo=mybot-organization/mybot" width="100%" alt="banner"/> | ||
<p align="center"> | ||
<a href="https://www.buymeacoffee.com/airopi" target="_blank"> | ||
<img alt="Static Badge" src="https://img.shields.io/badge/Buy_me_a_coffee!-grey?style=for-the-badge&logo=buymeacoffee"> | ||
</a> | ||
</p> | ||
|
||
The official repository of Mybot project! | ||
<h1 align="center">MyBot</h1> | ||
|
||
In order to generate auto-migration scripts using alembic, stop the bot (docker-compose down), run the database (docker-compose up -d database) and enter in shell : | ||
`docker-compose run --rm -it --entrypoint=/bin/bash mybot -i` | ||
MyBot is an original Discord bot. It was created to offer useful and little-seen features. | ||
|
||
Then, apply eventual migrations : | ||
`alembic upgrade head` | ||
This project is motivated by a desire to do things to the maximum possible extent, offering the richest possible functionality! | ||
|
||
And finally, create a migration script : | ||
`alembic revision --autogenerate -m "your message"` | ||
## Links | ||
|
||
- [Support](https://support.mybot.airopi.dev/) | ||
- [Invite](https://invite.mybot.airopi.dev/) | ||
|
||
Commands : | ||
```bash | ||
docker-compose down | ||
docker-compose build | ||
docker-compose up -d database | ||
docker-compose run --rm -it --entrypoint=/bin/bash mybot -i | ||
alembic upgrade head | ||
alembic revision --autogenerate -m "your message" | ||
``` | ||
## Using | ||
|
||
- [Python 3.12](https://www.python.org/) | ||
- [discord.py](https://discordpy.readthedocs.io/en/latest/) | ||
- [PostgreSQL 14](https://www.postgresql.org/) | ||
- [TimeScale](https://www.timescale.com/) | ||
|
||
## Deploy | ||
|
||
_Soon_ | ||
|
||
## Support, Feedback and Community | ||
|
||
You can reach me over Discord at `@airo.pi`. Feel free to open an issue if you encounter any problem! | ||
|
||
## How to contribute | ||
|
||
I would ❤️ to see your contribution! Refer to [CONTRIBUTING.md](/CONTRIBUTING.md) | ||
|
||
## License | ||
|
||
MyBot is under the [MIT Licence](/LICENSE). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
docker compose --progress quiet up database -d --quiet-pull | ||
docker compose --progress quiet run --rm -t -v "${PWD}/alembic:/app/alembic" mybot alembic "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
#!/usr/bin/env bash | ||
python3 ./bin/msgfmt.py ./data/locale/**/LC_MESSAGES/*.po | ||
python3 ./bin/msgfmt.py ./resources/locale/**/LC_MESSAGES/*.po |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
project_id: "532668" | ||
api_token_env: CROWDIN_API_KEY | ||
|
||
files: | ||
- source: /data/locale/*.pot | ||
translation: /data/locale/%locale%/LC_MESSAGES/%file_name%.po | ||
- source: /resources/locale/*.pot | ||
translation: /resources/locale/%locale%/LC_MESSAGES/%file_name%.po |
Binary file not shown.
Oops, something went wrong.