From 61597737e151757834f8f597208584f46f5081a2 Mon Sep 17 00:00:00 2001 From: "airo.pi_" <47398145+AiroPi@users.noreply.github.com> Date: Tue, 5 Dec 2023 23:42:06 +0100 Subject: [PATCH 01/11] Dockerfile optimisations! --- Dockerfile | 27 +++++++++++++++++++++------ bin/alembic.sh | 2 ++ docker-compose.dev.yml | 2 -- docker-compose.yml | 8 ++++++-- 4 files changed, 29 insertions(+), 10 deletions(-) create mode 100644 bin/alembic.sh diff --git a/Dockerfile b/Dockerfile index 914e1b5..9bfe296 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,30 @@ -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 +ENV PATH="/opt/venv/bin:$PATH" ENV PYTHONUNBUFFERED=0 -COPY requirements.txt alembic.ini ./ -RUN pip install -U -r requirements.txt +COPY ./alembic.ini ./ +COPY ./alembic ./alembic +COPY ./src ./ + 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"] diff --git a/bin/alembic.sh b/bin/alembic.sh new file mode 100644 index 0000000..75ea34e --- /dev/null +++ b/bin/alembic.sh @@ -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 "$@" diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 56d7243..327c9aa 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -5,8 +5,6 @@ services: build: target: debug restart: "no" - volumes: - - ./src:/app/src ports: - 5678:5678 # for debugging - 8080:8080 diff --git a/docker-compose.yml b/docker-compose.yml index ff7bdbf..4e8476c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,6 +7,11 @@ services: context: . dockerfile: ./Dockerfile target: prod + develop: + watch: + - action: sync + path: ./src + target: /app env_file: - .env tty: true @@ -15,8 +20,7 @@ services: database: condition: service_healthy volumes: - - ./data/locale:/app/locale - - ./alembic:/app/alembic + - ./resources/locale:/app/locale - ./config.toml:/app/config.toml ports: - 666:8081 From 986e9eb840e4c937ad16fb04f9b972e4b2b18417 Mon Sep 17 00:00:00 2001 From: "airo.pi_" <47398145+AiroPi@users.noreply.github.com> Date: Tue, 5 Dec 2023 23:55:13 +0100 Subject: [PATCH 02/11] move locale from data to resources These data are not supposed to be changed by the application, they are static. --- .github/workflows/generate-pot-file.yml | 4 ++-- bin/po-to-mo.sh | 2 +- bin/pot-generation.sh | 2 +- crowdin.yml | 4 ++-- {data => resources}/locale/fr/LC_MESSAGES/mybot.mo | Bin {data => resources}/locale/fr/LC_MESSAGES/mybot.po | 0 {data => resources}/locale/mybot.pot | 0 7 files changed, 6 insertions(+), 6 deletions(-) rename {data => resources}/locale/fr/LC_MESSAGES/mybot.mo (100%) rename {data => resources}/locale/fr/LC_MESSAGES/mybot.po (100%) rename {data => resources}/locale/mybot.pot (100%) diff --git a/.github/workflows/generate-pot-file.yml b/.github/workflows/generate-pot-file.yml index af394f0..02a40aa 100644 --- a/.github/workflows/generate-pot-file.yml +++ b/.github/workflows/generate-pot-file.yml @@ -41,8 +41,8 @@ jobs: - name: commit run: | - mv -f master/data/locale/mybot.pot translations/data/locale/mybot.pot + mv -f master/resources/locale/mybot.pot translations/resources/locale/mybot.pot cd translations - git add ./data/locale/mybot.pot + git add ./resources/locale/mybot.pot git commit -m "POT file generated" git push origin auto/translations-source diff --git a/bin/po-to-mo.sh b/bin/po-to-mo.sh index 61e0661..5cbf6d4 100644 --- a/bin/po-to-mo.sh +++ b/bin/po-to-mo.sh @@ -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 diff --git a/bin/pot-generation.sh b/bin/pot-generation.sh index 6549570..3a9c241 100755 --- a/bin/pot-generation.sh +++ b/bin/pot-generation.sh @@ -4,5 +4,5 @@ pybabel extract \ --project="MyBot" \ --version="1.0" \ -k "_ __" \ - -o ./data/locale/mybot.pot \ + -o ./resources/locale/mybot.pot \ ./src/ diff --git a/crowdin.yml b/crowdin.yml index 88c418f..eb47f01 100644 --- a/crowdin.yml +++ b/crowdin.yml @@ -1,3 +1,3 @@ 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 diff --git a/data/locale/fr/LC_MESSAGES/mybot.mo b/resources/locale/fr/LC_MESSAGES/mybot.mo similarity index 100% rename from data/locale/fr/LC_MESSAGES/mybot.mo rename to resources/locale/fr/LC_MESSAGES/mybot.mo diff --git a/data/locale/fr/LC_MESSAGES/mybot.po b/resources/locale/fr/LC_MESSAGES/mybot.po similarity index 100% rename from data/locale/fr/LC_MESSAGES/mybot.po rename to resources/locale/fr/LC_MESSAGES/mybot.po diff --git a/data/locale/mybot.pot b/resources/locale/mybot.pot similarity index 100% rename from data/locale/mybot.pot rename to resources/locale/mybot.pot From 3eccaa77614be4865df45b20628309fbc3c2880c Mon Sep 17 00:00:00 2001 From: "airo.pi_" <47398145+AiroPi@users.noreply.github.com> Date: Tue, 5 Dec 2023 23:58:31 +0100 Subject: [PATCH 03/11] merge COPY instructions --- Dockerfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9bfe296..8d24877 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,11 +12,10 @@ RUN --mount=type=cache,target=/var/cache/apk/ \ 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 ./alembic.ini ./ -COPY ./alembic ./alembic -COPY ./src ./ FROM base as prod From e3ea8cc06cf325ea5cd8355e12a20d90c2541e55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C4=B1=CE=B5=D1=8F=D1=8F=CE=B5?= <47398145+AiroPi@users.noreply.github.com> Date: Wed, 6 Dec 2023 00:21:40 +0100 Subject: [PATCH 04/11] Update README --- README.md | 51 ++++++++++++++++++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index ec82aa0..2f0fec7 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,40 @@ -# mybot +banner +

+ + Static Badge + +

-The official repository of Mybot project! +

MyBot

-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). From c48689a862d7867b9bd3f7c280971e616839f3d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C4=B1=CE=B5=D1=8F=D1=8F=CE=B5?= <47398145+AiroPi@users.noreply.github.com> Date: Wed, 6 Dec 2023 00:48:26 +0100 Subject: [PATCH 05/11] Update issue templates --- .github/ISSUE_TEMPLATE/bug_report.md | 24 ++++++----------------- .github/ISSUE_TEMPLATE/feature_request.md | 21 ++++++++++++-------- 2 files changed, 19 insertions(+), 26 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index dd84ea7..8640e25 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -2,20 +2,19 @@ name: Bug report about: Create a report to help us improve title: '' -labels: '' -assignees: '' +labels: unconfirmed bug +assignees: AiroPi --- + + + **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** -Steps to reproduce the behavior: -1. Go to '...' -2. Click on '....' -3. Scroll down to '....' -4. See error +The command you used (with arguments), the buttons you clicked, whatever you think is causing the bug. **Expected behavior** A clear and concise description of what you expected to happen. @@ -23,16 +22,5 @@ A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. -**Desktop (please complete the following information):** - - OS: [e.g. iOS] - - Browser [e.g. chrome, safari] - - Version [e.g. 22] - -**Smartphone (please complete the following information):** - - Device: [e.g. iPhone6] - - OS: [e.g. iOS8.1] - - Browser [e.g. stock browser, safari] - - Version [e.g. 22] - **Additional context** Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index bbcbbe7..81d6989 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -2,19 +2,24 @@ name: Feature request about: Suggest an idea for this project title: '' -labels: '' -assignees: '' +labels: feature request +assignees: AiroPi --- -**Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + + -**Describe the solution you'd like** -A clear and concise description of what you want to happen. +[ ] My idea is a whole new feature. +[ ] My suggestion is an enhancement of an existing feature. +[ ] My idea isn't related to the bot. -**Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. +**Describe your idea.** +A clear and concise description of what the problem is. Describe all the details you have in mind. + +**Alternatives** +Tell if you know alternatives / other bots that already do this. Explain why you don't use them, what is not great. +You can omit this question if you didn't find any other solution. **Additional context** Add any other context or screenshots about the feature request here. From 66b069464da8964424f0284cef742dbde8cc8040 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C4=B1=CE=B5=D1=8F=D1=8F=CE=B5?= <47398145+AiroPi@users.noreply.github.com> Date: Wed, 6 Dec 2023 01:12:01 +0100 Subject: [PATCH 06/11] Translations --- .github/workflows/generate-pot-file.yml | 16 +- resources/locale/fr/LC_MESSAGES/mybot.mo | Bin 12196 -> 10948 bytes resources/locale/fr/LC_MESSAGES/mybot.po | 563 +++++++++++++---------- resources/locale/mybot.pot | 484 ++++++++++--------- 4 files changed, 584 insertions(+), 479 deletions(-) diff --git a/.github/workflows/generate-pot-file.yml b/.github/workflows/generate-pot-file.yml index 02a40aa..1b10832 100644 --- a/.github/workflows/generate-pot-file.yml +++ b/.github/workflows/generate-pot-file.yml @@ -13,9 +13,6 @@ jobs: steps: - uses: actions/checkout@v3 - with: - ref: master - path: master/ - uses: actions/setup-python@v4 with: @@ -28,21 +25,14 @@ jobs: pip install babel sh ./bin/pot-generation.sh - - uses: actions/checkout@v3 - with: - ref: auto/translations-source - path: translations/ - - name: setup git run: | - cd translations git config user.name "GitHub Actions Bot" git config user.email "<>" - name: commit run: | - mv -f master/resources/locale/mybot.pot translations/resources/locale/mybot.pot - cd translations - git add ./resources/locale/mybot.pot + git switch -c auto/translations-source + git add ./data/locale/mybot.pot git commit -m "POT file generated" - git push origin auto/translations-source + git push origin auto/translations-source --force diff --git a/resources/locale/fr/LC_MESSAGES/mybot.mo b/resources/locale/fr/LC_MESSAGES/mybot.mo index 269d7c6fadbc6537192bbac19754f3ccb6ef673f..27c12364a61f806d317bd47004b82d38bf0c4319 100644 GIT binary patch delta 2685 zcmYk+32anF9LMo#DHM8AXz69k(o$NEZf__AkSY=`LBN866kN8i-O_efciRSu$r>=4 zihccu5jV;K}bn{5V?Wl?NIrZZ>k@^Ryz;5AEEF`+=*oCt( zf(_V@Q*b#^Ye8FZ1oN9WC}<_8d1!)*j#rUjO&@0AKbVOb$;PB(DUQJVuo3HV6uynI zcnSHLPkBtl?=S^ZcxawHOksZGrl5{9Py;S-I;_T#)C11@O_)l38?qR)*YPk8rhWpo z<)?5Qp1~r#i8+|Y$GJEO^KdSPwbe~d!!uYzy%+QGD|F#)R3JHotuu5xHlzCOLFO>0 zP&x21R$wgWHUq1%8iS~Q`%&{AOJo0a7N65F3Hwo7Rm3)w;}X=w8}UKhiCV$;xEA$N zN909K+>Q!pFKV3kunvDg&Ew|WT=)=bzQ@zq{}KwjX&@WTIn)+jL>6H_!$Ei*bwoFC z7WSjIaB4<0pcSYs5221?7b@%bIPORC(;PvKcLLS#-LTW)G%A4esEIBki!@hJ9sk65 z{M#{>OjDogxW=hBp$2Gm+C#`L znhnnTEl#_Q8fX`40S8b=@}}cS)c9wS3uMlt0{$Xu*nCYvA6!Fi(XYtQ^z$g<9;I^U zN~zamN0Z2l8t4Vo5xs`Gp2u)DUcf3$C*`%Exu}IK#yPkG6~OL+cFw=o>2L@ucySbq z@H&!@CW(yGQRJiUe+4p!nTKxl;!NzpCcK18u$KQ$oAEivK3qV3C5fZt+lTqgZ!S~N z1bwIp29v_{HF>BlpN6_Fi?9&=NNlDD706-KZ8+!DC(v2BFdNBJGZ%FW8l3tosQHd! zSX+3Gg8UN6FY`0%2<{?3Gs+bWWHPGXd{h#xLQT+$O0K6c5x1g_;3XW77m&4?+o)@p z$wLd7I)?kNd)h$51nkB-Jc|6xUp#aaSq0G@nTgY=ufm6MCu*XbsDMT@>U1o_nb?Lp zii3DR-a+-N8yn53C1b*tS)PPhye zcn=Qb66(yaqZV3O96kHhSVw(xn8H*FA7MPkmpJzsm3$dE2#cNiMAU~fkWWk)$v3kf zS)4hIL-0q`ZTbxd<89Qfxr>@7iF47Bh0`hM{uZJ>s6ZvhbjQW00oI}h_Mx^gfC?;( z8gLU1#myLp+fn^rblUfz0(~8o)Mumb!{!QwVKjV;3g8B6z+0#R?w|&aBSDmG$*6z| za2S@LR#J&tVIAuGMX2wVqmptBDydsh<8H)w-Lq~A2{dd&b$l5W>46FMw1g{>+QgMH zksp%Q$JiTEp0qPk|FH9h2O@`tw+^v)W*!`})@lj_E&I`|c@G3SEMu+rwskgIrpfYj zbOtTc>}luG+0xc%e4dc;S#6J*7Jsx)o8@or@R_z2f2*s+8evWkD-i2-zRz7R633kM!jh#YE=hy%iJjj=maW z`^LNzSyYf8V?STm6PY=-Ki+gPghh{m_$}AKa_o_1PyY+-ZB;4& delta 3683 zcmajge{5A}9mnzK0;TlluA)Ma(v_0eAd#?AK z+weoU*_;a+$QF+qQ8(Pk0?aVYywSNZhqDXWG-`CjAV!u9|6z^Ez-+;6I^Un(6My_+ zY)W6x^PK0$_j#W0IlQs``Q61UGp0Og_&LeHM*g)|sP^xlmDR>9qPhw@a5vWAF|5UJ z;ivEvF2|R#6~}Q2&ZP4c?8B+J3j1(fxn4AfC`_Z_(b!|C37*0xd<~h)T*2vh4YlA$ zalMu(?x4O972v(N4fnzkiY&<-vjW6cdz#{{ct z;ko=#dm9p~=|cs$9{Dvp`7;wALOnl>I=Q3BROT#lSmxE(H&M5I5sSK;%M@Dh9c;#_ zob#>Nj`MK?F2E#e;)mn;8Hv=JTLi(2p~F2z?+N&7D91jmuXGwEGf_Fv zfot#^s1tp=NI?-^M_oZ38Kt{ffqGpAP$#f9Zr>8O??5fI3-xxmaXpP1pF@owMFn~Y z70_eIVViHF`V~*dg%`1shEnXgxP1(@!?)u4uTcwMjN328?SDdzzlvIT92NMDxIMu! zC>g6zfy_hZEt=MH!L*|WcE|NT)P$?z_Iprwdtdx~4=NBFKle}*=TJL4j1%7#)a!aI z_Bd)o&ta|J|5Fq+pcMNGYQTBa(Y}RTtGS5!9*koRFYrz5pgx7q<_hdVJs(EpLWpeM zd==N>2~^Tu#ZGJ>0j9FPSx-Sb-Gu9LJ1U^3z2iKSf>H+o=BUp#rO3Qm!vVja$8>SkB7LG-!d{sH_c9pUkhI z?(A{Y4#tpEH-AAkWoozw<~ALu@5ffW9S@-bKZEM`9`b8yTgoTZg9Fqz7b$#!!q-s? zy@Ps9X1139*IJCayFI9@`Yzs$*HQg?`5Gw+??D9;pzi!QYJm&bg9)P7Rjt77cpo}g zJW1gIg)y9ls|jBVZa_u;7%J(`pmO3eYNsvyQEqHQ?X-yf_&QeNM_7TA>7*pB!pS&4 zt~VijD4K2x9uIb+CK@Y0FcoY|U&ap9&Nkvy%wRQ!s5>sA7J4f7Y1Bd|u@+CE0xF@d z_8ivXFR)tg|0N1armL|Zq9&~39OW&jg=eFVyb*O$?Wl!%Q493P?Q3xg^?Om{H>1XH zkDot?+L*;k);AARPs5^AB>Q2j2T0{Imxd4G>ua2yrbb<{i` zU_E|BY-{M) zlot}47dSaTo$fR{{Q~>_A%^ z^qIzIRK{oU#Dr-t!`#t_vtDX)v-=%444E-wv!QVdDbF{9mciCAGJ0|L#{NN@GK>zb zvHOzgLdu#U>xKn-40&lAm|-_#&2Yg>r_6{Om=T-K885>jMhoUFs>n{9(WmFMCWfOg z&gos4&m~P@-F$My5P2}-B>hZ=BQ+C;7oDCnQhV@_lku{J&@K(yqWXrt%e$6$boV*k z{R6#s-qFQR^_I;Y+w7FC1t#QeN7_N=qTQxML2 z%khy~cY7R7VP8~gI{triWux=A$|AeS`Grw?fLsfljGs~#lXC3D&!)J8PP4-=1P+OF zKo@PjEa6)AoEc=@jJwav6f#8bkV>gSQkTV4dFLU&kS}KvQ&ZL;rP4$>Z$mGyWoj%_ zIurS1qk*O8o3pK6CgU BX<+~W diff --git a/resources/locale/fr/LC_MESSAGES/mybot.po b/resources/locale/fr/LC_MESSAGES/mybot.po index 59d7cc5..80e6e79 100644 --- a/resources/locale/fr/LC_MESSAGES/mybot.po +++ b/resources/locale/fr/LC_MESSAGES/mybot.po @@ -2,289 +2,292 @@ msgid "" msgstr "" "Project-Id-Version: mybot-discord\n" "Report-Msgid-Bugs-To: contact@mybot-discord.com\n" -"POT-Creation-Date: 2023-03-18 19:56+0000\n" -"PO-Revision-Date: 2023-03-18 21:00\n" +"POT-Creation-Date: 2023-12-05 23:54+0000\n" +"PO-Revision-Date: 2023-12-05 23:57\n" "Last-Translator: \n" "Language-Team: French\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Generated-By: Babel 2.12.1\n" +"Generated-By: Babel 2.13.1\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" "X-Crowdin-Project: mybot-discord\n" "X-Crowdin-Project-ID: 532668\n" "X-Crowdin-Language: fr\n" -"X-Crowdin-File: /dev/data/locale/mybot.pot\n" -"X-Crowdin-File-ID: 48\n" +"X-Crowdin-File: /auto.translations-source/resources/locale/mybot.pot\n" +"X-Crowdin-File-ID: 60\n" "Language: fr_FR\n" -#: src/cogs/calculator.py:29 -msgid "calculator" -msgstr "calculatrice" +#: src/cogs/help.py:29 +msgid "slash command" +msgstr "commande slash" -#: src/cogs/calculator.py:30 -msgid "Show a calculator you can use." -msgstr "Afficher une calculatrice que vous pouvez utiliser." +#: src/cogs/help.py:30 +msgid "message context" +msgstr "contexte de message" -#: src/cogs/clear.py:77 -msgid "Delete multiple messages with some filters." -msgstr "Supprimer plusieurs messages avec des filtres." +#: src/cogs/help.py:31 +msgid "user context" +msgstr "contexte d'utilisateur" -#: src/cogs/clear.py:84 -msgid "image" -msgstr "image" +#: src/cogs/help.py:32 +msgid "miscellaneous" +msgstr "divers" -#: src/cogs/clear.py:85 -msgid "video" -msgstr "vidéo" +#: src/cogs/help.py:40 +msgid "help" +msgstr "aide" -#: src/cogs/clear.py:86 -msgid "audio" -msgstr "audio" +#: src/cogs/help.py:40 +msgid "Get help about the bot." +msgstr "Obtenir de l'aide à propos du bot." -#: src/cogs/clear.py:87 -msgid "stickers" -msgstr "autocollants" +#: src/cogs/help.py:41 +msgid "feature" +msgstr "fonctionnalité" -#: src/cogs/clear.py:88 -msgid "files" -msgstr "fichiers" +#: src/cogs/help.py:72 +msgid "Commands of MyBot" +msgstr "Commandes de MyBot" -#: src/cogs/clear.py:89 -msgid "any attachment" -msgstr "n'importe quel fichier" +#: src/cogs/help.py:76 +msgid "Slash commands" +msgstr "Commandes slash" -#: src/cogs/clear.py:90 -msgid "embed" -msgstr "embed" +#: src/cogs/help.py:77 +msgid "Context commands" +msgstr "Commandes contextuelles" -#: src/cogs/clear.py:91 -msgid "link (any URL)" -msgstr "lien (n'importe quelle URL)" +#: src/cogs/help.py:78 +msgid "Miscellaneous features" +msgstr "Fonctionnalités diverses" -#: src/cogs/clear.py:92 -msgid "mention" -msgstr "mention" +#: src/cogs/help.py:148 +msgid "Help about {} [{}]" +msgstr "Aide à propos de {} [{}]" -#: src/cogs/clear.py:93 -msgid "discord invitation" -msgstr "invitation discord" +#: src/cogs/ping.py:28 +msgid "ping" +msgstr "" -#: src/cogs/clear.py:96 -msgid "include" -msgstr "inclus" +#: src/cogs/ping.py:29 +msgid "Get the bot latency." +msgstr "Obtenir la latence du bot." -#: src/cogs/clear.py:97 -msgid "exclude" -msgstr "exclus" +#: src/cogs/stats.py:40 +msgid "stats" +msgstr "" -#: src/cogs/clear.py:98 -msgid "only" -msgstr "seulement" +#: src/cogs/stats.py:41 +msgid "Get some stats about the bot." +msgstr "" + +#: src/cogs/calculator/__init__.py:41 +msgid "calculator" +msgstr "calculatrice" -#: src/cogs/clear.py:102 +#: src/cogs/calculator/__init__.py:42 +msgid "Show a calculator you can use." +msgstr "Afficher une calculatrice que vous pouvez utiliser." + +#: src/cogs/calculator/__init__.py:66 +msgid "Invalid expression" +msgstr "" + +#: src/cogs/clear/__init__.py:54 +msgid "Delete multiple messages with some filters." +msgstr "Supprimer plusieurs messages avec des filtres." + +#: src/cogs/clear/__init__.py:60 msgid "The amount of messages to delete." msgstr "Le nombre de messages à supprimer." -#: src/cogs/clear.py:103 +#: src/cogs/clear/__init__.py:61 msgid "Delete only messages from the specified user." msgstr "Supprimer uniquement les messages de l'utilisateur spécifié." -#: src/cogs/clear.py:104 +#: src/cogs/clear/__init__.py:62 msgid "Delete only messages whose user has the specified role." msgstr "Supprimer uniquement les messages dont l'utilisateur a le rôle spécifié." -#: src/cogs/clear.py:105 +#: src/cogs/clear/__init__.py:63 msgid "Delete only messages that match the specified search (can be regex)." msgstr "Supprimer uniquement les messages qui correspondent à la recherche spécifiée (peut être une regex)." -#: src/cogs/clear.py:108 +#: src/cogs/clear/__init__.py:66 msgid "Delete only messages that contains the selected entry. #TODO" msgstr "Supprimer uniquement les messages qui contiennent l'entrée sélectionnée. #TODO" -#: src/cogs/clear.py:111 +#: src/cogs/clear/__init__.py:69 msgid "Delete only messages where length match the specified entry. (e.g. '<=100', '5', '>10') #TODO" msgstr "Supprimer uniquement les messages dont la longueur correspond à l'entrée. (ex : '<=100', '5', '>10')" -#: src/cogs/clear.py:112 +#: src/cogs/clear/__init__.py:70 msgid "Delete only messages sent before the specified message or date. (yyyy-mm-dd) #TODO" msgstr "Supprimer uniquement les messages envoyés avant le message ou la date spécifiés. (aaaa-mm-jj) #TODO" -#: src/cogs/clear.py:113 -msgid "Delete only messages sent after the specified message or date. (yyyy-mm-dd) #TODO" -msgstr "Supprimer uniquement les messages envoyés après le message ou la date spécifiés. (aaaa-mm-jj) #TODO" +#: src/cogs/clear/__init__.py:71 +msgid "Delete only messages sent after the specified message or date. (yyyy-mm-dd) #TODO" +msgstr "" -#: src/cogs/clear.py:114 +#: src/cogs/clear/__init__.py:72 msgid "Include/exclude pinned messages in deletion, or deletes \"only\" pinned messages. (default to exclude)" msgstr "Inclure/exclure les messages épinglés dans la suppression ou supprimer \"seulement\" ces messages." -#: src/cogs/clear.py:119 +#: src/cogs/clear/__init__.py:77 msgid "amount" msgstr "quantitée" -#: src/cogs/clear.py:120 +#: src/cogs/clear/__init__.py:78 msgid "user" msgstr "utilisateur" -#: src/cogs/clear.py:121 +#: src/cogs/clear/__init__.py:79 msgid "role" msgstr "rôle" -#: src/cogs/clear.py:122 +#: src/cogs/clear/__init__.py:80 msgid "search" msgstr "recherche" -#: src/cogs/clear.py:123 +#: src/cogs/clear/__init__.py:81 msgid "has" msgstr "contient" -#: src/cogs/clear.py:124 +#: src/cogs/clear/__init__.py:82 msgid "length" msgstr "longueur" -#: src/cogs/clear.py:125 +#: src/cogs/clear/__init__.py:83 msgid "before" msgstr "avant" -#: src/cogs/clear.py:126 +#: src/cogs/clear/__init__.py:84 msgid "after" msgstr "après" -#: src/cogs/clear.py:127 +#: src/cogs/clear/__init__.py:85 msgid "pinned" msgstr "épinglés" -#: src/cogs/clear.py:152 +#: src/cogs/clear/__init__.py:106 msgid "You must supply a number between 1 and 250. (0 < {amount} < 251)" msgstr "Vous devez fournir un nombre entre 1 et 250. (0 < {amount} < 251)" -#: src/cogs/clear.py:186 src/cogs/poll/edit.py:233 src/cogs/poll/edit.py:326 -#: src/cogs/poll/edit.py:384 src/cogs/poll/edit.py:423 -#: src/cogs/poll/edit.py:460 src/cogs/poll/edit.py:497 -msgid "Cancel" -msgstr "Annuler" - -#: src/cogs/clear.py:194 +#: src/cogs/clear/__init__.py:144 msgid "Clearing {amount} message(s)..." msgstr "Suppression de {amount} message(s)..." -#: src/cogs/clear.py:219 +#: src/cogs/clear/__init__.py:146 +msgid "Analyzed: {analyzed}\n" +"Deleted: {deleted}/{goal}\n" +"Planned for deletion: {planned}" +msgstr "" + +#: src/cogs/clear/__init__.py:187 msgid "Cannot clear more than 3 minutes. {} message(s) deleted." msgstr "Impossible de supprimer plus de 3 minutes. {} message(s) supprimé(s)." -#: src/cogs/clear.py:220 +#: src/cogs/clear/__init__.py:188 msgid "Clear cancelled. {} message(s) deleted." msgstr "Suppression annulée. {} message(s) supprimé(s)." -#: src/cogs/clear.py:228 +#: src/cogs/clear/__init__.py:196 msgid "{} message(s) deleted." msgstr "{} message(s) supprimé(s)." -#: src/cogs/help.py:29 -msgid "slash command" -msgstr "commande slash" - -#: src/cogs/help.py:30 -msgid "message context" -msgstr "contexte de message" - -#: src/cogs/help.py:31 -msgid "user context" -msgstr "contexte d'utilisateur" - -#: src/cogs/help.py:32 -msgid "miscellaneous" -msgstr "divers" - -#: src/cogs/help.py:40 -msgid "help" -msgstr "aide" +#: src/cogs/clear/__init__.py:266 src/cogs/poll/edit.py:229 +#: src/cogs/poll/edit.py:327 src/cogs/poll/edit.py:389 +#: src/cogs/poll/edit.py:431 src/cogs/poll/edit.py:470 +#: src/cogs/poll/edit.py:500 +msgid "Cancel" +msgstr "Annuler" -#: src/cogs/help.py:40 -msgid "Get help about the bot." -msgstr "Obtenir de l'aide à propos du bot." +#: src/cogs/clear/clear_transformers.py:29 +msgid "include" +msgstr "inclus" -#: src/cogs/help.py:41 -msgid "feature" -msgstr "fonctionnalité" +#: src/cogs/clear/clear_transformers.py:30 +msgid "exclude" +msgstr "exclus" -#: src/cogs/help.py:72 -msgid "Commands of MyBot" -msgstr "Commandes de MyBot" +#: src/cogs/clear/clear_transformers.py:31 +msgid "only" +msgstr "seulement" -#: src/cogs/help.py:76 -msgid "Slash commands" -msgstr "Commandes slash" +#: src/cogs/clear/clear_transformers.py:47 +msgid "image" +msgstr "" -#: src/cogs/help.py:77 -msgid "Context commands" -msgstr "Commandes contextuelles" +#: src/cogs/clear/clear_transformers.py:48 +msgid "video" +msgstr "vidéo" -#: src/cogs/help.py:78 -msgid "Miscellaneous features" -msgstr "Fonctionnalités diverses" +#: src/cogs/clear/clear_transformers.py:49 +msgid "audio" +msgstr "" -#: src/cogs/help.py:150 -msgid "Help about {} [{}]" -msgstr "Aide à propos de {} [{}]" +#: src/cogs/clear/clear_transformers.py:50 +msgid "stickers" +msgstr "autocollants" -#: src/cogs/ping.py:30 -msgid "ping" -msgstr "ping" +#: src/cogs/clear/clear_transformers.py:51 +msgid "file" +msgstr "" -#: src/cogs/ping.py:31 -msgid "Get the bot latency." -msgstr "Obtenir la latence du bot." +#: src/cogs/clear/clear_transformers.py:52 +msgid "embed" +msgstr "" -#: src/cogs/stats.py:43 -msgid "stats" -msgstr "stats" +#: src/cogs/clear/clear_transformers.py:53 +msgid "link (any URL)" +msgstr "lien (n'importe quelle URL)" -#: src/cogs/stats.py:44 -msgid "Get somes stats about the bot." -msgstr "Obtenir quelques statistiques sur le bot." +#: src/cogs/clear/clear_transformers.py:54 +msgid "mention" +msgstr "" -#: src/cogs/stats.py:49 -msgid "Quelques statistiques sur MyBot" -msgstr "Quelques statistiques sur MyBot" +#: src/cogs/clear/clear_transformers.py:55 +msgid "discord invitation" +msgstr "invitation discord" -#: src/cogs/config/__init__.py:32 +#: src/cogs/config/__init__.py:31 msgid "config" msgstr "configuration" -#: src/cogs/config/__init__.py:33 +#: src/cogs/config/__init__.py:32 msgid "Set configurations." msgstr "Définir des configurations." -#: src/cogs/config/__init__.py:37 +#: src/cogs/config/__init__.py:36 msgid "guild" msgstr "serveur" -#: src/cogs/config/__init__.py:38 +#: src/cogs/config/__init__.py:37 msgid "Set configuration for the guild." msgstr "Définir la configuration du serveur." -#: src/cogs/config/__init__.py:41 +#: src/cogs/config/__init__.py:40 msgid "bot" -msgstr "bot" +msgstr "" -#: src/cogs/config/__init__.py:42 +#: src/cogs/config/__init__.py:41 msgid "Set configuration for the bot." msgstr "Définir la configuration du bot." -#: src/cogs/config/__init__.py:54 +#: src/cogs/config/__init__.py:53 msgid "emote" msgstr "emoji" -#: src/cogs/config/__init__.py:55 +#: src/cogs/config/__init__.py:54 msgid "Add restriction to an emote for a role." msgstr "Ajouter une restriction à un émoji pour un rôle." -#: src/cogs/config/__init__.py:62 +#: src/cogs/config/__init__.py:61 msgid "public_translations" msgstr "traductions_publique" -#: src/cogs/config/__init__.py:63 +#: src/cogs/config/__init__.py:62 msgid "Set if the translations are visible for everyone or not." msgstr "Définir si les traductions sont visibles par tous ou non." @@ -296,111 +299,135 @@ msgstr "Les traductions seront désormais publiques." msgid "Translations will now be private." msgstr "Les traductions seront désormais privées." -#: src/cogs/game/__init__.py:32 +#: src/cogs/game/__init__.py:33 msgid "game" msgstr "jeu" -#: src/cogs/game/__init__.py:33 +#: src/cogs/game/__init__.py:34 msgid "Play some games." msgstr "Jouez à des jeux." -#: src/cogs/game/__init__.py:49 +#: src/cogs/game/__init__.py:58 msgid "connect4" msgstr "puissance4" -#: src/cogs/game/__init__.py:50 +#: src/cogs/game/__init__.py:59 msgid "Play connect 4" msgstr "Jouer au puissance 4" -#: src/cogs/game/__init__.py:57 +#: src/cogs/game/__init__.py:66 msgid "rpc" -msgstr "rpc" +msgstr "" -#: src/cogs/game/__init__.py:58 -msgid "Play rock paper cisors" -msgstr "Jouer à Pierre Feuille Ciseaux" +#: src/cogs/game/__init__.py:67 +msgid "Play rock paper scissors" +msgstr "" -#: src/cogs/game/__init__.py:65 +#: src/cogs/game/__init__.py:74 msgid "tictactoe" msgstr "morpion" -#: src/cogs/game/__init__.py:66 +#: src/cogs/game/__init__.py:75 msgid "Play tictactoe" msgstr "Jouer au morpion" -#: src/cogs/poll/__init__.py:32 +#: src/cogs/game/__init__.py:82 +msgid "minesweeper" +msgstr "" + +#: src/cogs/game/__init__.py:83 +msgid "Play minesweeper" +msgstr "" + +#: src/cogs/game/__init__.py:90 +msgid "2048" +msgstr "" + +#: src/cogs/game/__init__.py:91 +msgid "Play 2048" +msgstr "" + +#: src/cogs/poll/__init__.py:35 msgid "poll" msgstr "sondage" -#: src/cogs/poll/__init__.py:32 src/cogs/poll/__init__.py:110 -#: src/cogs/poll/edit.py:190 +#: src/cogs/poll/__init__.py:35 src/cogs/poll/__init__.py:113 +#: src/cogs/poll/edit.py:186 msgid "Create a new poll" msgstr "Créer un nouveau sondage" -#: src/cogs/poll/__init__.py:38 +#: src/cogs/poll/__init__.py:41 msgid "Edit poll" msgstr "Modifier un sondage" -#: src/cogs/poll/__init__.py:40 +#: src/cogs/poll/__init__.py:43 msgid "Use this to edit a poll even after creation." msgstr "Utilisez ceci pour modifier un sondage même après sa création." -#: src/cogs/poll/__init__.py:73 +#: src/cogs/poll/__init__.py:76 msgid "custom_choice" msgstr "choix_customisable" -#: src/cogs/poll/__init__.py:74 +#: src/cogs/poll/__init__.py:77 msgid "A poll with customizable options." msgstr "Un sondage avec des options personnalisables." -#: src/cogs/poll/__init__.py:82 +#: src/cogs/poll/__init__.py:85 msgid "yesno" msgstr "oui_non" -#: src/cogs/poll/__init__.py:83 +#: src/cogs/poll/__init__.py:86 msgid "A simple poll with \"Yes\" and \"No\" as options." msgstr "Un simple sondage avec \"Oui\" et \"Non\" comme options." -#: src/cogs/poll/__init__.py:98 +#: src/cogs/poll/__init__.py:101 msgid "This message is not a poll." msgstr "Ce message n'est pas un sondage." -#: src/cogs/poll/__init__.py:100 -msgid "You can't edit this poll." -msgstr "Vous ne pouvez pas modifier ce sondage." +#: src/cogs/poll/__init__.py:103 +msgid "You are not the author of this poll. You can't edit it." +msgstr "" -#: src/cogs/poll/__init__.py:117 src/cogs/poll/edit.py:196 +#: src/cogs/poll/__init__.py:120 src/cogs/poll/edit.py:192 msgid "Poll question" msgstr "Question du sondage" -#: src/cogs/poll/__init__.py:117 src/cogs/poll/edit.py:197 +#: src/cogs/poll/__init__.py:120 src/cogs/poll/edit.py:193 msgid "Do you agree this bot is awesome?" msgstr "Êtes-vous d'accord que ce bot est génial ?" -#: src/cogs/poll/__init__.py:121 src/cogs/poll/edit.py:204 +#: src/cogs/poll/__init__.py:124 src/cogs/poll/edit.py:200 msgid "Poll description" msgstr "Description du sondage" -#: src/cogs/poll/__init__.py:122 src/cogs/poll/edit.py:206 +#: src/cogs/poll/__init__.py:125 src/cogs/poll/edit.py:202 msgid "Tell more about your poll here." msgstr "Dites-en plus à propos de votre sondage ici." -#: src/cogs/poll/__init__.py:144 +#: src/cogs/poll/__init__.py:147 msgid "Choice 1" msgstr "Choix 1" -#: src/cogs/poll/__init__.py:145 +#: src/cogs/poll/__init__.py:148 msgid "Yes, totally!" msgstr "Oui, totalement !" -#: src/cogs/poll/__init__.py:149 +#: src/cogs/poll/__init__.py:152 msgid "Choice 2" msgstr "Choix 2" -#: src/cogs/poll/__init__.py:150 +#: src/cogs/poll/__init__.py:153 msgid "Absolutely!" msgstr "Absolument !" +#: src/cogs/poll/__init__.py:157 +msgid "Choice 3" +msgstr "" + +#: src/cogs/poll/__init__.py:158 +msgid "Of course!" +msgstr "" + #: src/cogs/poll/display.py:78 msgid "Poll created by {}" msgstr "Sondage créé par {}" @@ -417,255 +444,283 @@ msgstr "Pas de date de fin.\n" msgid "Poll ends \n" msgstr "Le sondage se termine \n" -#: src/cogs/poll/edit.py:26 +#: src/cogs/poll/display.py:112 +msgid "Yes!" +msgstr "" + +#: src/cogs/poll/display.py:112 +msgid "No!" +msgstr "" + +#: src/cogs/poll/edit.py:25 msgid "Select what you want to edit." msgstr "Sélectionnez ce que vous voulez modifier." -#: src/cogs/poll/edit.py:60 src/cogs/poll/edit.py:496 +#: src/cogs/poll/edit.py:58 src/cogs/poll/edit.py:499 msgid "Reset" msgstr "Réinitialiser" -#: src/cogs/poll/edit.py:61 +#: src/cogs/poll/edit.py:59 msgid "Save" msgstr "Sauvegarder" -#: src/cogs/poll/edit.py:75 +#: src/cogs/poll/edit.py:66 msgid "The results are {}." msgstr "Les résultats sont {}." -#: src/cogs/poll/edit.py:75 +#: src/cogs/poll/edit.py:66 msgid "public" msgstr "publique" -#: src/cogs/poll/edit.py:75 +#: src/cogs/poll/edit.py:66 msgid "private" msgstr "privé" -#: src/cogs/poll/edit.py:78 +#: src/cogs/poll/edit.py:69 msgid "Users {} change their answer once voted." msgstr "Les utilisateurs {} changer leur réponse une fois voté." -#: src/cogs/poll/edit.py:79 +#: src/cogs/poll/edit.py:70 msgid "can" msgstr "peuvent" -#: src/cogs/poll/edit.py:79 +#: src/cogs/poll/edit.py:70 msgid "can't" msgstr "ne peuvent pas" -#: src/cogs/poll/edit.py:92 +#: src/cogs/poll/edit.py:83 msgid "Reopen poll" msgstr "Réouvrir le sondage" -#: src/cogs/poll/edit.py:95 +#: src/cogs/poll/edit.py:86 msgid "Close poll" msgstr "Fermer le sondage" -#: src/cogs/poll/edit.py:162 +#: src/cogs/poll/edit.py:158 msgid "The poll has been updated while you were voting." msgstr "Le sondage a été mis à jour pendant votre vote." -#: src/cogs/poll/edit.py:186 -msgid "Edit title and description" -msgstr "Modifier le titre et la description" +#: src/cogs/poll/edit.py:182 +msgid "Edit title and description" +msgstr "" -#: src/cogs/poll/edit.py:222 +#: src/cogs/poll/edit.py:218 msgid "Edit ending time" msgstr "Modifier l'heure de fin" -#: src/cogs/poll/edit.py:223 +#: src/cogs/poll/edit.py:219 msgid "Set a poll duration, it will be closed automatically." msgstr "Définissez la durée du sondage, il sera fermé automatiquement." -#: src/cogs/poll/edit.py:230 +#: src/cogs/poll/edit.py:226 msgid "Select the number of days." msgstr "Saisissez le nombre de jours." -#: src/cogs/poll/edit.py:231 +#: src/cogs/poll/edit.py:227 msgid "Select the number of hours." msgstr "Sélectionnez le nombre d'heures." -#: src/cogs/poll/edit.py:232 +#: src/cogs/poll/edit.py:228 msgid "Select the number of minutes." msgstr "Sélectionnez le nombre de minutes." -#: src/cogs/poll/edit.py:234 src/cogs/poll/edit.py:325 -#: src/cogs/poll/edit.py:383 src/cogs/poll/edit.py:424 -#: src/cogs/poll/edit.py:461 +#: src/cogs/poll/edit.py:230 src/cogs/poll/edit.py:326 +#: src/cogs/poll/edit.py:388 src/cogs/poll/edit.py:432 +#: src/cogs/poll/edit.py:471 msgid "Back" msgstr "Retour" -#: src/cogs/poll/edit.py:236 +#: src/cogs/poll/edit.py:232 msgid "{} day(s)" msgstr "{} jour(s)" -#: src/cogs/poll/edit.py:237 +#: src/cogs/poll/edit.py:233 msgid "{} hour(s)" msgstr "{} heure(s)" -#: src/cogs/poll/edit.py:239 +#: src/cogs/poll/edit.py:235 msgid "{} minute(s)" -msgstr "{} minute(s)" +msgstr "" -#: src/cogs/poll/edit.py:315 +#: src/cogs/poll/edit.py:316 msgid "Edit choices" msgstr "Modifier les choix" -#: src/cogs/poll/edit.py:316 +#: src/cogs/poll/edit.py:317 msgid "Add and removes choices for multiple choices polls." msgstr "Ajouter et supprimer des choix pour les sondages à choix multiples." -#: src/cogs/poll/edit.py:323 +#: src/cogs/poll/edit.py:324 msgid "Add a choice" msgstr "Ajouter un choix" -#: src/cogs/poll/edit.py:324 +#: src/cogs/poll/edit.py:325 msgid "Remove a choice" msgstr "Retirer un choix" -#: src/cogs/poll/edit.py:355 +#: src/cogs/poll/edit.py:360 msgid "Add a new choice" msgstr "Ajouter un nouveau choix" -#: src/cogs/poll/edit.py:360 +#: src/cogs/poll/edit.py:365 msgid "Choice" msgstr "Choix" -#: src/cogs/poll/edit.py:361 +#: src/cogs/poll/edit.py:366 msgid "Enter a new choice here." msgstr "Saisissez un nouveau choix ici." -#: src/cogs/poll/edit.py:385 +#: src/cogs/poll/edit.py:390 msgid "Select the choices you want to remove." msgstr "Sélectionnez les choix que vous souhaitez retirer." -#: src/cogs/poll/edit.py:415 +#: src/cogs/poll/edit.py:423 msgid "Edit max choices" msgstr "Modifier le maximum de choix" -#: src/cogs/poll/edit.py:416 +#: src/cogs/poll/edit.py:424 msgid "Set the maximum of simultaneous values users can choose." msgstr "Définissez le maximum de valeurs simultanées que les utilisateurs peuvent choisir." -#: src/cogs/poll/edit.py:426 +#: src/cogs/poll/edit.py:434 msgid "Select the maximum number of choices." msgstr "Sélectionnez le nombre maximum de choix." -#: src/cogs/poll/edit.py:452 +#: src/cogs/poll/edit.py:462 msgid "Edit allowed roles" msgstr "Modifier les rôles autorisés" -#: src/cogs/poll/edit.py:453 +#: src/cogs/poll/edit.py:463 msgid "Only users with one of these role can vote." msgstr "Uniquement les utilisateurs ayant un de ces rôles peuvent voter." -#: src/cogs/poll/edit.py:462 +#: src/cogs/poll/edit.py:472 msgid "Select the roles that can vote." msgstr "Sélectionnez les rôles qui peuvent voter." -#: src/cogs/poll/edit.py:503 +#: src/cogs/poll/edit.py:506 msgid "This operation cannot be undone. By clicking on the \"RESET\" button, all the votes will be deleted." msgstr "Cette opération ne peut pas être annulée. En cliquant sur le bouton \"RÉINITIALISER\", tous les votes seront supprimés." -#: src/cogs/poll/vote_menus.py:48 +#: src/cogs/poll/vote_menus.py:39 msgid "Vote" msgstr "Voter" -#: src/cogs/poll/vote_menus.py:61 +#: src/cogs/poll/vote_menus.py:53 msgid "Sorry, this poll seems not to exist. Please contact an admin." msgstr "Désolé, ce sondage ne semble pas exister. Veuillez contacter un administrateur." -#: src/cogs/poll/vote_menus.py:70 +#: src/cogs/poll/vote_menus.py:62 msgid "Sorry, this poll is closed, you can't vote anymore!" msgstr "Désolé, ce sondage est fermé, vous ne pouvez plus voter !" -#: src/cogs/poll/vote_menus.py:78 +#: src/cogs/poll/vote_menus.py:70 msgid "Sorry, this poll is over, you can't vote anymore!" msgstr "Désolé, ce sondage est terminé, vous ne pouvez plus voter !" -#: src/cogs/poll/vote_menus.py:85 +#: src/cogs/poll/vote_menus.py:77 msgid "Sorry, you need one of the following roles to vote :" msgstr "Désolé, vous avez besoin de l'un des rôles suivants pour voter :" -#: src/cogs/poll/vote_menus.py:161 +#: src/cogs/poll/vote_menus.py:153 msgid "Remove vote" msgstr "Retirer le vote" -#: src/cogs/poll/vote_menus.py:162 +#: src/cogs/poll/vote_menus.py:154 msgid "Validate" msgstr "Valider" -#: src/cogs/poll/vote_menus.py:199 src/cogs/poll/vote_menus.py:255 +#: src/cogs/poll/vote_menus.py:193 src/cogs/poll/vote_menus.py:252 msgid "Your vote has been removed." msgstr "Votre vote a été retiré." -#: src/cogs/poll/vote_menus.py:219 src/cogs/poll/vote_menus.py:247 +#: src/cogs/poll/vote_menus.py:214 src/cogs/poll/vote_menus.py:244 msgid "Your vote has been taken into account!" msgstr "Votre vote a été pris en compte !" -#: src/cogs/poll/vote_menus.py:226 +#: src/cogs/poll/vote_menus.py:221 msgid "Yes" msgstr "Oui" -#: src/cogs/poll/vote_menus.py:227 +#: src/cogs/poll/vote_menus.py:222 msgid "No" msgstr "Non" -#: src/cogs/translate/__init__.py:161 +#: src/cogs/translate/__init__.py:165 msgid "Translate" msgstr "Traduire" -#: src/cogs/translate/__init__.py:165 +#: src/cogs/translate/__init__.py:169 msgid "Translate a message based on your discord settings." msgstr "Traduire un message en fonction de vos paramètres de Discord." -#: src/cogs/translate/__init__.py:177 +#: src/cogs/translate/__init__.py:181 msgid "translate" msgstr "traduire" -#: src/cogs/translate/__init__.py:178 +#: src/cogs/translate/__init__.py:182 msgid "Translate text in a selection of languages." msgstr "Traduire le texte dans une sélection de langues." -#: src/cogs/translate/__init__.py:185 +#: src/cogs/translate/__init__.py:189 msgid "The language you provided is not supported." msgstr "La langue que vous avez fournie n'est pas prise en charge." -#: src/cogs/translate/__init__.py:228 +#: src/cogs/translate/__init__.py:232 msgid "Translate text in the language corresponding on the flag you add." msgstr "Traduire le texte dans la langue correspondant au drapeau que vous ajoutez." -#: src/cogs/translate/__init__.py:250 +#: src/cogs/translate/__init__.py:254 msgid "The language you asked for is not supported." msgstr "La langue demandée n'est pas prise en charge." -#: src/cogs/translate/__init__.py:281 +#: src/cogs/translate/__init__.py:285 msgid "Your locale is not supported." msgstr "Votre langue n'est pas prise en charge." -#: src/cogs/translate/__init__.py:308 +#: src/cogs/translate/__init__.py:312 msgid "Vote for the bot" msgstr "Votez pour le bot" -#: src/cogs/translate/__init__.py:315 -msgid "You have reached the maximum number of translations per day. Vote for the bot to remove this limit !" -msgstr "Vous avez atteint le nombre maximum de traduction par jour. Votez pour le bot pour retirer cette limite !" +#: src/cogs/translate/__init__.py:319 +msgid "You have reached the maximum number of translations per day.Vote for the bot to remove this limit !" +msgstr "" -#: src/cogs/translate/__init__.py:355 +#: src/cogs/translate/__init__.py:360 msgid "Translate from {from_} to {to}" msgstr "Traduire depuis {from_} vers {to}" -#: src/core/error_handler.py:36 +#: src/core/error_handler.py:50 msgid "Support server" msgstr "Serveur support" -#: src/core/error_handler.py:53 +#: src/core/error_handler.py:64 msgid "This command is already executed the max amount of times. (Max: {error.rate})" msgstr "Cette commande est déjà exécutée le nombre maximal de fois. (Max : {error.rate})" -#: src/core/error_handler.py:56 +#: src/core/error_handler.py:67 +msgid "This command needs some conditions you don't meet." +msgstr "" + +#: src/core/error_handler.py:70 +msgid "You provided a bad argument." +msgstr "" + +#: src/core/error_handler.py:73 +msgid "The bot is missing some permissions.\n" +"`{}`" +msgstr "" + +#: src/core/error_handler.py:77 +msgid "It looks like the bot has been added incorrectly. Please ask an admin to re-add the bot." +msgstr "" + +#: src/core/error_handler.py:80 +msgid "This command cannot be used in DMs." +msgstr "" + +#: src/core/error_handler.py:83 msgid "An unhandled error happened.\n" -"{error}" -msgstr "Une erreur non gérée s'est produite.\n" -"{error}" +"Please ask on the support server!" +msgstr "" diff --git a/resources/locale/mybot.pot b/resources/locale/mybot.pot index c33e23b..b6dfb3c 100644 --- a/resources/locale/mybot.pot +++ b/resources/locale/mybot.pot @@ -8,290 +8,294 @@ msgid "" msgstr "" "Project-Id-Version: MyBot 1.0\n" "Report-Msgid-Bugs-To: contact@mybot-discord.com\n" -"POT-Creation-Date: 2023-03-18 19:56+0000\n" +"POT-Creation-Date: 2023-12-05 23:54+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" -"Generated-By: Babel 2.12.1\n" +"Generated-By: Babel 2.13.1\n" -#: src/cogs/calculator.py:29 -msgid "calculator" +#: src/cogs/help.py:29 +msgid "slash command" msgstr "" -#: src/cogs/calculator.py:30 -msgid "Show a calculator you can use." +#: src/cogs/help.py:30 +msgid "message context" msgstr "" -#: src/cogs/clear.py:77 -msgid "Delete multiple messages with some filters." +#: src/cogs/help.py:31 +msgid "user context" msgstr "" -#: src/cogs/clear.py:84 -msgid "image" +#: src/cogs/help.py:32 +msgid "miscellaneous" msgstr "" -#: src/cogs/clear.py:85 -msgid "video" +#: src/cogs/help.py:40 +msgid "help" msgstr "" -#: src/cogs/clear.py:86 -msgid "audio" +#: src/cogs/help.py:40 +msgid "Get help about the bot." msgstr "" -#: src/cogs/clear.py:87 -msgid "stickers" +#: src/cogs/help.py:41 +msgid "feature" msgstr "" -#: src/cogs/clear.py:88 -msgid "files" +#: src/cogs/help.py:72 +msgid "Commands of MyBot" msgstr "" -#: src/cogs/clear.py:89 -msgid "any attachment" +#: src/cogs/help.py:76 +msgid "Slash commands" msgstr "" -#: src/cogs/clear.py:90 -msgid "embed" +#: src/cogs/help.py:77 +msgid "Context commands" msgstr "" -#: src/cogs/clear.py:91 -msgid "link (any URL)" +#: src/cogs/help.py:78 +msgid "Miscellaneous features" msgstr "" -#: src/cogs/clear.py:92 -msgid "mention" +#: src/cogs/help.py:148 +msgid "Help about {} [{}]" msgstr "" -#: src/cogs/clear.py:93 -msgid "discord invitation" +#: src/cogs/ping.py:28 +msgid "ping" msgstr "" -#: src/cogs/clear.py:96 -msgid "include" +#: src/cogs/ping.py:29 +msgid "Get the bot latency." msgstr "" -#: src/cogs/clear.py:97 -msgid "exclude" +#: src/cogs/stats.py:40 +msgid "stats" msgstr "" -#: src/cogs/clear.py:98 -msgid "only" +#: src/cogs/stats.py:41 +msgid "Get some stats about the bot." msgstr "" -#: src/cogs/clear.py:102 +#: src/cogs/calculator/__init__.py:41 +msgid "calculator" +msgstr "" + +#: src/cogs/calculator/__init__.py:42 +msgid "Show a calculator you can use." +msgstr "" + +#: src/cogs/calculator/__init__.py:66 +msgid "Invalid expression" +msgstr "" + +#: src/cogs/clear/__init__.py:54 +msgid "Delete multiple messages with some filters." +msgstr "" + +#: src/cogs/clear/__init__.py:60 msgid "The amount of messages to delete." msgstr "" -#: src/cogs/clear.py:103 +#: src/cogs/clear/__init__.py:61 msgid "Delete only messages from the specified user." msgstr "" -#: src/cogs/clear.py:104 +#: src/cogs/clear/__init__.py:62 msgid "Delete only messages whose user has the specified role." msgstr "" -#: src/cogs/clear.py:105 +#: src/cogs/clear/__init__.py:63 msgid "Delete only messages that match the specified search (can be regex)." msgstr "" -#: src/cogs/clear.py:108 +#: src/cogs/clear/__init__.py:66 msgid "Delete only messages that contains the selected entry. #TODO" msgstr "" -#: src/cogs/clear.py:111 +#: src/cogs/clear/__init__.py:69 msgid "" "Delete only messages where length match the specified entry. (e.g. " "'<=100', '5', '>10') #TODO" msgstr "" -#: src/cogs/clear.py:112 +#: src/cogs/clear/__init__.py:70 msgid "" "Delete only messages sent before the specified message or date. (yyyy-mm-" "dd) #TODO" msgstr "" -#: src/cogs/clear.py:113 +#: src/cogs/clear/__init__.py:71 msgid "" -"Delete only messages sent after the specified message or date. (yyyy-mm-" +"Delete only messages sent after the specified message or date. (yyyy-mm-" "dd) #TODO" msgstr "" -#: src/cogs/clear.py:114 +#: src/cogs/clear/__init__.py:72 msgid "" "Include/exclude pinned messages in deletion, or deletes \"only\" pinned " "messages. (default to exclude)" msgstr "" -#: src/cogs/clear.py:119 +#: src/cogs/clear/__init__.py:77 msgid "amount" msgstr "" -#: src/cogs/clear.py:120 +#: src/cogs/clear/__init__.py:78 msgid "user" msgstr "" -#: src/cogs/clear.py:121 +#: src/cogs/clear/__init__.py:79 msgid "role" msgstr "" -#: src/cogs/clear.py:122 +#: src/cogs/clear/__init__.py:80 msgid "search" msgstr "" -#: src/cogs/clear.py:123 +#: src/cogs/clear/__init__.py:81 msgid "has" msgstr "" -#: src/cogs/clear.py:124 +#: src/cogs/clear/__init__.py:82 msgid "length" msgstr "" -#: src/cogs/clear.py:125 +#: src/cogs/clear/__init__.py:83 msgid "before" msgstr "" -#: src/cogs/clear.py:126 +#: src/cogs/clear/__init__.py:84 msgid "after" msgstr "" -#: src/cogs/clear.py:127 +#: src/cogs/clear/__init__.py:85 msgid "pinned" msgstr "" -#: src/cogs/clear.py:152 +#: src/cogs/clear/__init__.py:106 msgid "You must supply a number between 1 and 250. (0 < {amount} < 251)" msgstr "" -#: src/cogs/clear.py:186 src/cogs/poll/edit.py:233 src/cogs/poll/edit.py:326 -#: src/cogs/poll/edit.py:384 src/cogs/poll/edit.py:423 -#: src/cogs/poll/edit.py:460 src/cogs/poll/edit.py:497 -msgid "Cancel" +#: src/cogs/clear/__init__.py:144 +msgid "Clearing {amount} message(s)..." msgstr "" -#: src/cogs/clear.py:194 -msgid "Clearing {amount} message(s)..." +#: src/cogs/clear/__init__.py:146 +msgid "" +"Analyzed: {analyzed}\n" +"Deleted: {deleted}/{goal}\n" +"Planned for deletion: {planned}" msgstr "" -#: src/cogs/clear.py:219 +#: src/cogs/clear/__init__.py:187 msgid "Cannot clear more than 3 minutes. {} message(s) deleted." msgstr "" -#: src/cogs/clear.py:220 +#: src/cogs/clear/__init__.py:188 msgid "Clear cancelled. {} message(s) deleted." msgstr "" -#: src/cogs/clear.py:228 +#: src/cogs/clear/__init__.py:196 msgid "{} message(s) deleted." msgstr "" -#: src/cogs/help.py:29 -msgid "slash command" -msgstr "" - -#: src/cogs/help.py:30 -msgid "message context" -msgstr "" - -#: src/cogs/help.py:31 -msgid "user context" -msgstr "" - -#: src/cogs/help.py:32 -msgid "miscellaneous" -msgstr "" - -#: src/cogs/help.py:40 -msgid "help" +#: src/cogs/clear/__init__.py:266 src/cogs/poll/edit.py:229 +#: src/cogs/poll/edit.py:327 src/cogs/poll/edit.py:389 +#: src/cogs/poll/edit.py:431 src/cogs/poll/edit.py:470 +#: src/cogs/poll/edit.py:500 +msgid "Cancel" msgstr "" -#: src/cogs/help.py:40 -msgid "Get help about the bot." +#: src/cogs/clear/clear_transformers.py:29 +msgid "include" msgstr "" -#: src/cogs/help.py:41 -msgid "feature" +#: src/cogs/clear/clear_transformers.py:30 +msgid "exclude" msgstr "" -#: src/cogs/help.py:72 -msgid "Commands of MyBot" +#: src/cogs/clear/clear_transformers.py:31 +msgid "only" msgstr "" -#: src/cogs/help.py:76 -msgid "Slash commands" +#: src/cogs/clear/clear_transformers.py:47 +msgid "image" msgstr "" -#: src/cogs/help.py:77 -msgid "Context commands" +#: src/cogs/clear/clear_transformers.py:48 +msgid "video" msgstr "" -#: src/cogs/help.py:78 -msgid "Miscellaneous features" +#: src/cogs/clear/clear_transformers.py:49 +msgid "audio" msgstr "" -#: src/cogs/help.py:150 -msgid "Help about {} [{}]" +#: src/cogs/clear/clear_transformers.py:50 +msgid "stickers" msgstr "" -#: src/cogs/ping.py:30 -msgid "ping" +#: src/cogs/clear/clear_transformers.py:51 +msgid "file" msgstr "" -#: src/cogs/ping.py:31 -msgid "Get the bot latency." +#: src/cogs/clear/clear_transformers.py:52 +msgid "embed" msgstr "" -#: src/cogs/stats.py:43 -msgid "stats" +#: src/cogs/clear/clear_transformers.py:53 +msgid "link (any URL)" msgstr "" -#: src/cogs/stats.py:44 -msgid "Get somes stats about the bot." +#: src/cogs/clear/clear_transformers.py:54 +msgid "mention" msgstr "" -#: src/cogs/stats.py:49 -msgid "Quelques statistiques sur MyBot" +#: src/cogs/clear/clear_transformers.py:55 +msgid "discord invitation" msgstr "" -#: src/cogs/config/__init__.py:32 +#: src/cogs/config/__init__.py:31 msgid "config" msgstr "" -#: src/cogs/config/__init__.py:33 +#: src/cogs/config/__init__.py:32 msgid "Set configurations." msgstr "" -#: src/cogs/config/__init__.py:37 +#: src/cogs/config/__init__.py:36 msgid "guild" msgstr "" -#: src/cogs/config/__init__.py:38 +#: src/cogs/config/__init__.py:37 msgid "Set configuration for the guild." msgstr "" -#: src/cogs/config/__init__.py:41 +#: src/cogs/config/__init__.py:40 msgid "bot" msgstr "" -#: src/cogs/config/__init__.py:42 +#: src/cogs/config/__init__.py:41 msgid "Set configuration for the bot." msgstr "" -#: src/cogs/config/__init__.py:54 +#: src/cogs/config/__init__.py:53 msgid "emote" msgstr "" -#: src/cogs/config/__init__.py:55 +#: src/cogs/config/__init__.py:54 msgid "Add restriction to an emote for a role." msgstr "" -#: src/cogs/config/__init__.py:62 +#: src/cogs/config/__init__.py:61 msgid "public_translations" msgstr "" -#: src/cogs/config/__init__.py:63 +#: src/cogs/config/__init__.py:62 msgid "Set if the translations are visible for everyone or not." msgstr "" @@ -303,111 +307,135 @@ msgstr "" msgid "Translations will now be private." msgstr "" -#: src/cogs/game/__init__.py:32 +#: src/cogs/game/__init__.py:33 msgid "game" msgstr "" -#: src/cogs/game/__init__.py:33 +#: src/cogs/game/__init__.py:34 msgid "Play some games." msgstr "" -#: src/cogs/game/__init__.py:49 +#: src/cogs/game/__init__.py:58 msgid "connect4" msgstr "" -#: src/cogs/game/__init__.py:50 +#: src/cogs/game/__init__.py:59 msgid "Play connect 4" msgstr "" -#: src/cogs/game/__init__.py:57 +#: src/cogs/game/__init__.py:66 msgid "rpc" msgstr "" -#: src/cogs/game/__init__.py:58 -msgid "Play rock paper cisors" +#: src/cogs/game/__init__.py:67 +msgid "Play rock paper scissors" msgstr "" -#: src/cogs/game/__init__.py:65 +#: src/cogs/game/__init__.py:74 msgid "tictactoe" msgstr "" -#: src/cogs/game/__init__.py:66 +#: src/cogs/game/__init__.py:75 msgid "Play tictactoe" msgstr "" -#: src/cogs/poll/__init__.py:32 +#: src/cogs/game/__init__.py:82 +msgid "minesweeper" +msgstr "" + +#: src/cogs/game/__init__.py:83 +msgid "Play minesweeper" +msgstr "" + +#: src/cogs/game/__init__.py:90 +msgid "2048" +msgstr "" + +#: src/cogs/game/__init__.py:91 +msgid "Play 2048" +msgstr "" + +#: src/cogs/poll/__init__.py:35 msgid "poll" msgstr "" -#: src/cogs/poll/__init__.py:32 src/cogs/poll/__init__.py:110 -#: src/cogs/poll/edit.py:190 +#: src/cogs/poll/__init__.py:35 src/cogs/poll/__init__.py:113 +#: src/cogs/poll/edit.py:186 msgid "Create a new poll" msgstr "" -#: src/cogs/poll/__init__.py:38 +#: src/cogs/poll/__init__.py:41 msgid "Edit poll" msgstr "" -#: src/cogs/poll/__init__.py:40 +#: src/cogs/poll/__init__.py:43 msgid "Use this to edit a poll even after creation." msgstr "" -#: src/cogs/poll/__init__.py:73 +#: src/cogs/poll/__init__.py:76 msgid "custom_choice" msgstr "" -#: src/cogs/poll/__init__.py:74 +#: src/cogs/poll/__init__.py:77 msgid "A poll with customizable options." msgstr "" -#: src/cogs/poll/__init__.py:82 +#: src/cogs/poll/__init__.py:85 msgid "yesno" msgstr "" -#: src/cogs/poll/__init__.py:83 +#: src/cogs/poll/__init__.py:86 msgid "A simple poll with \"Yes\" and \"No\" as options." msgstr "" -#: src/cogs/poll/__init__.py:98 +#: src/cogs/poll/__init__.py:101 msgid "This message is not a poll." msgstr "" -#: src/cogs/poll/__init__.py:100 -msgid "You can't edit this poll." +#: src/cogs/poll/__init__.py:103 +msgid "You are not the author of this poll. You can't edit it." msgstr "" -#: src/cogs/poll/__init__.py:117 src/cogs/poll/edit.py:196 +#: src/cogs/poll/__init__.py:120 src/cogs/poll/edit.py:192 msgid "Poll question" msgstr "" -#: src/cogs/poll/__init__.py:117 src/cogs/poll/edit.py:197 +#: src/cogs/poll/__init__.py:120 src/cogs/poll/edit.py:193 msgid "Do you agree this bot is awesome?" msgstr "" -#: src/cogs/poll/__init__.py:121 src/cogs/poll/edit.py:204 +#: src/cogs/poll/__init__.py:124 src/cogs/poll/edit.py:200 msgid "Poll description" msgstr "" -#: src/cogs/poll/__init__.py:122 src/cogs/poll/edit.py:206 +#: src/cogs/poll/__init__.py:125 src/cogs/poll/edit.py:202 msgid "Tell more about your poll here." msgstr "" -#: src/cogs/poll/__init__.py:144 +#: src/cogs/poll/__init__.py:147 msgid "Choice 1" msgstr "" -#: src/cogs/poll/__init__.py:145 +#: src/cogs/poll/__init__.py:148 msgid "Yes, totally!" msgstr "" -#: src/cogs/poll/__init__.py:149 +#: src/cogs/poll/__init__.py:152 msgid "Choice 2" msgstr "" -#: src/cogs/poll/__init__.py:150 +#: src/cogs/poll/__init__.py:153 msgid "Absolutely!" msgstr "" +#: src/cogs/poll/__init__.py:157 +msgid "Choice 3" +msgstr "" + +#: src/cogs/poll/__init__.py:158 +msgid "Of course!" +msgstr "" + #: src/cogs/poll/display.py:78 msgid "Poll created by {}" msgstr "" @@ -424,261 +452,293 @@ msgstr "" msgid "Poll ends \n" msgstr "" -#: src/cogs/poll/edit.py:26 +#: src/cogs/poll/display.py:112 +msgid "Yes!" +msgstr "" + +#: src/cogs/poll/display.py:112 +msgid "No!" +msgstr "" + +#: src/cogs/poll/edit.py:25 msgid "Select what you want to edit." msgstr "" -#: src/cogs/poll/edit.py:60 src/cogs/poll/edit.py:496 +#: src/cogs/poll/edit.py:58 src/cogs/poll/edit.py:499 msgid "Reset" msgstr "" -#: src/cogs/poll/edit.py:61 +#: src/cogs/poll/edit.py:59 msgid "Save" msgstr "" -#: src/cogs/poll/edit.py:75 +#: src/cogs/poll/edit.py:66 msgid "The results are {}." msgstr "" -#: src/cogs/poll/edit.py:75 +#: src/cogs/poll/edit.py:66 msgid "public" msgstr "" -#: src/cogs/poll/edit.py:75 +#: src/cogs/poll/edit.py:66 msgid "private" msgstr "" -#: src/cogs/poll/edit.py:78 +#: src/cogs/poll/edit.py:69 msgid "Users {} change their answer once voted." msgstr "" -#: src/cogs/poll/edit.py:79 +#: src/cogs/poll/edit.py:70 msgid "can" msgstr "" -#: src/cogs/poll/edit.py:79 +#: src/cogs/poll/edit.py:70 msgid "can't" msgstr "" -#: src/cogs/poll/edit.py:92 +#: src/cogs/poll/edit.py:83 msgid "Reopen poll" msgstr "" -#: src/cogs/poll/edit.py:95 +#: src/cogs/poll/edit.py:86 msgid "Close poll" msgstr "" -#: src/cogs/poll/edit.py:162 +#: src/cogs/poll/edit.py:158 msgid "The poll has been updated while you were voting." msgstr "" -#: src/cogs/poll/edit.py:186 -msgid "Edit title and description" +#: src/cogs/poll/edit.py:182 +msgid "Edit title and description" msgstr "" -#: src/cogs/poll/edit.py:222 +#: src/cogs/poll/edit.py:218 msgid "Edit ending time" msgstr "" -#: src/cogs/poll/edit.py:223 +#: src/cogs/poll/edit.py:219 msgid "Set a poll duration, it will be closed automatically." msgstr "" -#: src/cogs/poll/edit.py:230 +#: src/cogs/poll/edit.py:226 msgid "Select the number of days." msgstr "" -#: src/cogs/poll/edit.py:231 +#: src/cogs/poll/edit.py:227 msgid "Select the number of hours." msgstr "" -#: src/cogs/poll/edit.py:232 +#: src/cogs/poll/edit.py:228 msgid "Select the number of minutes." msgstr "" -#: src/cogs/poll/edit.py:234 src/cogs/poll/edit.py:325 -#: src/cogs/poll/edit.py:383 src/cogs/poll/edit.py:424 -#: src/cogs/poll/edit.py:461 +#: src/cogs/poll/edit.py:230 src/cogs/poll/edit.py:326 +#: src/cogs/poll/edit.py:388 src/cogs/poll/edit.py:432 +#: src/cogs/poll/edit.py:471 msgid "Back" msgstr "" -#: src/cogs/poll/edit.py:236 +#: src/cogs/poll/edit.py:232 msgid "{} day(s)" msgstr "" -#: src/cogs/poll/edit.py:237 +#: src/cogs/poll/edit.py:233 msgid "{} hour(s)" msgstr "" -#: src/cogs/poll/edit.py:239 +#: src/cogs/poll/edit.py:235 msgid "{} minute(s)" msgstr "" -#: src/cogs/poll/edit.py:315 +#: src/cogs/poll/edit.py:316 msgid "Edit choices" msgstr "" -#: src/cogs/poll/edit.py:316 +#: src/cogs/poll/edit.py:317 msgid "Add and removes choices for multiple choices polls." msgstr "" -#: src/cogs/poll/edit.py:323 +#: src/cogs/poll/edit.py:324 msgid "Add a choice" msgstr "" -#: src/cogs/poll/edit.py:324 +#: src/cogs/poll/edit.py:325 msgid "Remove a choice" msgstr "" -#: src/cogs/poll/edit.py:355 +#: src/cogs/poll/edit.py:360 msgid "Add a new choice" msgstr "" -#: src/cogs/poll/edit.py:360 +#: src/cogs/poll/edit.py:365 msgid "Choice" msgstr "" -#: src/cogs/poll/edit.py:361 +#: src/cogs/poll/edit.py:366 msgid "Enter a new choice here." msgstr "" -#: src/cogs/poll/edit.py:385 +#: src/cogs/poll/edit.py:390 msgid "Select the choices you want to remove." msgstr "" -#: src/cogs/poll/edit.py:415 +#: src/cogs/poll/edit.py:423 msgid "Edit max choices" msgstr "" -#: src/cogs/poll/edit.py:416 +#: src/cogs/poll/edit.py:424 msgid "Set the maximum of simultaneous values users can choose." msgstr "" -#: src/cogs/poll/edit.py:426 +#: src/cogs/poll/edit.py:434 msgid "Select the maximum number of choices." msgstr "" -#: src/cogs/poll/edit.py:452 +#: src/cogs/poll/edit.py:462 msgid "Edit allowed roles" msgstr "" -#: src/cogs/poll/edit.py:453 +#: src/cogs/poll/edit.py:463 msgid "Only users with one of these role can vote." msgstr "" -#: src/cogs/poll/edit.py:462 +#: src/cogs/poll/edit.py:472 msgid "Select the roles that can vote." msgstr "" -#: src/cogs/poll/edit.py:503 +#: src/cogs/poll/edit.py:506 msgid "" "This operation cannot be undone. By clicking on the \"RESET\" button, all" " the votes will be deleted." msgstr "" -#: src/cogs/poll/vote_menus.py:48 +#: src/cogs/poll/vote_menus.py:39 msgid "Vote" msgstr "" -#: src/cogs/poll/vote_menus.py:61 +#: src/cogs/poll/vote_menus.py:53 msgid "Sorry, this poll seems not to exist. Please contact an admin." msgstr "" -#: src/cogs/poll/vote_menus.py:70 +#: src/cogs/poll/vote_menus.py:62 msgid "Sorry, this poll is closed, you can't vote anymore!" msgstr "" -#: src/cogs/poll/vote_menus.py:78 +#: src/cogs/poll/vote_menus.py:70 msgid "Sorry, this poll is over, you can't vote anymore!" msgstr "" -#: src/cogs/poll/vote_menus.py:85 +#: src/cogs/poll/vote_menus.py:77 msgid "Sorry, you need one of the following roles to vote :" msgstr "" -#: src/cogs/poll/vote_menus.py:161 +#: src/cogs/poll/vote_menus.py:153 msgid "Remove vote" msgstr "" -#: src/cogs/poll/vote_menus.py:162 +#: src/cogs/poll/vote_menus.py:154 msgid "Validate" msgstr "" -#: src/cogs/poll/vote_menus.py:199 src/cogs/poll/vote_menus.py:255 +#: src/cogs/poll/vote_menus.py:193 src/cogs/poll/vote_menus.py:252 msgid "Your vote has been removed." msgstr "" -#: src/cogs/poll/vote_menus.py:219 src/cogs/poll/vote_menus.py:247 +#: src/cogs/poll/vote_menus.py:214 src/cogs/poll/vote_menus.py:244 msgid "Your vote has been taken into account!" msgstr "" -#: src/cogs/poll/vote_menus.py:226 +#: src/cogs/poll/vote_menus.py:221 msgid "Yes" msgstr "" -#: src/cogs/poll/vote_menus.py:227 +#: src/cogs/poll/vote_menus.py:222 msgid "No" msgstr "" -#: src/cogs/translate/__init__.py:161 +#: src/cogs/translate/__init__.py:165 msgid "Translate" msgstr "" -#: src/cogs/translate/__init__.py:165 +#: src/cogs/translate/__init__.py:169 msgid "Translate a message based on your discord settings." msgstr "" -#: src/cogs/translate/__init__.py:177 +#: src/cogs/translate/__init__.py:181 msgid "translate" msgstr "" -#: src/cogs/translate/__init__.py:178 +#: src/cogs/translate/__init__.py:182 msgid "Translate text in a selection of languages." msgstr "" -#: src/cogs/translate/__init__.py:185 +#: src/cogs/translate/__init__.py:189 msgid "The language you provided is not supported." msgstr "" -#: src/cogs/translate/__init__.py:228 +#: src/cogs/translate/__init__.py:232 msgid "Translate text in the language corresponding on the flag you add." msgstr "" -#: src/cogs/translate/__init__.py:250 +#: src/cogs/translate/__init__.py:254 msgid "The language you asked for is not supported." msgstr "" -#: src/cogs/translate/__init__.py:281 +#: src/cogs/translate/__init__.py:285 msgid "Your locale is not supported." msgstr "" -#: src/cogs/translate/__init__.py:308 +#: src/cogs/translate/__init__.py:312 msgid "Vote for the bot" msgstr "" -#: src/cogs/translate/__init__.py:315 +#: src/cogs/translate/__init__.py:319 msgid "" -"You have reached the maximum number of translations per day. Vote for the" -" bot to remove this limit !" +"You have reached the maximum number of translations per day.Vote for the " +"bot to remove this limit !" msgstr "" -#: src/cogs/translate/__init__.py:355 +#: src/cogs/translate/__init__.py:360 msgid "Translate from {from_} to {to}" msgstr "" -#: src/core/error_handler.py:36 +#: src/core/error_handler.py:50 msgid "Support server" msgstr "" -#: src/core/error_handler.py:53 +#: src/core/error_handler.py:64 msgid "" "This command is already executed the max amount of times. (Max: " "{error.rate})" msgstr "" -#: src/core/error_handler.py:56 +#: src/core/error_handler.py:67 +msgid "This command needs some conditions you don't meet." +msgstr "" + +#: src/core/error_handler.py:70 +msgid "You provided a bad argument." +msgstr "" + +#: src/core/error_handler.py:73 +msgid "" +"The bot is missing some permissions.\n" +"`{}`" +msgstr "" + +#: src/core/error_handler.py:77 +msgid "" +"It looks like the bot has been added incorrectly. Please ask an admin to " +"re-add the bot." +msgstr "" + +#: src/core/error_handler.py:80 +msgid "This command cannot be used in DMs." +msgstr "" + +#: src/core/error_handler.py:83 msgid "" "An unhandled error happened.\n" -"{error}" +"Please ask on the support server!" msgstr "" From 1c761aca8d6e1f114d0b43e4f0c8af8a3972ca48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C4=B1=CE=B5=D1=8F=D1=8F=CE=B5?= <47398145+AiroPi@users.noreply.github.com> Date: Wed, 6 Dec 2023 17:01:11 +0100 Subject: [PATCH 07/11] Update crowdin workflows --- .github/workflows/crowdin-download.yml | 51 ++ .github/workflows/crowdin-upload.yml | 40 ++ .github/workflows/generate-mo-files.yml | 27 - .github/workflows/generate-pot-file.yml | 38 -- crowdin.yml | 3 + resources/locale/fr/LC_MESSAGES/mybot.mo | Bin 10948 -> 0 bytes resources/locale/mybot.pot | 744 ----------------------- 7 files changed, 94 insertions(+), 809 deletions(-) create mode 100644 .github/workflows/crowdin-download.yml create mode 100644 .github/workflows/crowdin-upload.yml delete mode 100644 .github/workflows/generate-mo-files.yml delete mode 100644 .github/workflows/generate-pot-file.yml delete mode 100644 resources/locale/fr/LC_MESSAGES/mybot.mo delete mode 100644 resources/locale/mybot.pot diff --git a/.github/workflows/crowdin-download.yml b/.github/workflows/crowdin-download.yml new file mode 100644 index 0000000..9a9352a --- /dev/null +++ b/.github/workflows/crowdin-download.yml @@ -0,0 +1,51 @@ +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: EndBug/add-and-commit@v9 + # with: + # message: "PO files updated." + + # - name: Create pull request + # id: cpr_crowdin + # uses: peter-evans/create-pull-request@v3 + # with: + # token: ${{ secrets.GITHUB_TOKEN }} + # commit-message: Crowdin translations download + # title: "[Crowdin] Updated translation files" + # body: | + # Created by the [Crowdin download workflow](.github/workflows/crowdin_download.yml). + # branch: "auto/crowdin" + # author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> + + - name: create pull request + run: gh pr create -B auto/crowdin -H master --title 'Update translations.' --body 'Created by Github action' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/crowdin-upload.yml b/.github/workflows/crowdin-upload.yml new file mode 100644 index 0000000..4dac312 --- /dev/null +++ b/.github/workflows/crowdin-upload.yml @@ -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 }} diff --git a/.github/workflows/generate-mo-files.yml b/.github/workflows/generate-mo-files.yml deleted file mode 100644 index 6a3ab1e..0000000 --- a/.github/workflows/generate-mo-files.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Generate MO from PO files - -on: - push: - branches: [auto/crowdin] - paths: - - "**.po" - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - with: - token: ${{ secrets.GH_TOKEN }} - - - uses: actions/setup-python@v4 - with: - python-version: "3.11" - - - name: Run a one-line script - run: sh ./bin/po-to-mo.sh - - - uses: EndBug/add-and-commit@v9 - with: - message: "MO files generated." diff --git a/.github/workflows/generate-pot-file.yml b/.github/workflows/generate-pot-file.yml deleted file mode 100644 index 1b10832..0000000 --- a/.github/workflows/generate-pot-file.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Generate pot file - -on: - workflow_dispatch: - push: - branches: [master] - paths: - - "**.py" - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - - uses: actions/setup-python@v4 - with: - python-version: "3.11" - cache: pip - - - name: babel extract (pot file generation) - run: | - cd master - pip install babel - sh ./bin/pot-generation.sh - - - name: setup git - run: | - git config user.name "GitHub Actions Bot" - git config user.email "<>" - - - name: commit - run: | - git switch -c auto/translations-source - git add ./data/locale/mybot.pot - git commit -m "POT file generated" - git push origin auto/translations-source --force diff --git a/crowdin.yml b/crowdin.yml index eb47f01..a41511a 100644 --- a/crowdin.yml +++ b/crowdin.yml @@ -1,3 +1,6 @@ +project_id: "532668" +api_token_env: CROWDIN_API_KEY + files: - source: /resources/locale/*.pot translation: /resources/locale/%locale%/LC_MESSAGES/%file_name%.po diff --git a/resources/locale/fr/LC_MESSAGES/mybot.mo b/resources/locale/fr/LC_MESSAGES/mybot.mo deleted file mode 100644 index 27c12364a61f806d317bd47004b82d38bf0c4319..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 10948 zcmb7~3yd9CdB=}JLdcSkLK9wX!ttibu8HrpcO3_3W1FmB#KDf8^@B$gtl4{KcgLPP zb2Bq{AGWMiAhileAkq}Iw4ywR`_}X3m`Ro$vd9kMphn;Z0ZmqT$~s`2A^qAHPyp!++OaW6UNluLB$4 zR`B)UL*TVw0{#TJ3~mR19-IKb3TmqFg0BVt72FB_SGb-WGv;+%Zwl9uxqbl7fwv&sE^ry#5B@Ir5cmT4F7OmWYd;?c-vs_P zsD1SL(EQ&F_#F^Y&GX<}!T$r_0^WF?F*kq>Q19;r+u%v?&EW5YSAgFF`7wXN$L-)h zfo}lcz=zhk3Dk9y4~^RmYQFb^dj28sC&4^C{|IDEt2zI0asT(RPD(fOmiesBuq%TKCJK?C@9M7Vrg7db$-QYy%$vweE+(BjBe% z$^XybJgA4VPYcw#9Z>Ro7Sud{2+o544r-kyMzi2CQ0qMmPJ*8S#lvSn>F=8$TQGkK zz6N{_lzqMj-UGe>N`H6V=;e7ID1Dcp?C@z&e19U~lOWVIUjjAXS3r&XgYdi$YW;73 zTIbs!TQuJRHSWK`tHJ*bcm*VroMWJ#Uk_^D8^is#ff|1^C^>EerS}GiDa|fW>l_9( z&j&$`I~}eUK)ru9+%G{?XwHS_9}o9`0n|L71||PfpzQHG0lx}r{;z|$j`;>CdH*`# z--8F>nF= z7We?TlOVbXel+0o;Cs3LAfyrRJ`akg-v%}R^PuLxikl2IH-Xak3@AUjAG`(3KtwZ- zfs*5kp#0#OaQ#jOiwFBbC~EEn#s7!G^{;_i?`cr_dnVxDfKbc)8z}w%2;|4S*?Kwd z1U3FXQ2coi)cj{b@#<&6*Mpw`rTe+;|}{8R91@aoCn$Dnw3BlsF{B3$1N>b>0{ub4+bsAir7wU0jdTJT>$ z`O$xZSAj2r@|PchTIX7fB75Bc%5QH0HGT>dFLnhy3hMoNQ1dQ<(q9fru17%4_Yv@Q z;K#r#!N)<3|K)K12~cvbgW~ho!}Grdui^S1L9PEiQ1kr&)cZdKHSd*>Lp-|yZ0hn3feALN%Sv9&$v&jN!UV62f zeR-#YK2hX?J+ihpueg&{@hWnMCuUy}M{F~)(xGf&_B%<3$_kq(y*10cgHn>TiVHLs z#^zbNR&N$n7kLM5#J23ltz;pI+qPH6#brj9aaP&+82d@O}y;>R+eO8>C`Ua zB^$Nosk%S6YkAK`i$yH8CZ(N+tw6LA%Y^SX2ii$xqcqJ|P>WtF{jJ~|{vyuWVp^4S zVt=C(t=8V-Z#c>vfK)}`kbmDw0ZsFsxZ+#dwb6XutDL0B;qOaq36)~othLrO_YMc* zI}e_}@Q^u_wbEWY-WsnuwB01j5O+YyB=e4i*KTnk1c($NTVGU`}iWqQ|gZb3=KbaoW8ilA5+y++Za^{rI%EfQ@=2ES|P-4|u7!Fy%tB z7~XM7A<*~b9xwKil!*V5_uVe>M#mjn6;W2=1PFtB5;m5TGEuHn%8HlcV$Bh)u;d#* znU<~K$@$@ngJE#&M_AM!kb3W!1FD$agrHi|05K z0!MB5fXH4(Z6k|`3PXQHbqZ_>U4bRJmvzP*?{&L*QCZv=(aZ@P-=}XMp_r`j8}JR2Yh#(F-Ah1B zlh#>TMMV~R8=pIH{J@EEJKw7+xg!4N?kh$q$a=3Flujptr^IIP4Mx}U%)=6qK#HMa zAgJd>8#`Ch4lXx*#}z2&^?CY&h<3ipFN{2P1rnJh;$@W$IHrtW8+pT2^;qqu9)P|J z?9k19@(g=jNTWs1kG6;~>hx}-8SaU;x<#^#vR`gQZyq%^%}JcX`KNN3OXi-qgbZX~ zP)2SkhakQiOxhx?wy07eD)J^|?5tc-)TW|!{()epqBIf9%qisweT+ssLy4|mB12v& zI&Lx_!2LRu_>SfzNGeI63+Cf$MXa4-nYNwYu?n?6`YGQ)Ira6Hrt~oX0 zG484O;7T3m20jfT>m{C5(OH&EGISEPS}Kn>8K(>532uC)X@+5tubF-)D&vE^Kxz99 z<4-Q9eMU1iqmpbnshnDkJ0h4+NSIJL7^QgQV!y$4jp`qh_(I0`lF+0{cGgZ3Iqk{0 z!<$V_VZ}JAbJH2ENQ`P3<0~KI%B{c=({)S;aJm|ylu_6-zG5{bmtkl(6bG%d)G%gP zebjHpM%9h`fWuxCMW@`X#buTo=tKVIG^1}y*Wqgrf5S27SdpJWiH$?;#wk{Vgfq6Y zM!nYvdK{aJ6^I*0%EhGJ*xOqy8z=G^w=Ol&JsZY0iC|;Lj-F_^(+YDn_CwJbJH2gs zdt++4v2BN)-afPAj@!5KkAaQ3SV{D9dTScAq?Pu(5MEPF7ini^hShm8+PZ zu{-CJYV196rcfEP^|cwhH=2)AJKdbx-kcgcmQrV=je~j7DQ9ffb(iJt>AS7}x_dIS zd+gNayT{&-Lh==6Z3J~+tmBsqXdK!O&yiS1kQR)U=SQf~F`yVV)3+0CnqCUL9Yxox0it#kU|+?Y9;*^)4+)Jgr>BB>4z z{gzb1vy6CDs&zov)o9-|*znT$(OxocDbi>gWaBWX!x44ZXmG8A4mPv&4$g24A>#F1 zU6ibj-pKOaavV_-aX=qFU|L0^f}}`NK|J@ENUNa5Wssz_{U^esy32sT!{u~d95xsj ziv<1kPJSlwQ*l}JpH`D$F0Po{%w}0H#TgHEx_RmA!8V8EfhbU+M4rnx9Kz84I&SH^ z4y&%$uo`*}tF#=BYdU%q7?mK+g8g+8HO@Wa(HrL(eS_66(}Fk{7g84iJ*cPdM4&L< zs#_7RIU$w$Skt2xBfab^kiwa$wn#mRTih8!yH8@y3$>(FJT-sRoM2PbhXZBxvV>!i z~iOEY^XM#^D$(H@~P@rVaa=s_>YGd zi;&i2+Hxd>z}TTM z>c}|Gv|WVcl#lym{P4v6y9Z1-jhYxk%LCRL5WaNOVNE1f!luYZ|IhUEI?Hxp6 z`f?*!EcDV}GG<_9#m0*)y>UM5JlH0CP1$27xHY}o{yN_2{R}SC6H-(invdpCirtEc zuArwr--aD-upW&fmq6?85j!uPs>F{C4p!?|_AV2Ion2T+lqg&_ zs83S-@nl5R)JMyx+Rvlj|32S?U~YFDkzo8ur@y{Mp*L{Ygp(F=6?`yX*o|A4 zTI3vu`7(F?X(F_XP6N`GJ9S$FOklWY- zo}DEx|LRb>h&q=jk1x9#Sz!T>C8qk=%s!+5R)ZS2pW0Uus$p{#aTVgwz#-NI`Z$Up z_!)K}2g5)@nly4D)ZjY)(BG8d~C#>L97g z*FwXJ`2b2wDKWLDlKml${@y`VJwDfe^w9l>P8^y&eCYUrxp6g4a8LP|w#`1{LOTss zV*jr5)9#T0)Fg6Wl-%md68kKK{HZ-Ilkai*sMCK+MXzq{_noidJls^$vvtQy$#&55 z@(UoajRw()sRC_fK=lxz9E!( zRbbtcqc2&-HNzB_Ue#DNLs*2tCtXD^pXKk5-pT5iFICol)9HVKgJRSz`cGj8;y3gQ z?J|*ZLky%m@|`mo7Yj3#{vQ4!U5RKir%ny7e-;<6bLKzKc?ldRD#KY-zoCKV&m@}| z?M`zF8{WIZ`NySP5)EE5r4#PuyJ)9!4GKmWQu-xM?Z=6Gbn3ikx}5K1cXMobruSV; z$U9wLp_%5?WgOR4y~V~Ieg+LSr2!K%hVee*$}rr>F^%~+-aYN zS>0u;Te<4Cok@JRtu(b0gd);Vy_t|rwNAxhsWK{zee10>^%;cT8$L9dP0&do%(|RK zfcK3!z3Kg65FhCK$zhm0l(S}71)D%6gPNB6>%J2Q2h9krPrELiZo0zM49-}H=?}mm zBkE+);_nv945qF=-9(B7BW!g0^HPo;c?_*O3PY3klGEgV17#I#>vkQi)qh0L?GQ`U LuN%Z2*CqIWe-aR) diff --git a/resources/locale/mybot.pot b/resources/locale/mybot.pot deleted file mode 100644 index b6dfb3c..0000000 --- a/resources/locale/mybot.pot +++ /dev/null @@ -1,744 +0,0 @@ -# Translations template for MyBot. -# Copyright (C) 2023 ORGANIZATION -# This file is distributed under the same license as the MyBot project. -# FIRST AUTHOR , 2023. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: MyBot 1.0\n" -"Report-Msgid-Bugs-To: contact@mybot-discord.com\n" -"POT-Creation-Date: 2023-12-05 23:54+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=utf-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Generated-By: Babel 2.13.1\n" - -#: src/cogs/help.py:29 -msgid "slash command" -msgstr "" - -#: src/cogs/help.py:30 -msgid "message context" -msgstr "" - -#: src/cogs/help.py:31 -msgid "user context" -msgstr "" - -#: src/cogs/help.py:32 -msgid "miscellaneous" -msgstr "" - -#: src/cogs/help.py:40 -msgid "help" -msgstr "" - -#: src/cogs/help.py:40 -msgid "Get help about the bot." -msgstr "" - -#: src/cogs/help.py:41 -msgid "feature" -msgstr "" - -#: src/cogs/help.py:72 -msgid "Commands of MyBot" -msgstr "" - -#: src/cogs/help.py:76 -msgid "Slash commands" -msgstr "" - -#: src/cogs/help.py:77 -msgid "Context commands" -msgstr "" - -#: src/cogs/help.py:78 -msgid "Miscellaneous features" -msgstr "" - -#: src/cogs/help.py:148 -msgid "Help about {} [{}]" -msgstr "" - -#: src/cogs/ping.py:28 -msgid "ping" -msgstr "" - -#: src/cogs/ping.py:29 -msgid "Get the bot latency." -msgstr "" - -#: src/cogs/stats.py:40 -msgid "stats" -msgstr "" - -#: src/cogs/stats.py:41 -msgid "Get some stats about the bot." -msgstr "" - -#: src/cogs/calculator/__init__.py:41 -msgid "calculator" -msgstr "" - -#: src/cogs/calculator/__init__.py:42 -msgid "Show a calculator you can use." -msgstr "" - -#: src/cogs/calculator/__init__.py:66 -msgid "Invalid expression" -msgstr "" - -#: src/cogs/clear/__init__.py:54 -msgid "Delete multiple messages with some filters." -msgstr "" - -#: src/cogs/clear/__init__.py:60 -msgid "The amount of messages to delete." -msgstr "" - -#: src/cogs/clear/__init__.py:61 -msgid "Delete only messages from the specified user." -msgstr "" - -#: src/cogs/clear/__init__.py:62 -msgid "Delete only messages whose user has the specified role." -msgstr "" - -#: src/cogs/clear/__init__.py:63 -msgid "Delete only messages that match the specified search (can be regex)." -msgstr "" - -#: src/cogs/clear/__init__.py:66 -msgid "Delete only messages that contains the selected entry. #TODO" -msgstr "" - -#: src/cogs/clear/__init__.py:69 -msgid "" -"Delete only messages where length match the specified entry. (e.g. " -"'<=100', '5', '>10') #TODO" -msgstr "" - -#: src/cogs/clear/__init__.py:70 -msgid "" -"Delete only messages sent before the specified message or date. (yyyy-mm-" -"dd) #TODO" -msgstr "" - -#: src/cogs/clear/__init__.py:71 -msgid "" -"Delete only messages sent after the specified message or date. (yyyy-mm-" -"dd) #TODO" -msgstr "" - -#: src/cogs/clear/__init__.py:72 -msgid "" -"Include/exclude pinned messages in deletion, or deletes \"only\" pinned " -"messages. (default to exclude)" -msgstr "" - -#: src/cogs/clear/__init__.py:77 -msgid "amount" -msgstr "" - -#: src/cogs/clear/__init__.py:78 -msgid "user" -msgstr "" - -#: src/cogs/clear/__init__.py:79 -msgid "role" -msgstr "" - -#: src/cogs/clear/__init__.py:80 -msgid "search" -msgstr "" - -#: src/cogs/clear/__init__.py:81 -msgid "has" -msgstr "" - -#: src/cogs/clear/__init__.py:82 -msgid "length" -msgstr "" - -#: src/cogs/clear/__init__.py:83 -msgid "before" -msgstr "" - -#: src/cogs/clear/__init__.py:84 -msgid "after" -msgstr "" - -#: src/cogs/clear/__init__.py:85 -msgid "pinned" -msgstr "" - -#: src/cogs/clear/__init__.py:106 -msgid "You must supply a number between 1 and 250. (0 < {amount} < 251)" -msgstr "" - -#: src/cogs/clear/__init__.py:144 -msgid "Clearing {amount} message(s)..." -msgstr "" - -#: src/cogs/clear/__init__.py:146 -msgid "" -"Analyzed: {analyzed}\n" -"Deleted: {deleted}/{goal}\n" -"Planned for deletion: {planned}" -msgstr "" - -#: src/cogs/clear/__init__.py:187 -msgid "Cannot clear more than 3 minutes. {} message(s) deleted." -msgstr "" - -#: src/cogs/clear/__init__.py:188 -msgid "Clear cancelled. {} message(s) deleted." -msgstr "" - -#: src/cogs/clear/__init__.py:196 -msgid "{} message(s) deleted." -msgstr "" - -#: src/cogs/clear/__init__.py:266 src/cogs/poll/edit.py:229 -#: src/cogs/poll/edit.py:327 src/cogs/poll/edit.py:389 -#: src/cogs/poll/edit.py:431 src/cogs/poll/edit.py:470 -#: src/cogs/poll/edit.py:500 -msgid "Cancel" -msgstr "" - -#: src/cogs/clear/clear_transformers.py:29 -msgid "include" -msgstr "" - -#: src/cogs/clear/clear_transformers.py:30 -msgid "exclude" -msgstr "" - -#: src/cogs/clear/clear_transformers.py:31 -msgid "only" -msgstr "" - -#: src/cogs/clear/clear_transformers.py:47 -msgid "image" -msgstr "" - -#: src/cogs/clear/clear_transformers.py:48 -msgid "video" -msgstr "" - -#: src/cogs/clear/clear_transformers.py:49 -msgid "audio" -msgstr "" - -#: src/cogs/clear/clear_transformers.py:50 -msgid "stickers" -msgstr "" - -#: src/cogs/clear/clear_transformers.py:51 -msgid "file" -msgstr "" - -#: src/cogs/clear/clear_transformers.py:52 -msgid "embed" -msgstr "" - -#: src/cogs/clear/clear_transformers.py:53 -msgid "link (any URL)" -msgstr "" - -#: src/cogs/clear/clear_transformers.py:54 -msgid "mention" -msgstr "" - -#: src/cogs/clear/clear_transformers.py:55 -msgid "discord invitation" -msgstr "" - -#: src/cogs/config/__init__.py:31 -msgid "config" -msgstr "" - -#: src/cogs/config/__init__.py:32 -msgid "Set configurations." -msgstr "" - -#: src/cogs/config/__init__.py:36 -msgid "guild" -msgstr "" - -#: src/cogs/config/__init__.py:37 -msgid "Set configuration for the guild." -msgstr "" - -#: src/cogs/config/__init__.py:40 -msgid "bot" -msgstr "" - -#: src/cogs/config/__init__.py:41 -msgid "Set configuration for the bot." -msgstr "" - -#: src/cogs/config/__init__.py:53 -msgid "emote" -msgstr "" - -#: src/cogs/config/__init__.py:54 -msgid "Add restriction to an emote for a role." -msgstr "" - -#: src/cogs/config/__init__.py:61 -msgid "public_translations" -msgstr "" - -#: src/cogs/config/__init__.py:62 -msgid "Set if the translations are visible for everyone or not." -msgstr "" - -#: src/cogs/config/config_bot.py:29 -msgid "Translations will now be public." -msgstr "" - -#: src/cogs/config/config_bot.py:30 -msgid "Translations will now be private." -msgstr "" - -#: src/cogs/game/__init__.py:33 -msgid "game" -msgstr "" - -#: src/cogs/game/__init__.py:34 -msgid "Play some games." -msgstr "" - -#: src/cogs/game/__init__.py:58 -msgid "connect4" -msgstr "" - -#: src/cogs/game/__init__.py:59 -msgid "Play connect 4" -msgstr "" - -#: src/cogs/game/__init__.py:66 -msgid "rpc" -msgstr "" - -#: src/cogs/game/__init__.py:67 -msgid "Play rock paper scissors" -msgstr "" - -#: src/cogs/game/__init__.py:74 -msgid "tictactoe" -msgstr "" - -#: src/cogs/game/__init__.py:75 -msgid "Play tictactoe" -msgstr "" - -#: src/cogs/game/__init__.py:82 -msgid "minesweeper" -msgstr "" - -#: src/cogs/game/__init__.py:83 -msgid "Play minesweeper" -msgstr "" - -#: src/cogs/game/__init__.py:90 -msgid "2048" -msgstr "" - -#: src/cogs/game/__init__.py:91 -msgid "Play 2048" -msgstr "" - -#: src/cogs/poll/__init__.py:35 -msgid "poll" -msgstr "" - -#: src/cogs/poll/__init__.py:35 src/cogs/poll/__init__.py:113 -#: src/cogs/poll/edit.py:186 -msgid "Create a new poll" -msgstr "" - -#: src/cogs/poll/__init__.py:41 -msgid "Edit poll" -msgstr "" - -#: src/cogs/poll/__init__.py:43 -msgid "Use this to edit a poll even after creation." -msgstr "" - -#: src/cogs/poll/__init__.py:76 -msgid "custom_choice" -msgstr "" - -#: src/cogs/poll/__init__.py:77 -msgid "A poll with customizable options." -msgstr "" - -#: src/cogs/poll/__init__.py:85 -msgid "yesno" -msgstr "" - -#: src/cogs/poll/__init__.py:86 -msgid "A simple poll with \"Yes\" and \"No\" as options." -msgstr "" - -#: src/cogs/poll/__init__.py:101 -msgid "This message is not a poll." -msgstr "" - -#: src/cogs/poll/__init__.py:103 -msgid "You are not the author of this poll. You can't edit it." -msgstr "" - -#: src/cogs/poll/__init__.py:120 src/cogs/poll/edit.py:192 -msgid "Poll question" -msgstr "" - -#: src/cogs/poll/__init__.py:120 src/cogs/poll/edit.py:193 -msgid "Do you agree this bot is awesome?" -msgstr "" - -#: src/cogs/poll/__init__.py:124 src/cogs/poll/edit.py:200 -msgid "Poll description" -msgstr "" - -#: src/cogs/poll/__init__.py:125 src/cogs/poll/edit.py:202 -msgid "Tell more about your poll here." -msgstr "" - -#: src/cogs/poll/__init__.py:147 -msgid "Choice 1" -msgstr "" - -#: src/cogs/poll/__init__.py:148 -msgid "Yes, totally!" -msgstr "" - -#: src/cogs/poll/__init__.py:152 -msgid "Choice 2" -msgstr "" - -#: src/cogs/poll/__init__.py:153 -msgid "Absolutely!" -msgstr "" - -#: src/cogs/poll/__init__.py:157 -msgid "Choice 3" -msgstr "" - -#: src/cogs/poll/__init__.py:158 -msgid "Of course!" -msgstr "" - -#: src/cogs/poll/display.py:78 -msgid "Poll created by {}" -msgstr "" - -#: src/cogs/poll/display.py:88 -msgid "Poll closed.\n" -msgstr "" - -#: src/cogs/poll/display.py:90 -msgid "No end date.\n" -msgstr "" - -#: src/cogs/poll/display.py:91 -msgid "Poll ends \n" -msgstr "" - -#: src/cogs/poll/display.py:112 -msgid "Yes!" -msgstr "" - -#: src/cogs/poll/display.py:112 -msgid "No!" -msgstr "" - -#: src/cogs/poll/edit.py:25 -msgid "Select what you want to edit." -msgstr "" - -#: src/cogs/poll/edit.py:58 src/cogs/poll/edit.py:499 -msgid "Reset" -msgstr "" - -#: src/cogs/poll/edit.py:59 -msgid "Save" -msgstr "" - -#: src/cogs/poll/edit.py:66 -msgid "The results are {}." -msgstr "" - -#: src/cogs/poll/edit.py:66 -msgid "public" -msgstr "" - -#: src/cogs/poll/edit.py:66 -msgid "private" -msgstr "" - -#: src/cogs/poll/edit.py:69 -msgid "Users {} change their answer once voted." -msgstr "" - -#: src/cogs/poll/edit.py:70 -msgid "can" -msgstr "" - -#: src/cogs/poll/edit.py:70 -msgid "can't" -msgstr "" - -#: src/cogs/poll/edit.py:83 -msgid "Reopen poll" -msgstr "" - -#: src/cogs/poll/edit.py:86 -msgid "Close poll" -msgstr "" - -#: src/cogs/poll/edit.py:158 -msgid "The poll has been updated while you were voting." -msgstr "" - -#: src/cogs/poll/edit.py:182 -msgid "Edit title and description" -msgstr "" - -#: src/cogs/poll/edit.py:218 -msgid "Edit ending time" -msgstr "" - -#: src/cogs/poll/edit.py:219 -msgid "Set a poll duration, it will be closed automatically." -msgstr "" - -#: src/cogs/poll/edit.py:226 -msgid "Select the number of days." -msgstr "" - -#: src/cogs/poll/edit.py:227 -msgid "Select the number of hours." -msgstr "" - -#: src/cogs/poll/edit.py:228 -msgid "Select the number of minutes." -msgstr "" - -#: src/cogs/poll/edit.py:230 src/cogs/poll/edit.py:326 -#: src/cogs/poll/edit.py:388 src/cogs/poll/edit.py:432 -#: src/cogs/poll/edit.py:471 -msgid "Back" -msgstr "" - -#: src/cogs/poll/edit.py:232 -msgid "{} day(s)" -msgstr "" - -#: src/cogs/poll/edit.py:233 -msgid "{} hour(s)" -msgstr "" - -#: src/cogs/poll/edit.py:235 -msgid "{} minute(s)" -msgstr "" - -#: src/cogs/poll/edit.py:316 -msgid "Edit choices" -msgstr "" - -#: src/cogs/poll/edit.py:317 -msgid "Add and removes choices for multiple choices polls." -msgstr "" - -#: src/cogs/poll/edit.py:324 -msgid "Add a choice" -msgstr "" - -#: src/cogs/poll/edit.py:325 -msgid "Remove a choice" -msgstr "" - -#: src/cogs/poll/edit.py:360 -msgid "Add a new choice" -msgstr "" - -#: src/cogs/poll/edit.py:365 -msgid "Choice" -msgstr "" - -#: src/cogs/poll/edit.py:366 -msgid "Enter a new choice here." -msgstr "" - -#: src/cogs/poll/edit.py:390 -msgid "Select the choices you want to remove." -msgstr "" - -#: src/cogs/poll/edit.py:423 -msgid "Edit max choices" -msgstr "" - -#: src/cogs/poll/edit.py:424 -msgid "Set the maximum of simultaneous values users can choose." -msgstr "" - -#: src/cogs/poll/edit.py:434 -msgid "Select the maximum number of choices." -msgstr "" - -#: src/cogs/poll/edit.py:462 -msgid "Edit allowed roles" -msgstr "" - -#: src/cogs/poll/edit.py:463 -msgid "Only users with one of these role can vote." -msgstr "" - -#: src/cogs/poll/edit.py:472 -msgid "Select the roles that can vote." -msgstr "" - -#: src/cogs/poll/edit.py:506 -msgid "" -"This operation cannot be undone. By clicking on the \"RESET\" button, all" -" the votes will be deleted." -msgstr "" - -#: src/cogs/poll/vote_menus.py:39 -msgid "Vote" -msgstr "" - -#: src/cogs/poll/vote_menus.py:53 -msgid "Sorry, this poll seems not to exist. Please contact an admin." -msgstr "" - -#: src/cogs/poll/vote_menus.py:62 -msgid "Sorry, this poll is closed, you can't vote anymore!" -msgstr "" - -#: src/cogs/poll/vote_menus.py:70 -msgid "Sorry, this poll is over, you can't vote anymore!" -msgstr "" - -#: src/cogs/poll/vote_menus.py:77 -msgid "Sorry, you need one of the following roles to vote :" -msgstr "" - -#: src/cogs/poll/vote_menus.py:153 -msgid "Remove vote" -msgstr "" - -#: src/cogs/poll/vote_menus.py:154 -msgid "Validate" -msgstr "" - -#: src/cogs/poll/vote_menus.py:193 src/cogs/poll/vote_menus.py:252 -msgid "Your vote has been removed." -msgstr "" - -#: src/cogs/poll/vote_menus.py:214 src/cogs/poll/vote_menus.py:244 -msgid "Your vote has been taken into account!" -msgstr "" - -#: src/cogs/poll/vote_menus.py:221 -msgid "Yes" -msgstr "" - -#: src/cogs/poll/vote_menus.py:222 -msgid "No" -msgstr "" - -#: src/cogs/translate/__init__.py:165 -msgid "Translate" -msgstr "" - -#: src/cogs/translate/__init__.py:169 -msgid "Translate a message based on your discord settings." -msgstr "" - -#: src/cogs/translate/__init__.py:181 -msgid "translate" -msgstr "" - -#: src/cogs/translate/__init__.py:182 -msgid "Translate text in a selection of languages." -msgstr "" - -#: src/cogs/translate/__init__.py:189 -msgid "The language you provided is not supported." -msgstr "" - -#: src/cogs/translate/__init__.py:232 -msgid "Translate text in the language corresponding on the flag you add." -msgstr "" - -#: src/cogs/translate/__init__.py:254 -msgid "The language you asked for is not supported." -msgstr "" - -#: src/cogs/translate/__init__.py:285 -msgid "Your locale is not supported." -msgstr "" - -#: src/cogs/translate/__init__.py:312 -msgid "Vote for the bot" -msgstr "" - -#: src/cogs/translate/__init__.py:319 -msgid "" -"You have reached the maximum number of translations per day.Vote for the " -"bot to remove this limit !" -msgstr "" - -#: src/cogs/translate/__init__.py:360 -msgid "Translate from {from_} to {to}" -msgstr "" - -#: src/core/error_handler.py:50 -msgid "Support server" -msgstr "" - -#: src/core/error_handler.py:64 -msgid "" -"This command is already executed the max amount of times. (Max: " -"{error.rate})" -msgstr "" - -#: src/core/error_handler.py:67 -msgid "This command needs some conditions you don't meet." -msgstr "" - -#: src/core/error_handler.py:70 -msgid "You provided a bad argument." -msgstr "" - -#: src/core/error_handler.py:73 -msgid "" -"The bot is missing some permissions.\n" -"`{}`" -msgstr "" - -#: src/core/error_handler.py:77 -msgid "" -"It looks like the bot has been added incorrectly. Please ask an admin to " -"re-add the bot." -msgstr "" - -#: src/core/error_handler.py:80 -msgid "This command cannot be used in DMs." -msgstr "" - -#: src/core/error_handler.py:83 -msgid "" -"An unhandled error happened.\n" -"Please ask on the support server!" -msgstr "" - From b416a278e55008b5d1fd5c96b17b846f065b03b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C4=B1=CE=B5=D1=8F=D1=8F=CE=B5?= <47398145+AiroPi@users.noreply.github.com> Date: Wed, 6 Dec 2023 17:23:18 +0100 Subject: [PATCH 08/11] Update PR creation process --- .github/workflows/crowdin-download.yml | 27 +++++++------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/.github/workflows/crowdin-download.yml b/.github/workflows/crowdin-download.yml index 9a9352a..4f7f3a7 100644 --- a/.github/workflows/crowdin-download.yml +++ b/.github/workflows/crowdin-download.yml @@ -29,23 +29,10 @@ jobs: env: CROWDIN_API_KEY: ${{ secrets.CROWDIN_API_KEY }} - # - uses: EndBug/add-and-commit@v9 - # with: - # message: "PO files updated." - - # - name: Create pull request - # id: cpr_crowdin - # uses: peter-evans/create-pull-request@v3 - # with: - # token: ${{ secrets.GITHUB_TOKEN }} - # commit-message: Crowdin translations download - # title: "[Crowdin] Updated translation files" - # body: | - # Created by the [Crowdin download workflow](.github/workflows/crowdin_download.yml). - # branch: "auto/crowdin" - # author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> - - - name: create pull request - run: gh pr create -B auto/crowdin -H master --title 'Update translations.' --body 'Created by Github action' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Create Pull Request + uses: peter-evans/create-pull-request@v5 + with: + commit-message: "PO files added." + branch: auto/crowdin + title: "Update translations" + add-paths: "**.po" From d26a695fadcab69825b0dc81065899f0b945f588 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C4=B1=CE=B5=D1=8F=D1=8F=CE=B5?= <47398145+AiroPi@users.noreply.github.com> Date: Wed, 6 Dec 2023 17:49:44 +0100 Subject: [PATCH 09/11] Use App to commit, to trigger workflows. --- .github/workflows/crowdin-download.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/crowdin-download.yml b/.github/workflows/crowdin-download.yml index 4f7f3a7..f41e619 100644 --- a/.github/workflows/crowdin-download.yml +++ b/.github/workflows/crowdin-download.yml @@ -29,9 +29,16 @@ jobs: 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" From 96699eb7c05b8261ef38eff110cfa0d90a53e02a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 6 Dec 2023 17:58:43 +0100 Subject: [PATCH 10/11] Update translations (#121) --- resources/locale/fr/LC_MESSAGES/mybot.po | 76 +++++++++++++----------- 1 file changed, 40 insertions(+), 36 deletions(-) diff --git a/resources/locale/fr/LC_MESSAGES/mybot.po b/resources/locale/fr/LC_MESSAGES/mybot.po index 80e6e79..8e3e32c 100644 --- a/resources/locale/fr/LC_MESSAGES/mybot.po +++ b/resources/locale/fr/LC_MESSAGES/mybot.po @@ -2,8 +2,8 @@ msgid "" msgstr "" "Project-Id-Version: mybot-discord\n" "Report-Msgid-Bugs-To: contact@mybot-discord.com\n" -"POT-Creation-Date: 2023-12-05 23:54+0000\n" -"PO-Revision-Date: 2023-12-05 23:57\n" +"POT-Creation-Date: 2023-12-06 16:02+0000\n" +"PO-Revision-Date: 2023-12-06 16:50\n" "Last-Translator: \n" "Language-Team: French\n" "MIME-Version: 1.0\n" @@ -14,8 +14,8 @@ msgstr "" "X-Crowdin-Project: mybot-discord\n" "X-Crowdin-Project-ID: 532668\n" "X-Crowdin-Language: fr\n" -"X-Crowdin-File: /auto.translations-source/resources/locale/mybot.pot\n" -"X-Crowdin-File-ID: 60\n" +"X-Crowdin-File: mybot.pot\n" +"X-Crowdin-File-ID: 68\n" "Language: fr_FR\n" #: src/cogs/help.py:29 @@ -68,7 +68,7 @@ msgstr "Aide à propos de {} [{}]" #: src/cogs/ping.py:28 msgid "ping" -msgstr "" +msgstr "ping" #: src/cogs/ping.py:29 msgid "Get the bot latency." @@ -76,11 +76,11 @@ msgstr "Obtenir la latence du bot." #: src/cogs/stats.py:40 msgid "stats" -msgstr "" +msgstr "stats" #: src/cogs/stats.py:41 msgid "Get some stats about the bot." -msgstr "" +msgstr "Obtenez quelques statistiques sur le bot." #: src/cogs/calculator/__init__.py:41 msgid "calculator" @@ -92,7 +92,7 @@ msgstr "Afficher une calculatrice que vous pouvez utiliser." #: src/cogs/calculator/__init__.py:66 msgid "Invalid expression" -msgstr "" +msgstr "Expression invalide" #: src/cogs/clear/__init__.py:54 msgid "Delete multiple messages with some filters." @@ -128,7 +128,7 @@ msgstr "Supprimer uniquement les messages envoyés avant le message ou la date s #: src/cogs/clear/__init__.py:71 msgid "Delete only messages sent after the specified message or date. (yyyy-mm-dd) #TODO" -msgstr "" +msgstr "Supprimer les messages envoyés après un message ou une date. (aaaa-mm-jj) #TODO" #: src/cogs/clear/__init__.py:72 msgid "Include/exclude pinned messages in deletion, or deletes \"only\" pinned messages. (default to exclude)" @@ -182,7 +182,9 @@ msgstr "Suppression de {amount} message(s)..." msgid "Analyzed: {analyzed}\n" "Deleted: {deleted}/{goal}\n" "Planned for deletion: {planned}" -msgstr "" +msgstr "Analysés : {analyzed}\n" +"Supprimés : {deleted}/{goal}\n" +"Prévu pour la suppression : {planned}" #: src/cogs/clear/__init__.py:187 msgid "Cannot clear more than 3 minutes. {} message(s) deleted." @@ -217,7 +219,7 @@ msgstr "seulement" #: src/cogs/clear/clear_transformers.py:47 msgid "image" -msgstr "" +msgstr "image" #: src/cogs/clear/clear_transformers.py:48 msgid "video" @@ -225,7 +227,7 @@ msgstr "vidéo" #: src/cogs/clear/clear_transformers.py:49 msgid "audio" -msgstr "" +msgstr "audio" #: src/cogs/clear/clear_transformers.py:50 msgid "stickers" @@ -233,11 +235,11 @@ msgstr "autocollants" #: src/cogs/clear/clear_transformers.py:51 msgid "file" -msgstr "" +msgstr "fichier" #: src/cogs/clear/clear_transformers.py:52 msgid "embed" -msgstr "" +msgstr "embed" #: src/cogs/clear/clear_transformers.py:53 msgid "link (any URL)" @@ -245,7 +247,7 @@ msgstr "lien (n'importe quelle URL)" #: src/cogs/clear/clear_transformers.py:54 msgid "mention" -msgstr "" +msgstr "mention" #: src/cogs/clear/clear_transformers.py:55 msgid "discord invitation" @@ -269,7 +271,7 @@ msgstr "Définir la configuration du serveur." #: src/cogs/config/__init__.py:40 msgid "bot" -msgstr "" +msgstr "bot" #: src/cogs/config/__init__.py:41 msgid "Set configuration for the bot." @@ -317,11 +319,11 @@ msgstr "Jouer au puissance 4" #: src/cogs/game/__init__.py:66 msgid "rpc" -msgstr "" +msgstr "pcc" #: src/cogs/game/__init__.py:67 msgid "Play rock paper scissors" -msgstr "" +msgstr "Jouer à Pierre Feuille Ciseaux" #: src/cogs/game/__init__.py:74 msgid "tictactoe" @@ -333,19 +335,19 @@ msgstr "Jouer au morpion" #: src/cogs/game/__init__.py:82 msgid "minesweeper" -msgstr "" +msgstr "démineur" #: src/cogs/game/__init__.py:83 msgid "Play minesweeper" -msgstr "" +msgstr "Jouer au démineur" #: src/cogs/game/__init__.py:90 msgid "2048" -msgstr "" +msgstr "2048" #: src/cogs/game/__init__.py:91 msgid "Play 2048" -msgstr "" +msgstr "Jouer au 2048" #: src/cogs/poll/__init__.py:35 msgid "poll" @@ -386,7 +388,7 @@ msgstr "Ce message n'est pas un sondage." #: src/cogs/poll/__init__.py:103 msgid "You are not the author of this poll. You can't edit it." -msgstr "" +msgstr "Vous n'êtes pas le créateur du sondage. Vous ne pouvez pas le modifier." #: src/cogs/poll/__init__.py:120 src/cogs/poll/edit.py:192 msgid "Poll question" @@ -422,11 +424,11 @@ msgstr "Absolument !" #: src/cogs/poll/__init__.py:157 msgid "Choice 3" -msgstr "" +msgstr "Choix 3" #: src/cogs/poll/__init__.py:158 msgid "Of course!" -msgstr "" +msgstr "Bien sûr !" #: src/cogs/poll/display.py:78 msgid "Poll created by {}" @@ -446,11 +448,11 @@ msgstr "Le sondage se termine \n" #: src/cogs/poll/display.py:112 msgid "Yes!" -msgstr "" +msgstr "Oui !" #: src/cogs/poll/display.py:112 msgid "No!" -msgstr "" +msgstr "Non !" #: src/cogs/poll/edit.py:25 msgid "Select what you want to edit." @@ -502,7 +504,7 @@ msgstr "Le sondage a été mis à jour pendant votre vote." #: src/cogs/poll/edit.py:182 msgid "Edit title and description" -msgstr "" +msgstr "Modifier le titre et la description" #: src/cogs/poll/edit.py:218 msgid "Edit ending time" @@ -540,7 +542,7 @@ msgstr "{} heure(s)" #: src/cogs/poll/edit.py:235 msgid "{} minute(s)" -msgstr "" +msgstr "{} minute(s)" #: src/cogs/poll/edit.py:316 msgid "Edit choices" @@ -684,7 +686,7 @@ msgstr "Votez pour le bot" #: src/cogs/translate/__init__.py:319 msgid "You have reached the maximum number of translations per day.Vote for the bot to remove this limit !" -msgstr "" +msgstr "Vous avez atteint le nombre maximum de traduction par jour. Votez pour le bot pour retirer cette limite !" #: src/cogs/translate/__init__.py:360 msgid "Translate from {from_} to {to}" @@ -700,27 +702,29 @@ msgstr "Cette commande est déjà exécutée le nombre maximal de fois. (Max : #: src/core/error_handler.py:67 msgid "This command needs some conditions you don't meet." -msgstr "" +msgstr "Cette commande nécessite certaines conditions que vous ne remplissez pas." #: src/core/error_handler.py:70 msgid "You provided a bad argument." -msgstr "" +msgstr "Vous avez fourni un mauvais argument." #: src/core/error_handler.py:73 msgid "The bot is missing some permissions.\n" "`{}`" -msgstr "" +msgstr "Il manque des permissions au bot.\n" +"`{}`" #: src/core/error_handler.py:77 msgid "It looks like the bot has been added incorrectly. Please ask an admin to re-add the bot." -msgstr "" +msgstr "Il semblerait que le bot ait été ajouté de manière incorrecte. Veuillez demander à un administrateur de ré-ajouter le bot." #: src/core/error_handler.py:80 msgid "This command cannot be used in DMs." -msgstr "" +msgstr "Cette commande ne peut pas être utilisée en message privé." #: src/core/error_handler.py:83 msgid "An unhandled error happened.\n" "Please ask on the support server!" -msgstr "" +msgstr "Une erreur inattendue est survenue.\n" +"Demandez de l'aide sur le serveur de support !" From 2db7d8a44b766e15e15f2b46cf4c8913bf8a6706 Mon Sep 17 00:00:00 2001 From: "airo.pi_" <47398145+AiroPi@users.noreply.github.com> Date: Fri, 15 Dec 2023 10:19:40 +0100 Subject: [PATCH 11/11] refactor code - rename SpecialCog to ExtendedCog - rename SpecialGroupCog to ExtendedGroupCog - merge cog_property.py, misc_command.py and special_cog.py to extended_commands.py - move modules out of core - rename modules to libraries - clean imports by using relative inside core --- src/cogs/admin.py | 4 +- src/cogs/api.py | 8 +- src/cogs/calculator/__init__.py | 4 +- src/cogs/clear/__init__.py | 7 +- src/cogs/config/__init__.py | 4 +- src/cogs/config/config_bot.py | 6 +- src/cogs/config/config_guild.py | 6 +- src/cogs/eval.py | 7 +- src/cogs/game/__init__.py | 4 +- src/cogs/game/connect4.py | 6 +- src/cogs/game/game_2084.py | 6 +- src/cogs/game/minesweeper/__init__.py | 6 +- src/cogs/game/rpc.py | 6 +- src/cogs/game/tictactoe.py | 6 +- src/cogs/help.py | 8 +- src/cogs/ping.py | 8 +- src/cogs/poll/__init__.py | 4 +- src/cogs/restore.py | 4 +- src/cogs/stats.py | 7 +- src/cogs/translate/__init__.py | 4 +- src/cogs/translate/adapters/libretranslate.py | 2 +- src/cogs/translate/adapters/microsoft.py | 2 +- src/commands_exporter.py | 2 +- src/core/__init__.py | 9 ++- src/core/_types.py | 5 +- src/core/checkers/app.py | 2 +- src/core/checkers/base.py | 2 +- src/core/checkers/max_concurrency.py | 2 +- src/core/checkers/misc.py | 2 +- src/core/cog_property.py | 30 -------- src/core/custom_command_tree.py | 2 +- src/core/error_handler.py | 4 +- .../{misc_command.py => extended_commands.py} | 76 +++++++++++++++++-- src/core/special_cog.py | 50 ------------ .../libre_translate/__init__.py | 0 .../libre_translate/_types.py | 0 .../libre_translate/languages.py | 0 .../libre_translate/main.py | 0 .../microsoft_translation/__init__.py | 0 .../microsoft_translation/__main__.py | 0 .../microsoft_translation/translator.py | 0 src/mybot.py | 9 +-- 42 files changed, 139 insertions(+), 175 deletions(-) delete mode 100644 src/core/cog_property.py rename src/core/{misc_command.py => extended_commands.py} (77%) delete mode 100644 src/core/special_cog.py rename src/{core/modules => libraries}/libre_translate/__init__.py (100%) rename src/{core/modules => libraries}/libre_translate/_types.py (100%) rename src/{core/modules => libraries}/libre_translate/languages.py (100%) rename src/{core/modules => libraries}/libre_translate/main.py (100%) rename src/{core/modules => libraries}/microsoft_translation/__init__.py (100%) rename src/{core/modules => libraries}/microsoft_translation/__main__.py (100%) rename src/{core/modules => libraries}/microsoft_translation/translator.py (100%) diff --git a/src/cogs/admin.py b/src/cogs/admin.py index 7943e9f..9cc46df 100644 --- a/src/cogs/admin.py +++ b/src/cogs/admin.py @@ -5,7 +5,7 @@ from discord import app_commands -from core import SpecialCog, config +from core import ExtendedCog, config if TYPE_CHECKING: from discord import Interaction @@ -15,7 +15,7 @@ logger = logging.getLogger(__name__) -class Admin(SpecialCog["MyBot"]): # TODO(airo.pi_): add checkers +class Admin(ExtendedCog): # TODO(airo.pi_): add checkers @app_commands.command() @app_commands.guilds(config.SUPPORT_GUILD_ID) async def reload_extension(self, inter: Interaction, extension: str): diff --git a/src/cogs/api.py b/src/cogs/api.py index 1f09d04..5584d97 100644 --- a/src/cogs/api.py +++ b/src/cogs/api.py @@ -8,7 +8,7 @@ from aiohttp import hdrs, web from psutil import Process -from core import SpecialCog, config +from core import ExtendedCog, config if TYPE_CHECKING: from mybot import MyBot @@ -17,7 +17,7 @@ logger = logging.getLogger(__name__) P = ParamSpec("P") -S = TypeVar("S", bound="SpecialCog[MyBot]") +S = TypeVar("S", bound="ExtendedCog") def route(method: str, path: str): @@ -28,9 +28,9 @@ def wrap(func: Callable[Concatenate[S, web.Request, P], Awaitable[web.Response]] return wrap -class API(SpecialCog["MyBot"]): +class API(ExtendedCog): def __init__(self, bot: MyBot): - self.bot: MyBot = bot + super().__init__(bot) self.app = web.Application() self.runner = web.AppRunner(self.app) self.routes = web.RouteTableDef() diff --git a/src/cogs/calculator/__init__.py b/src/cogs/calculator/__init__.py index 01fe7c1..3a93f22 100644 --- a/src/cogs/calculator/__init__.py +++ b/src/cogs/calculator/__init__.py @@ -12,7 +12,7 @@ from discord import ButtonStyle, app_commands, ui from discord.app_commands import locale_str as __ -from core import SpecialCog +from core import ExtendedCog from core.i18n import _ from .calcul import Calcul, UnclosedParentheses @@ -36,7 +36,7 @@ def display_calcul(calcul: Calcul) -> str: return display -class Calculator(SpecialCog["MyBot"]): +class Calculator(ExtendedCog): @app_commands.command( name=__("calculator"), description=__("Show a calculator you can use."), diff --git a/src/cogs/clear/__init__.py b/src/cogs/clear/__init__.py index 0c3e733..36ff9aa 100644 --- a/src/cogs/clear/__init__.py +++ b/src/cogs/clear/__init__.py @@ -8,10 +8,9 @@ import discord from discord import app_commands, ui from discord.app_commands import Transform, locale_str as __ -from discord.ext.commands import Cog # pyright: ignore[reportMissingTypeStubs] from typing_extensions import Self -from core import Menu, MessageDisplay, ResponseType, response_constructor +from core import ExtendedCog, Menu, MessageDisplay, ResponseType, response_constructor from core.checkers import MaxConcurrency from core.errors import BadArgument, MaxConcurrencyReached, NonSpecificError, UnexpectedError from core.i18n import _ @@ -44,9 +43,9 @@ def channel_bucket(inter: discord.Interaction): return inter.channel_id -class Clear(Cog): +class Clear(ExtendedCog): def __init__(self, bot: MyBot): - self.bot: MyBot = bot + super().__init__(bot) self.clear_max_concurrency = MaxConcurrency(1, key=channel_bucket, wait=False) diff --git a/src/cogs/config/__init__.py b/src/cogs/config/__init__.py index 88b776f..8866ef8 100644 --- a/src/cogs/config/__init__.py +++ b/src/cogs/config/__init__.py @@ -6,7 +6,7 @@ from discord import app_commands from discord.app_commands import locale_str as __ -from core import SpecialGroupCog, cog_property +from core import ExtendedGroupCog, cog_property if TYPE_CHECKING: from discord import Interaction @@ -27,7 +27,7 @@ @app_commands.guild_only() @app_commands.default_permissions(administrator=True) class Config( - SpecialGroupCog["MyBot"], + ExtendedGroupCog, group_name=__("config"), group_description=__("Set configurations."), group_extras={"beta": True}, diff --git a/src/cogs/config/config_bot.py b/src/cogs/config/config_bot.py index 96857de..4da37c9 100644 --- a/src/cogs/config/config_bot.py +++ b/src/cogs/config/config_bot.py @@ -3,20 +3,18 @@ import logging from typing import TYPE_CHECKING -from core import ResponseType, SpecialCog, response_constructor +from core import ExtendedCog, ResponseType, response_constructor from core.errors import UnexpectedError from core.i18n import _ if TYPE_CHECKING: from discord import Interaction - from mybot import MyBot - logger = logging.getLogger(__name__) -class ConfigBot(SpecialCog["MyBot"], name="config_bot"): +class ConfigBot(ExtendedCog, name="config_bot"): async def public_translation(self, inter: Interaction, value: bool) -> None: if inter.guild_id is None: raise UnexpectedError() diff --git a/src/cogs/config/config_guild.py b/src/cogs/config/config_guild.py index 377b7bc..42ecc57 100644 --- a/src/cogs/config/config_guild.py +++ b/src/cogs/config/config_guild.py @@ -3,17 +3,15 @@ import logging from typing import TYPE_CHECKING -from core import SpecialCog +from core import ExtendedCog if TYPE_CHECKING: from discord import Interaction - from mybot import MyBot - logger = logging.getLogger(__name__) -class ConfigGuild(SpecialCog["MyBot"], name="config_guild"): +class ConfigGuild(ExtendedCog, name="config_guild"): async def emote(self, inter: Interaction) -> None: raise NotImplementedError() diff --git a/src/cogs/eval.py b/src/cogs/eval.py index 7f96965..f6510b6 100644 --- a/src/cogs/eval.py +++ b/src/cogs/eval.py @@ -13,9 +13,9 @@ import discord from discord import ButtonStyle, Color, Embed, Message, TextStyle, app_commands, ui from discord.ext import commands -from discord.ext.commands import Cog # pyright: ignore[reportMissingTypeStubs] from discord.interactions import Interaction +from core import ExtendedCog from core._config import config from core.checkers.app import is_me from core.checkers.base import is_me_bool @@ -30,10 +30,7 @@ logger = logging.getLogger(__name__) -class Eval(Cog): - def __init__(self, bot: MyBot): - self.bot: MyBot = bot - +class Eval(ExtendedCog): @commands.command(name="+eval") @commands.check(lambda ctx: is_me_bool(ctx.author.id)) async def add_eval(self, ctx: commands.Context[MyBot]) -> None: diff --git a/src/cogs/game/__init__.py b/src/cogs/game/__init__.py index 2e3e2b2..01da427 100644 --- a/src/cogs/game/__init__.py +++ b/src/cogs/game/__init__.py @@ -6,7 +6,7 @@ from discord import app_commands from discord.app_commands import locale_str as __ -from core import SpecialGroupCog, cog_property +from core import ExtendedGroupCog, cog_property from .connect4 import GameConnect4 from .game_2084 import Two048Cog @@ -29,7 +29,7 @@ class Game( - SpecialGroupCog["MyBot"], + ExtendedGroupCog, group_name=__("game"), group_description=__("Play some games."), group_extras={"soon": True}, diff --git a/src/cogs/game/connect4.py b/src/cogs/game/connect4.py index 6a6e50a..18f24dc 100644 --- a/src/cogs/game/connect4.py +++ b/src/cogs/game/connect4.py @@ -3,17 +3,15 @@ import logging from typing import TYPE_CHECKING -from core import SpecialCog +from core import ExtendedCog if TYPE_CHECKING: from discord import Interaction - from mybot import MyBot - logger = logging.getLogger(__name__) -class GameConnect4(SpecialCog["MyBot"], name="game_connect4"): +class GameConnect4(ExtendedCog, name="game_connect4"): async def connect4(self, inter: Interaction) -> None: raise NotImplementedError() diff --git a/src/cogs/game/game_2084.py b/src/cogs/game/game_2084.py index 6057f95..ae0aeb6 100644 --- a/src/cogs/game/game_2084.py +++ b/src/cogs/game/game_2084.py @@ -11,14 +11,12 @@ from discord import ui from two048 import Direction, Tile, Two048 -from core import ResponseType, SpecialCog, response_constructor +from core import ExtendedCog, ResponseType, response_constructor from core.constants import Emojis if TYPE_CHECKING: from discord import Interaction - from mybot import MyBot - logger = logging.getLogger(__name__) @@ -46,7 +44,7 @@ class ResponseT(TypedDict): } -class Two048Cog(SpecialCog["MyBot"], name="game_2048"): +class Two048Cog(ExtendedCog, name="game_2048"): async def two048(self, inter: Interaction) -> None: await inter.response.send_message(**Two048View.init_game(inter.user)) diff --git a/src/cogs/game/minesweeper/__init__.py b/src/cogs/game/minesweeper/__init__.py index bc2ad01..8e51d1e 100644 --- a/src/cogs/game/minesweeper/__init__.py +++ b/src/cogs/game/minesweeper/__init__.py @@ -9,15 +9,13 @@ import discord from discord import ui -from core import ResponseType, SpecialCog, response_constructor +from core import ExtendedCog, ResponseType, response_constructor from .minesweeper_game import Minesweeper, MinesweeperConfig, PlayType if TYPE_CHECKING: from discord import Interaction - from mybot import MyBot - logger = logging.getLogger(__name__) @@ -57,7 +55,7 @@ def get_char(row: int, column: int) -> str: return description -class MinesweeperCog(SpecialCog["MyBot"], name="minesweeper"): +class MinesweeperCog(ExtendedCog, name="minesweeper"): async def minesweeper(self, inter: Interaction) -> None: embed = response_constructor(ResponseType.info, "Minesweeper").embed game = Minesweeper(board_size, 0) # only used for the view, will be regenerated within the first play diff --git a/src/cogs/game/rpc.py b/src/cogs/game/rpc.py index 07133e0..bc3728b 100644 --- a/src/cogs/game/rpc.py +++ b/src/cogs/game/rpc.py @@ -3,17 +3,15 @@ import logging from typing import TYPE_CHECKING -from core import SpecialCog +from core import ExtendedCog if TYPE_CHECKING: from discord import Interaction - from mybot import MyBot - logger = logging.getLogger(__name__) -class GameRPC(SpecialCog["MyBot"], name="game_rpc"): +class GameRPC(ExtendedCog, name="game_rpc"): async def rpc(self, inter: Interaction) -> None: raise NotImplementedError() diff --git a/src/cogs/game/tictactoe.py b/src/cogs/game/tictactoe.py index e2fd159..e80f78e 100644 --- a/src/cogs/game/tictactoe.py +++ b/src/cogs/game/tictactoe.py @@ -3,17 +3,15 @@ import logging from typing import TYPE_CHECKING -from core import SpecialCog +from core import ExtendedCog if TYPE_CHECKING: from discord import Interaction - from mybot import MyBot - logger = logging.getLogger(__name__) -class GameTictactoe(SpecialCog["MyBot"], name="game_tictactoe"): +class GameTictactoe(ExtendedCog, name="game_tictactoe"): async def tictactoe(self, inter: Interaction) -> None: raise NotImplementedError() diff --git a/src/cogs/help.py b/src/cogs/help.py index 66c1fce..1118256 100644 --- a/src/cogs/help.py +++ b/src/cogs/help.py @@ -7,11 +7,10 @@ import discord from discord import app_commands, ui from discord.app_commands import Choice, locale_str as __ -from discord.ext.commands import Cog # pyright: ignore[reportMissingTypeStubs] from discord.utils import get from commands_exporter import ContextCommand, FeatureType, Misc, MiscCommandsType, SlashCommand -from core import ResponseType, response_constructor +from core import ExtendedCog, ResponseType, response_constructor from core.constants import Emojis from core.i18n import _ from core.utils import splitter @@ -33,10 +32,7 @@ } -class Help(Cog): - def __init__(self, bot: MyBot) -> None: - self.bot = bot - +class Help(ExtendedCog): @app_commands.command(name=__("help"), description=__("Get help about the bot."), extras={"beta": True}) @app_commands.rename(feature_identifier=__("feature")) async def _help(self, inter: Interaction, feature_identifier: str | None = None): diff --git a/src/cogs/ping.py b/src/cogs/ping.py index 02a5338..d6baafe 100644 --- a/src/cogs/ping.py +++ b/src/cogs/ping.py @@ -9,7 +9,8 @@ from discord import app_commands from discord.app_commands import locale_str as __ -from discord.ext.commands import Cog # pyright: ignore[reportMissingTypeStubs] + +from core import ExtendedCog if TYPE_CHECKING: from discord import Interaction @@ -20,10 +21,7 @@ logger = logging.getLogger(__name__) -class Ping(Cog): - def __init__(self, bot: MyBot): - self.bot: MyBot = bot - +class Ping(ExtendedCog): @app_commands.command( name=__("ping"), description=__("Get the bot latency."), diff --git a/src/cogs/poll/__init__.py b/src/cogs/poll/__init__.py index b55c6fd..a6361db 100644 --- a/src/cogs/poll/__init__.py +++ b/src/cogs/poll/__init__.py @@ -12,7 +12,7 @@ from discord.app_commands import locale_str as __ from sqlalchemy.orm import selectinload -from core import SpecialGroupCog, db +from core import ExtendedGroupCog, db from core.checkers.app import bot_required_permissions from core.errors import NonSpecificError from core.i18n import _ @@ -32,7 +32,7 @@ @app_commands.default_permissions(administrator=True) @app_commands.guild_only() -class PollCog(SpecialGroupCog["MyBot"], group_name=__("poll"), group_description=__("Create a new poll")): +class PollCog(ExtendedGroupCog, group_name=__("poll"), group_description=__("Create a new poll")): def __init__(self, bot: MyBot): super().__init__(bot) diff --git a/src/cogs/restore.py b/src/cogs/restore.py index a3204c8..2e3ba14 100644 --- a/src/cogs/restore.py +++ b/src/cogs/restore.py @@ -3,7 +3,7 @@ import logging from typing import TYPE_CHECKING -from core import SpecialCog, misc_command +from core import ExtendedCog, misc_command from core.checkers.misc import bot_required_permissions, is_activated, is_user_authorized, misc_check if TYPE_CHECKING: @@ -15,7 +15,7 @@ logger = logging.getLogger(__name__) -class Restore(SpecialCog["MyBot"]): +class Restore(ExtendedCog): @misc_command("restore", description="Send a message back in chat if a link is send.", extras={"soon": True}) @bot_required_permissions(manage_webhooks=True) @misc_check(is_activated) diff --git a/src/cogs/stats.py b/src/cogs/stats.py index 18333ce..4788486 100644 --- a/src/cogs/stats.py +++ b/src/cogs/stats.py @@ -9,6 +9,8 @@ from discord.ext.commands import Cog # pyright: ignore[reportMissingTypeStubs] from discord.utils import get +from core import ExtendedCog + if TYPE_CHECKING: from discord import Interaction @@ -18,10 +20,9 @@ logger = logging.getLogger(__name__) -class Stats(Cog): +class Stats(ExtendedCog): def __init__(self, bot: MyBot): - self.bot: MyBot = bot - + super().__init__(bot) self.temp_store: dict[int, int] = {} @Cog.listener() diff --git a/src/cogs/translate/__init__.py b/src/cogs/translate/__init__.py index ed300e9..c70d201 100644 --- a/src/cogs/translate/__init__.py +++ b/src/cogs/translate/__init__.py @@ -11,7 +11,7 @@ from discord import Embed, Message, app_commands, ui from discord.app_commands import locale_str as __ -from core import ResponseType, SpecialCog, TemporaryCache, misc_command, response_constructor +from core import ExtendedCog, ResponseType, TemporaryCache, misc_command, response_constructor from core.checkers.misc import bot_required_permissions, is_activated, is_user_authorized, misc_check from core.errors import BadArgument, NonSpecificError from core.i18n import _ @@ -149,7 +149,7 @@ def add_usage(self, id: int): self.cache[key].append(id) -class Translate(SpecialCog["MyBot"]): +class Translate(ExtendedCog): def __init__(self, bot: MyBot): super().__init__(bot) self.cache: TemporaryCache[str, TranslationTask] = TemporaryCache(expire=timedelta(days=1), max_size=10_000) diff --git a/src/cogs/translate/adapters/libretranslate.py b/src/cogs/translate/adapters/libretranslate.py index 7b1b50a..9e63cc8 100644 --- a/src/cogs/translate/adapters/libretranslate.py +++ b/src/cogs/translate/adapters/libretranslate.py @@ -5,7 +5,7 @@ from lingua import Language as LinguaLanguage, LanguageDetectorBuilder -from core.modules.libre_translate import Language as LibreLanguage, LibreTranslate +from libraries.libre_translate import Language as LibreLanguage, LibreTranslate from ..languages import Language, Languages, LanguagesEnum from ..translator_abc import TranslatorAdapter diff --git a/src/cogs/translate/adapters/microsoft.py b/src/cogs/translate/adapters/microsoft.py index ef56510..10bc3bd 100644 --- a/src/cogs/translate/adapters/microsoft.py +++ b/src/cogs/translate/adapters/microsoft.py @@ -3,7 +3,7 @@ from lingua import Language as LinguaLanguage, LanguageDetectorBuilder from core import config -from core.modules.microsoft_translation import MicrosoftTranslator +from libraries.microsoft_translation import MicrosoftTranslator from ..languages import Language, Languages, LanguagesEnum from ..translator_abc import TranslatorAdapter diff --git a/src/commands_exporter.py b/src/commands_exporter.py index fa7582e..8ed29c7 100644 --- a/src/commands_exporter.py +++ b/src/commands_exporter.py @@ -11,7 +11,7 @@ from typing_extensions import NotRequired from core._config import define_config -from core.misc_command import MiscCommand, MiscCommandsType +from core.extended_commands import MiscCommand, MiscCommandsType if TYPE_CHECKING: from mybot import MyBot diff --git a/src/core/__init__.py b/src/core/__init__.py index 3ec5ab1..4667755 100644 --- a/src/core/__init__.py +++ b/src/core/__init__.py @@ -1,13 +1,16 @@ from ._config import config as config from .caches import SizedMapping as SizedMapping, SizedSequence as SizedSequence, TemporaryCache as TemporaryCache -from .cog_property import cog_property as cog_property from .constants import Emojis as Emojis -from .misc_command import misc_command as misc_command +from .extended_commands import ( + ExtendedCog as ExtendedCog, + ExtendedGroupCog as ExtendedGroupCog, + cog_property as cog_property, + misc_command as misc_command, +) from .response import ( MessageDisplay as MessageDisplay, ResponseType as ResponseType, UneditedMessageDisplay as UneditedMessageDisplay, response_constructor as response_constructor, ) -from .special_cog import SpecialCog as SpecialCog, SpecialGroupCog as SpecialGroupCog from .view_menus import Menu as Menu diff --git a/src/core/_types.py b/src/core/_types.py index d522746..a63dee8 100644 --- a/src/core/_types.py +++ b/src/core/_types.py @@ -6,8 +6,7 @@ from discord.ext import commands if TYPE_CHECKING: - from .misc_command import MiscCommandContextFilled, MiscCommandContextRaw - from .special_cog import SpecialCog + from .extended_commands import ExtendedCog, MiscCommandContextFilled, MiscCommandContextRaw UnresolvedContext: TypeAlias = Union["MiscCommandContextRaw", "MiscCommandContextFilled", Message] UnresolvedContextT = TypeVar("UnresolvedContextT", bound=UnresolvedContext) @@ -15,7 +14,7 @@ P = ParamSpec("P") T = TypeVar("T") -CogT = TypeVar("CogT", bound="SpecialCog[Any]") +CogT = TypeVar("CogT", bound="ExtendedCog") BotT = TypeVar("BotT", bound="commands.Bot | commands.AutoShardedBot") diff --git a/src/core/checkers/app.py b/src/core/checkers/app.py index 7d3fac6..e5aa26e 100644 --- a/src/core/checkers/app.py +++ b/src/core/checkers/app.py @@ -4,7 +4,7 @@ from discord.app_commands import check -from ..misc_command import misc_check as misc_check +from ..extended_commands import misc_check as misc_check from ..utils import CommandType from .base import T, bot_required_permissions_base, is_me_bool diff --git a/src/core/checkers/base.py b/src/core/checkers/base.py index 98e4542..fe0f52c 100644 --- a/src/core/checkers/base.py +++ b/src/core/checkers/base.py @@ -8,7 +8,7 @@ from .._config import config from ..errors import BotMissingPermissions, NotAllowedUser -from ..misc_command import MiscCommandContext, misc_check as misc_check +from ..extended_commands import MiscCommandContext, misc_check as misc_check from ..utils import CommandType T = TypeVar("T") diff --git a/src/core/checkers/max_concurrency.py b/src/core/checkers/max_concurrency.py index 49fd971..ee2766e 100644 --- a/src/core/checkers/max_concurrency.py +++ b/src/core/checkers/max_concurrency.py @@ -8,7 +8,7 @@ from typing_extensions import Self from ..errors import MaxConcurrencyReached -from ..misc_command import misc_check as misc_check +from ..extended_commands import misc_check as misc_check T = TypeVar("T") diff --git a/src/core/checkers/misc.py b/src/core/checkers/misc.py index 1abd43e..d3882f7 100644 --- a/src/core/checkers/misc.py +++ b/src/core/checkers/misc.py @@ -2,7 +2,7 @@ from typing import TYPE_CHECKING, Callable -from ..misc_command import MiscCommandContext, misc_check as misc_check +from ..extended_commands import MiscCommandContext, misc_check as misc_check from ..utils import CommandType from .base import T, bot_required_permissions_base diff --git a/src/core/cog_property.py b/src/core/cog_property.py deleted file mode 100644 index 34aaa64..0000000 --- a/src/core/cog_property.py +++ /dev/null @@ -1,30 +0,0 @@ -from typing import TYPE_CHECKING, Any, Callable, TypeVar - -from core.errors import NonSpecificError - -if TYPE_CHECKING: - from discord.ext.commands import Cog # pyright: ignore[reportMissingTypeStubs] - - -C = TypeVar("C", bound="Cog") - - -def cog_property(cog_name: str): - """Transform a method into a property that return the cog with the name passed in argument. - Type is not truly correct because we force it to be a Cog value while it is a property that return a Cog. - - Args: - cog_name (str): the cog name to return - """ - - def inner(_: Callable[..., C]) -> C: - @property - def cog_getter(self: Any) -> C: # self is a cog within the .bot attribute (because every Cog should have it) - cog: C | None = self.bot.get_cog(cog_name) - if cog is None: - raise NonSpecificError(f"Cog named {cog_name} is not loaded.") - return cog - - return cog_getter # type: ignore - - return inner diff --git a/src/core/custom_command_tree.py b/src/core/custom_command_tree.py index 2e28d21..1e443af 100644 --- a/src/core/custom_command_tree.py +++ b/src/core/custom_command_tree.py @@ -6,7 +6,7 @@ import discord from discord.app_commands import CommandTree -from core.errors import BotUserNotPresent +from .errors import BotUserNotPresent if TYPE_CHECKING: from discord import Interaction diff --git a/src/core/error_handler.py b/src/core/error_handler.py index 7e6a6e0..e7932b2 100644 --- a/src/core/error_handler.py +++ b/src/core/error_handler.py @@ -18,12 +18,12 @@ MiscNoPrivateMessage, NonSpecificError, ) +from .extended_commands import MiscCommandContext from .i18n import i18n -from .misc_command import MiscCommandContext if TYPE_CHECKING: from core.errors import MiscCommandError - from core.misc_command import MiscCommandContext + from core.extended_commands import MiscCommandContext from mybot import MyBot logger = logging.getLogger(__name__) diff --git a/src/core/misc_command.py b/src/core/extended_commands.py similarity index 77% rename from src/core/misc_command.py rename to src/core/extended_commands.py index 8495ae1..488fd16 100644 --- a/src/core/misc_command.py +++ b/src/core/extended_commands.py @@ -6,28 +6,33 @@ TYPE_CHECKING, Any, Callable, + ClassVar, Concatenate, Generic, Literal, ParamSpec, Protocol, Self, + Sequence, + TypeVar, cast, runtime_checkable, ) import discord from discord import ClientUser, Member, Permissions, User -from discord.ext.commands import Cog # pyright: ignore[reportMissingTypeStubs] +from discord.ext import commands from discord.utils import maybe_coroutine from typing_extensions import TypeVar from ._types import BotT, CogT -from .errors import MiscCheckFailure, MiscCommandError, MiscNoPrivateMessage +from .errors import MiscCheckFailure, MiscCommandError, MiscNoPrivateMessage, UnexpectedError if TYPE_CHECKING: - from discord.abc import MessageableChannel - from discord.ext.commands.bot import AutoShardedBot, Bot # pyright: ignore[reportMissingTypeStubs] + from discord.abc import MessageableChannel, Snowflake + from discord.ext.commands.bot import AutoShardedBot, Bot, BotBase # pyright: ignore[reportMissingTypeStubs] + + from mybot import MyBot from ._types import CoroT, UnresolvedContext, UnresolvedContextT @@ -36,6 +41,9 @@ P = ParamSpec("P") T = TypeVar("T") +C = TypeVar("C", bound="commands.Cog") +_BotType = TypeVar("_BotType", bound="Bot | AutoShardedBot") + LiteralNames = Literal["raw_reaction_add", "message"] @@ -51,6 +59,43 @@ class MiscCommandsType(Enum): } +class ExtendedCog(commands.Cog): + __cog_misc_commands__: list[MiscCommand[Any, ..., Any]] + bot: MyBot + + def __new__(cls, *args: Any, **kwargs: Any) -> Self: + cls = super().__new__(cls, *args, **kwargs) + + cls.__cog_misc_commands__ = [] + for _, listener in cls.__cog_listeners__: + misc_command = getattr(getattr(cls, listener), "__listener_as_command__", None) + if isinstance(misc_command, MiscCommand): + cls.__cog_misc_commands__.append(misc_command) # pyright: ignore [reportUnknownArgumentType] + + return cls + + def __init__(self, bot: MyBot) -> None: + self.bot = bot + + def get_misc_commands(self) -> list[MiscCommand[Any, ..., Any]]: + """Return all the misc commands in this cog.""" + return list(self.__cog_misc_commands__) + + async def _inject(self, bot: BotBase, override: bool, guild: Snowflake | None, guilds: Sequence[Snowflake]) -> Self: + await super()._inject(bot, override, guild, guilds) + + # bind the bot to the misc commands + # used to dispatch error for error handling + for misc_command in self.get_misc_commands(): + misc_command.bot = bot # type: ignore + + return self + + +class ExtendedGroupCog(ExtendedCog): + __cog_is_app_commands_group__: ClassVar[bool] = True + + class MiscCommand(Generic[CogT, P, T]): bot: Bot | AutoShardedBot @@ -152,7 +197,7 @@ async def inner(cog: CogT, context: UnresolvedContext, *args: P.args, **kwargs: setattr(inner, "__listener_as_command__", misc_command) - add_listener = Cog.listener(true_listener_name) + add_listener = commands.Cog.listener(true_listener_name) add_listener(inner) return inner @@ -258,3 +303,24 @@ def decorator(func: T) -> T: return func return decorator + + +def cog_property(cog_name: str): + """Transform a method into a property that return the cog with the name passed in argument. + Type is not truly correct because we force it to be a Cog value while it is a property that return a Cog. + + Args: + cog_name: the cog name to return + """ + + def inner(_: Callable[..., C]) -> C: + @property + def cog_getter(self: Any) -> C: # self is a cog within the .bot attribute (because every Cog should have it) + cog: C | None = self.bot.get_cog(cog_name) + if cog is None: + raise UnexpectedError(f"Cog named {cog_name} is not loaded.") + return cog + + return cog_getter # type: ignore + + return inner diff --git a/src/core/special_cog.py b/src/core/special_cog.py deleted file mode 100644 index fd2f23f..0000000 --- a/src/core/special_cog.py +++ /dev/null @@ -1,50 +0,0 @@ -from __future__ import annotations - -from typing import TYPE_CHECKING, Any, ClassVar, Generic, Self, Sequence, TypeVar - -from discord.ext import commands - -from .misc_command import MiscCommand - -if TYPE_CHECKING: - from discord.abc import Snowflake - from discord.ext.commands.bot import AutoShardedBot, Bot, BotBase # pyright: ignore[reportMissingTypeStubs] - -_BotType = TypeVar("_BotType", bound="Bot | AutoShardedBot") - - -class SpecialCog(commands.Cog, Generic[_BotType]): - __cog_misc_commands__: list[MiscCommand[Any, ..., Any]] - bot: _BotType - - def __new__(cls, *args: Any, **kwargs: Any) -> Self: - cls = super().__new__(cls, *args, **kwargs) - - cls.__cog_misc_commands__ = [] - for _, listener in cls.__cog_listeners__: - misc_command = getattr(getattr(cls, listener), "__listener_as_command__", None) - if isinstance(misc_command, MiscCommand): - cls.__cog_misc_commands__.append(misc_command) # pyright: ignore [reportUnknownArgumentType] - - return cls - - def __init__(self, bot: _BotType) -> None: - self.bot = bot - - def get_misc_commands(self) -> list[MiscCommand[Any, ..., Any]]: - """Return all the misc commands in this cog.""" - return list(self.__cog_misc_commands__) - - async def _inject(self, bot: BotBase, override: bool, guild: Snowflake | None, guilds: Sequence[Snowflake]) -> Self: - await super()._inject(bot, override, guild, guilds) - - # bind the bot to the misc commands - # used to dispatch error for error handling - for misc_command in self.get_misc_commands(): - misc_command.bot = bot # type: ignore - - return self - - -class SpecialGroupCog(SpecialCog[_BotType]): - __cog_is_app_commands_group__: ClassVar[bool] = True diff --git a/src/core/modules/libre_translate/__init__.py b/src/libraries/libre_translate/__init__.py similarity index 100% rename from src/core/modules/libre_translate/__init__.py rename to src/libraries/libre_translate/__init__.py diff --git a/src/core/modules/libre_translate/_types.py b/src/libraries/libre_translate/_types.py similarity index 100% rename from src/core/modules/libre_translate/_types.py rename to src/libraries/libre_translate/_types.py diff --git a/src/core/modules/libre_translate/languages.py b/src/libraries/libre_translate/languages.py similarity index 100% rename from src/core/modules/libre_translate/languages.py rename to src/libraries/libre_translate/languages.py diff --git a/src/core/modules/libre_translate/main.py b/src/libraries/libre_translate/main.py similarity index 100% rename from src/core/modules/libre_translate/main.py rename to src/libraries/libre_translate/main.py diff --git a/src/core/modules/microsoft_translation/__init__.py b/src/libraries/microsoft_translation/__init__.py similarity index 100% rename from src/core/modules/microsoft_translation/__init__.py rename to src/libraries/microsoft_translation/__init__.py diff --git a/src/core/modules/microsoft_translation/__main__.py b/src/libraries/microsoft_translation/__main__.py similarity index 100% rename from src/core/modules/microsoft_translation/__main__.py rename to src/libraries/microsoft_translation/__main__.py diff --git a/src/core/modules/microsoft_translation/translator.py b/src/libraries/microsoft_translation/translator.py similarity index 100% rename from src/core/modules/microsoft_translation/translator.py rename to src/libraries/microsoft_translation/translator.py diff --git a/src/mybot.py b/src/mybot.py index 6463e63..5c342db 100644 --- a/src/mybot.py +++ b/src/mybot.py @@ -13,12 +13,11 @@ from sqlalchemy.ext.asyncio import async_sessionmaker, create_async_engine from commands_exporter import Feature, extract_features -from core import ResponseType, TemporaryCache, config, db, response_constructor +from core import ExtendedCog, ResponseType, TemporaryCache, config, db, response_constructor from core.custom_command_tree import CustomCommandTree from core.error_handler import ErrorHandler +from core.extended_commands import MiscCommandContext from core.i18n import Translator -from core.misc_command import MiscCommandContext -from core.special_cog import SpecialCog if TYPE_CHECKING: from discord import Guild, Thread, User @@ -28,7 +27,7 @@ from sqlalchemy.ext.asyncio import AsyncEngine, AsyncSession from core.errors import MiscCommandError - from core.misc_command import MiscCommand + from core.extended_commands import MiscCommand logger = logging.getLogger(__name__) @@ -354,7 +353,7 @@ def misc_commands(self): """ misc_commands: list[MiscCommand[Any, ..., Any]] = [] for cog in self.cogs.values(): - if isinstance(cog, SpecialCog): + if isinstance(cog, ExtendedCog): for misc_command in cog.get_misc_commands(): misc_commands.append(misc_command) return misc_commands