From 1892385c6302a0f871fa13ec464d41cf3f5b9219 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 5 Sep 2023 17:02:24 +0000 Subject: [PATCH 1/9] chore(deps-dev): bump @typescript-eslint/parser from 6.5.0 to 6.6.0 Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 6.5.0 to 6.6.0. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.6.0/packages/parser) --- updated-dependencies: - dependency-name: "@typescript-eslint/parser" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package.json | 2 +- pnpm-lock.yaml | 64 +++++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 54 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index ba9b3c4..638b20d 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "@types/inquirer": "^9.0.3", "@types/node": "20.5.9", "@typescript-eslint/eslint-plugin": "^6.5.0", - "@typescript-eslint/parser": "^6.5.0", + "@typescript-eslint/parser": "^6.6.0", "concurrently": "^8.2.1", "dotenv": "^16.3.1", "eslint": "^8.48.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0a59fd7..8aba442 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -36,10 +36,10 @@ devDependencies: version: 20.5.9 '@typescript-eslint/eslint-plugin': specifier: ^6.5.0 - version: 6.5.0(@typescript-eslint/parser@6.5.0)(eslint@8.48.0)(typescript@5.2.2) + version: 6.5.0(@typescript-eslint/parser@6.6.0)(eslint@8.48.0)(typescript@5.2.2) '@typescript-eslint/parser': - specifier: ^6.5.0 - version: 6.5.0(eslint@8.48.0)(typescript@5.2.2) + specifier: ^6.6.0 + version: 6.6.0(eslint@8.48.0)(typescript@5.2.2) concurrently: specifier: ^8.2.1 version: 8.2.1 @@ -313,7 +313,7 @@ packages: '@types/node': 20.5.9 dev: false - /@typescript-eslint/eslint-plugin@6.5.0(@typescript-eslint/parser@6.5.0)(eslint@8.48.0)(typescript@5.2.2): + /@typescript-eslint/eslint-plugin@6.5.0(@typescript-eslint/parser@6.6.0)(eslint@8.48.0)(typescript@5.2.2): resolution: {integrity: sha512-2pktILyjvMaScU6iK3925uvGU87E+N9rh372uGZgiMYwafaw9SXq86U04XPq3UH6tzRvNgBsub6x2DacHc33lw==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: @@ -325,7 +325,7 @@ packages: optional: true dependencies: '@eslint-community/regexpp': 4.6.2 - '@typescript-eslint/parser': 6.5.0(eslint@8.48.0)(typescript@5.2.2) + '@typescript-eslint/parser': 6.6.0(eslint@8.48.0)(typescript@5.2.2) '@typescript-eslint/scope-manager': 6.5.0 '@typescript-eslint/type-utils': 6.5.0(eslint@8.48.0)(typescript@5.2.2) '@typescript-eslint/utils': 6.5.0(eslint@8.48.0)(typescript@5.2.2) @@ -342,8 +342,8 @@ packages: - supports-color dev: true - /@typescript-eslint/parser@6.5.0(eslint@8.48.0)(typescript@5.2.2): - resolution: {integrity: sha512-LMAVtR5GN8nY0G0BadkG0XIe4AcNMeyEy3DyhKGAh9k4pLSMBO7rF29JvDBpZGCmp5Pgz5RLHP6eCpSYZJQDuQ==} + /@typescript-eslint/parser@6.6.0(eslint@8.48.0)(typescript@5.2.2): + resolution: {integrity: sha512-setq5aJgUwtzGrhW177/i+DMLqBaJbdwGj2CPIVFFLE0NCliy5ujIdLHd2D1ysmlmsjdL2GWW+hR85neEfc12w==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: eslint: ^7.0.0 || ^8.0.0 @@ -352,10 +352,10 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/scope-manager': 6.5.0 - '@typescript-eslint/types': 6.5.0 - '@typescript-eslint/typescript-estree': 6.5.0(typescript@5.2.2) - '@typescript-eslint/visitor-keys': 6.5.0 + '@typescript-eslint/scope-manager': 6.6.0 + '@typescript-eslint/types': 6.6.0 + '@typescript-eslint/typescript-estree': 6.6.0(typescript@5.2.2) + '@typescript-eslint/visitor-keys': 6.6.0 debug: 4.3.4 eslint: 8.48.0 typescript: 5.2.2 @@ -371,6 +371,14 @@ packages: '@typescript-eslint/visitor-keys': 6.5.0 dev: true + /@typescript-eslint/scope-manager@6.6.0: + resolution: {integrity: sha512-pT08u5W/GT4KjPUmEtc2kSYvrH8x89cVzkA0Sy2aaOUIw6YxOIjA8ilwLr/1fLjOedX1QAuBpG9XggWqIIfERw==} + engines: {node: ^16.0.0 || >=18.0.0} + dependencies: + '@typescript-eslint/types': 6.6.0 + '@typescript-eslint/visitor-keys': 6.6.0 + dev: true + /@typescript-eslint/type-utils@6.5.0(eslint@8.48.0)(typescript@5.2.2): resolution: {integrity: sha512-f7OcZOkRivtujIBQ4yrJNIuwyCQO1OjocVqntl9dgSIZAdKqicj3xFDqDOzHDlGCZX990LqhLQXWRnQvsapq8A==} engines: {node: ^16.0.0 || >=18.0.0} @@ -396,6 +404,11 @@ packages: engines: {node: ^16.0.0 || >=18.0.0} dev: true + /@typescript-eslint/types@6.6.0: + resolution: {integrity: sha512-CB6QpJQ6BAHlJXdwUmiaXDBmTqIE2bzGTDLADgvqtHWuhfNP3rAOK7kAgRMAET5rDRr9Utt+qAzRBdu3AhR3sg==} + engines: {node: ^16.0.0 || >=18.0.0} + dev: true + /@typescript-eslint/typescript-estree@6.5.0(typescript@5.2.2): resolution: {integrity: sha512-q0rGwSe9e5Kk/XzliB9h2LBc9tmXX25G0833r7kffbl5437FPWb2tbpIV9wAATebC/018pGa9fwPDuvGN+LxWQ==} engines: {node: ^16.0.0 || >=18.0.0} @@ -417,6 +430,27 @@ packages: - supports-color dev: true + /@typescript-eslint/typescript-estree@6.6.0(typescript@5.2.2): + resolution: {integrity: sha512-hMcTQ6Al8MP2E6JKBAaSxSVw5bDhdmbCEhGW/V8QXkb9oNsFkA4SBuOMYVPxD3jbtQ4R/vSODBsr76R6fP3tbA==} + engines: {node: ^16.0.0 || >=18.0.0} + peerDependencies: + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@typescript-eslint/types': 6.6.0 + '@typescript-eslint/visitor-keys': 6.6.0 + debug: 4.3.4 + globby: 11.1.0 + is-glob: 4.0.3 + semver: 7.5.4 + ts-api-utils: 1.0.2(typescript@5.2.2) + typescript: 5.2.2 + transitivePeerDependencies: + - supports-color + dev: true + /@typescript-eslint/utils@6.5.0(eslint@8.48.0)(typescript@5.2.2): resolution: {integrity: sha512-9nqtjkNykFzeVtt9Pj6lyR9WEdd8npPhhIPM992FWVkZuS6tmxHfGVnlUcjpUP2hv8r4w35nT33mlxd+Be1ACQ==} engines: {node: ^16.0.0 || >=18.0.0} @@ -444,6 +478,14 @@ packages: eslint-visitor-keys: 3.4.3 dev: true + /@typescript-eslint/visitor-keys@6.6.0: + resolution: {integrity: sha512-L61uJT26cMOfFQ+lMZKoJNbAEckLe539VhTxiGHrWl5XSKQgA0RTBZJW2HFPy5T0ZvPVSD93QsrTKDkfNwJGyQ==} + engines: {node: ^16.0.0 || >=18.0.0} + dependencies: + '@typescript-eslint/types': 6.6.0 + eslint-visitor-keys: 3.4.3 + dev: true + /@vladfrangu/async_event_emitter@2.2.2: resolution: {integrity: sha512-HIzRG7sy88UZjBJamssEczH5q7t5+axva19UbZLO6u0ySbYPrwzWiXBcC0WuHyhKKoeCyneH+FvYzKQq/zTtkQ==} engines: {node: '>=v14.0.0', npm: '>=7.0.0'} From 8dce255f9ee58ea25bb42679b717915c14a458e8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 5 Sep 2023 20:18:48 +0000 Subject: [PATCH 2/9] chore(deps-dev): bump @typescript-eslint/eslint-plugin Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 6.5.0 to 6.6.0. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.6.0/packages/eslint-plugin) --- updated-dependencies: - dependency-name: "@typescript-eslint/eslint-plugin" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package.json | 2 +- pnpm-lock.yaml | 76 +++++++++++--------------------------------------- 2 files changed, 18 insertions(+), 60 deletions(-) diff --git a/package.json b/package.json index 638b20d..ebdfe7b 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "devDependencies": { "@types/inquirer": "^9.0.3", "@types/node": "20.5.9", - "@typescript-eslint/eslint-plugin": "^6.5.0", + "@typescript-eslint/eslint-plugin": "^6.6.0", "@typescript-eslint/parser": "^6.6.0", "concurrently": "^8.2.1", "dotenv": "^16.3.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8aba442..be6a780 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -35,8 +35,8 @@ devDependencies: specifier: 20.5.9 version: 20.5.9 '@typescript-eslint/eslint-plugin': - specifier: ^6.5.0 - version: 6.5.0(@typescript-eslint/parser@6.6.0)(eslint@8.48.0)(typescript@5.2.2) + specifier: ^6.6.0 + version: 6.6.0(@typescript-eslint/parser@6.6.0)(eslint@8.48.0)(typescript@5.2.2) '@typescript-eslint/parser': specifier: ^6.6.0 version: 6.6.0(eslint@8.48.0)(typescript@5.2.2) @@ -313,8 +313,8 @@ packages: '@types/node': 20.5.9 dev: false - /@typescript-eslint/eslint-plugin@6.5.0(@typescript-eslint/parser@6.6.0)(eslint@8.48.0)(typescript@5.2.2): - resolution: {integrity: sha512-2pktILyjvMaScU6iK3925uvGU87E+N9rh372uGZgiMYwafaw9SXq86U04XPq3UH6tzRvNgBsub6x2DacHc33lw==} + /@typescript-eslint/eslint-plugin@6.6.0(@typescript-eslint/parser@6.6.0)(eslint@8.48.0)(typescript@5.2.2): + resolution: {integrity: sha512-CW9YDGTQnNYMIo5lMeuiIG08p4E0cXrXTbcZ2saT/ETE7dWUrNxlijsQeU04qAAKkILiLzdQz+cGFxCJjaZUmA==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: '@typescript-eslint/parser': ^6.0.0 || ^6.0.0-alpha @@ -326,10 +326,10 @@ packages: dependencies: '@eslint-community/regexpp': 4.6.2 '@typescript-eslint/parser': 6.6.0(eslint@8.48.0)(typescript@5.2.2) - '@typescript-eslint/scope-manager': 6.5.0 - '@typescript-eslint/type-utils': 6.5.0(eslint@8.48.0)(typescript@5.2.2) - '@typescript-eslint/utils': 6.5.0(eslint@8.48.0)(typescript@5.2.2) - '@typescript-eslint/visitor-keys': 6.5.0 + '@typescript-eslint/scope-manager': 6.6.0 + '@typescript-eslint/type-utils': 6.6.0(eslint@8.48.0)(typescript@5.2.2) + '@typescript-eslint/utils': 6.6.0(eslint@8.48.0)(typescript@5.2.2) + '@typescript-eslint/visitor-keys': 6.6.0 debug: 4.3.4 eslint: 8.48.0 graphemer: 1.4.0 @@ -363,14 +363,6 @@ packages: - supports-color dev: true - /@typescript-eslint/scope-manager@6.5.0: - resolution: {integrity: sha512-A8hZ7OlxURricpycp5kdPTH3XnjG85UpJS6Fn4VzeoH4T388gQJ/PGP4ole5NfKt4WDVhmLaQ/dBLNDC4Xl/Kw==} - engines: {node: ^16.0.0 || >=18.0.0} - dependencies: - '@typescript-eslint/types': 6.5.0 - '@typescript-eslint/visitor-keys': 6.5.0 - dev: true - /@typescript-eslint/scope-manager@6.6.0: resolution: {integrity: sha512-pT08u5W/GT4KjPUmEtc2kSYvrH8x89cVzkA0Sy2aaOUIw6YxOIjA8ilwLr/1fLjOedX1QAuBpG9XggWqIIfERw==} engines: {node: ^16.0.0 || >=18.0.0} @@ -379,8 +371,8 @@ packages: '@typescript-eslint/visitor-keys': 6.6.0 dev: true - /@typescript-eslint/type-utils@6.5.0(eslint@8.48.0)(typescript@5.2.2): - resolution: {integrity: sha512-f7OcZOkRivtujIBQ4yrJNIuwyCQO1OjocVqntl9dgSIZAdKqicj3xFDqDOzHDlGCZX990LqhLQXWRnQvsapq8A==} + /@typescript-eslint/type-utils@6.6.0(eslint@8.48.0)(typescript@5.2.2): + resolution: {integrity: sha512-8m16fwAcEnQc69IpeDyokNO+D5spo0w1jepWWY2Q6y5ZKNuj5EhVQXjtVAeDDqvW6Yg7dhclbsz6rTtOvcwpHg==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: eslint: ^7.0.0 || ^8.0.0 @@ -389,8 +381,8 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/typescript-estree': 6.5.0(typescript@5.2.2) - '@typescript-eslint/utils': 6.5.0(eslint@8.48.0)(typescript@5.2.2) + '@typescript-eslint/typescript-estree': 6.6.0(typescript@5.2.2) + '@typescript-eslint/utils': 6.6.0(eslint@8.48.0)(typescript@5.2.2) debug: 4.3.4 eslint: 8.48.0 ts-api-utils: 1.0.2(typescript@5.2.2) @@ -399,37 +391,11 @@ packages: - supports-color dev: true - /@typescript-eslint/types@6.5.0: - resolution: {integrity: sha512-eqLLOEF5/lU8jW3Bw+8auf4lZSbbljHR2saKnYqON12G/WsJrGeeDHWuQePoEf9ro22+JkbPfWQwKEC5WwLQ3w==} - engines: {node: ^16.0.0 || >=18.0.0} - dev: true - /@typescript-eslint/types@6.6.0: resolution: {integrity: sha512-CB6QpJQ6BAHlJXdwUmiaXDBmTqIE2bzGTDLADgvqtHWuhfNP3rAOK7kAgRMAET5rDRr9Utt+qAzRBdu3AhR3sg==} engines: {node: ^16.0.0 || >=18.0.0} dev: true - /@typescript-eslint/typescript-estree@6.5.0(typescript@5.2.2): - resolution: {integrity: sha512-q0rGwSe9e5Kk/XzliB9h2LBc9tmXX25G0833r7kffbl5437FPWb2tbpIV9wAATebC/018pGa9fwPDuvGN+LxWQ==} - engines: {node: ^16.0.0 || >=18.0.0} - peerDependencies: - typescript: '*' - peerDependenciesMeta: - typescript: - optional: true - dependencies: - '@typescript-eslint/types': 6.5.0 - '@typescript-eslint/visitor-keys': 6.5.0 - debug: 4.3.4 - globby: 11.1.0 - is-glob: 4.0.3 - semver: 7.5.4 - ts-api-utils: 1.0.2(typescript@5.2.2) - typescript: 5.2.2 - transitivePeerDependencies: - - supports-color - dev: true - /@typescript-eslint/typescript-estree@6.6.0(typescript@5.2.2): resolution: {integrity: sha512-hMcTQ6Al8MP2E6JKBAaSxSVw5bDhdmbCEhGW/V8QXkb9oNsFkA4SBuOMYVPxD3jbtQ4R/vSODBsr76R6fP3tbA==} engines: {node: ^16.0.0 || >=18.0.0} @@ -451,8 +417,8 @@ packages: - supports-color dev: true - /@typescript-eslint/utils@6.5.0(eslint@8.48.0)(typescript@5.2.2): - resolution: {integrity: sha512-9nqtjkNykFzeVtt9Pj6lyR9WEdd8npPhhIPM992FWVkZuS6tmxHfGVnlUcjpUP2hv8r4w35nT33mlxd+Be1ACQ==} + /@typescript-eslint/utils@6.6.0(eslint@8.48.0)(typescript@5.2.2): + resolution: {integrity: sha512-mPHFoNa2bPIWWglWYdR0QfY9GN0CfvvXX1Sv6DlSTive3jlMTUy+an67//Gysc+0Me9pjitrq0LJp0nGtLgftw==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: eslint: ^7.0.0 || ^8.0.0 @@ -460,9 +426,9 @@ packages: '@eslint-community/eslint-utils': 4.4.0(eslint@8.48.0) '@types/json-schema': 7.0.12 '@types/semver': 7.5.0 - '@typescript-eslint/scope-manager': 6.5.0 - '@typescript-eslint/types': 6.5.0 - '@typescript-eslint/typescript-estree': 6.5.0(typescript@5.2.2) + '@typescript-eslint/scope-manager': 6.6.0 + '@typescript-eslint/types': 6.6.0 + '@typescript-eslint/typescript-estree': 6.6.0(typescript@5.2.2) eslint: 8.48.0 semver: 7.5.4 transitivePeerDependencies: @@ -470,14 +436,6 @@ packages: - typescript dev: true - /@typescript-eslint/visitor-keys@6.5.0: - resolution: {integrity: sha512-yCB/2wkbv3hPsh02ZS8dFQnij9VVQXJMN/gbQsaaY+zxALkZnxa/wagvLEFsAWMPv7d7lxQmNsIzGU1w/T/WyA==} - engines: {node: ^16.0.0 || >=18.0.0} - dependencies: - '@typescript-eslint/types': 6.5.0 - eslint-visitor-keys: 3.4.3 - dev: true - /@typescript-eslint/visitor-keys@6.6.0: resolution: {integrity: sha512-L61uJT26cMOfFQ+lMZKoJNbAEckLe539VhTxiGHrWl5XSKQgA0RTBZJW2HFPy5T0ZvPVSD93QsrTKDkfNwJGyQ==} engines: {node: ^16.0.0 || >=18.0.0} From cb2b2f120ac09a392ca66f1ebc2aeb2596d1616d Mon Sep 17 00:00:00 2001 From: Jaku-BB Date: Wed, 6 Sep 2023 22:13:30 +0200 Subject: [PATCH 3/9] ci: add script to overwrite initial commit on 'use this template' --- .github/workflows/template-initialization.yml | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/template-initialization.yml diff --git a/.github/workflows/template-initialization.yml b/.github/workflows/template-initialization.yml new file mode 100644 index 0000000..8a56773 --- /dev/null +++ b/.github/workflows/template-initialization.yml @@ -0,0 +1,27 @@ +name: Template initialization + +on: + create: + +permissions: + contents: write + +jobs: + template-initialization: + if: ${{ !github.event.repository.is_template }} + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Remove this script + run: | + rm .github/workflows/template-initialization.yml + + - name: Overwrite initial commit + run: | + git config user.email ${{ github.actor }}@users.noreply.github.com + git config user.name ${{ github.actor }} + git add . + git commit --message "chore: initial commit" --amend + git push origin HEAD --force From 82289282b65e343e66418720b13dd96a7673d4b7 Mon Sep 17 00:00:00 2001 From: Jaku-BB Date: Thu, 7 Sep 2023 01:41:49 +0200 Subject: [PATCH 4/9] docs: add documentation --- README.md | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..01089bf --- /dev/null +++ b/README.md @@ -0,0 +1,42 @@ +# d.js-template + +![Build](https://img.shields.io/github/actions/workflow/status/Jaku-BB/d.js-template/test.yml) + +This repository is a template for Discord bots using the [discord.js](https://discord.js.org/) library. It allows you to quickly start your own project, without the hassle of initial setup. It is mainly adapted to my needs, but you can easily change it as you wish. + +## Features + +- interaction handler (application commands, message components and modals) with built-in usage examples +- event handler +- built-in interaction cooldown support +- initial database setup ([Prisma](https://www.prisma.io/)) +- [Docker](https://www.docker.com/) setup with [Docker Compose](https://docs.docker.com/compose/) + +## Installation + +First, create a new repository using this template (**Use this template** button), download it locally, create the `.env` file accordingly to the `.env.example` file and run the database (you can use the `compose.yaml` file for that, but remember to expose port **5432** locally). + +After that, just run: + +```shell +pnpm install + +pnpm dlx prisma migrate deploy +pnpm dlx prisma generate + +pnpm run watch +``` + +To register your application commands, simply run `pnpm run register-application-commands`. + +## Examples + +You can find usage examples in the `src/handlers` directory. I think that they're pretty self-explanatory. + +## Support + +For support, reach me on Discord - jaku.bb - or create an issue here. + +## License + +[MIT](https://github.com/Jaku-BB/d.js-template/blob/main/LICENSE.md) From 939a37a6dd2cadc2a4fbb18e5d9c819866cf6f1b Mon Sep 17 00:00:00 2001 From: Jaku-BB Date: Fri, 8 Sep 2023 02:24:01 +0200 Subject: [PATCH 5/9] docs: rewrite documentation --- README.md | 51 +++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 39 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 01089bf..b5f6399 100644 --- a/README.md +++ b/README.md @@ -2,40 +2,67 @@ ![Build](https://img.shields.io/github/actions/workflow/status/Jaku-BB/d.js-template/test.yml) -This repository is a template for Discord bots using the [discord.js](https://discord.js.org/) library. It allows you to quickly start your own project, without the hassle of initial setup. It is mainly adapted to my needs, but you can easily change it as you wish. +This repository contains a template for building Discord bots in [TypeScript](https://www.typescriptlang.org/) using the [discord.js](https://discord.js.org/) library. +It allows you to quickly start your own project. Note that this template is mostly adapted to my projects, but feel free to contribute. ## Features -- interaction handler (application commands, message components and modals) with built-in usage examples +- interaction handler (application commands, message components and modals) with usage examples - event handler -- built-in interaction cooldown support -- initial database setup ([Prisma](https://www.prisma.io/)) -- [Docker](https://www.docker.com/) setup with [Docker Compose](https://docs.docker.com/compose/) +- built-in support for interaction cooldown +- environment validation +- separate application commands registration script +- [Docker](https://www.docker.com/) with [Docker Compose](https://docs.docker.com/compose/) + +## Requirements + +- [Node.js](https://nodejs.org/) >= v20.5.0 +- [pnpm](https://pnpm.io/) +- access to a [PostgreSQL](https://www.postgresql.org/) database ## Installation -First, create a new repository using this template (**Use this template** button), download it locally, create the `.env` file accordingly to the `.env.example` file and run the database (you can use the `compose.yaml` file for that, but remember to expose port **5432** locally). +After creating a new repository using this template, download it locally. +Then, create the `.env` file and fill it according to the `.env.example` file. -After that, just run: +If you want to use Docker for your database, feel free to use the `compose.yaml` file. +Just remember to expose port **5432** locally. + +To start the bot in development mode, run: ```shell pnpm install -pnpm dlx prisma migrate deploy +pnpm dlx prisma migrate dev pnpm dlx prisma generate pnpm run watch ``` -To register your application commands, simply run `pnpm run register-application-commands`. +## Usage + +The `src` directory already contains everything you need to start your project. +There are also some examples to help you along the way. -## Examples +### Your own handler -You can find usage examples in the `src/handlers` directory. I think that they're pretty self-explanatory. +If you want to add your own handler: + +- create a new file in the `handlers` directory +- import the handler class you want to use from `structures.ts` +- instantiate it and export it as the default +- if your handler is an application command handler, remember to register it with `pnpm run register-application-commands` + +Simple as that! + +> **Note** +> Keep in mind that any interaction key, whether it's an application command name or a `customId` property, must be unique throughout your bot. ## Support -For support, reach me on Discord - jaku.bb - or create an issue here. +Be sure to have a look at the [discord.js guide](https://discordjs.guide/) if you need help with the library itself. + +If you need support, you can reach me on Discord - **jaku.bb** - or [create a new issue](https://github.com/Jaku-BB/d.js-template/issues) here. ## License From 333fff209112804e63fef1782839dec40926b832 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 8 Sep 2023 16:35:09 +0000 Subject: [PATCH 6/9] chore(deps): bump pino from 8.15.0 to 8.15.1 Bumps [pino](https://github.com/pinojs/pino) from 8.15.0 to 8.15.1. - [Release notes](https://github.com/pinojs/pino/releases) - [Commits](https://github.com/pinojs/pino/compare/v8.15.0...v8.15.1) --- updated-dependencies: - dependency-name: pino dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package.json | 2 +- pnpm-lock.yaml | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index ebdfe7b..748a0ed 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "discord-api-types": "^0.37.56", "discord.js": "^14.12.1", "inquirer": "^9.2.10", - "pino": "^8.15.0", + "pino": "^8.15.1", "zod": "^3.22.1" }, "devDependencies": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index be6a780..0096640 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -21,8 +21,8 @@ dependencies: specifier: ^9.2.10 version: 9.2.10 pino: - specifier: ^8.15.0 - version: 8.15.0 + specifier: ^8.15.1 + version: 8.15.1 zod: specifier: ^3.22.1 version: 3.22.2 @@ -1567,6 +1567,14 @@ packages: dependencies: readable-stream: 4.4.2 split2: 4.2.0 + dev: true + + /pino-abstract-transport@1.1.0: + resolution: {integrity: sha512-lsleG3/2a/JIWUtf9Q5gUNErBqwIu1tUKTT3dUzaf5DySw9ra1wcqKjJjLX1VTY64Wk1eEOYsVGSaGfCK85ekA==} + dependencies: + readable-stream: 4.4.2 + split2: 4.2.0 + dev: false /pino-pretty@10.2.0: resolution: {integrity: sha512-tRvpyEmGtc2D+Lr3FulIZ+R1baggQ4S3xD2Ar93KixFEDx6SEAUP3W5aYuEw1C73d6ROrNcB2IXLteW8itlwhA==} @@ -1592,14 +1600,14 @@ packages: resolution: {integrity: sha512-cHjPPsE+vhj/tnhCy/wiMh3M3z3h/j15zHQX+S9GkTBgqJuTuJzYJ4gUyACLhDaJ7kk9ba9iRDmbH2tJU03OiA==} dev: false - /pino@8.15.0: - resolution: {integrity: sha512-olUADJByk4twxccmAxb1RiGKOSvddHugCV3wkqjyv+3Sooa2KLrmXrKEWOKi0XPCLasRR5jBXxioE1jxUa4KzQ==} + /pino@8.15.1: + resolution: {integrity: sha512-Cp4QzUQrvWCRJaQ8Lzv0mJzXVk4z2jlq8JNKMGaixC2Pz5L4l2p95TkuRvYbrEbe85NQsDKrAd4zalf7Ml6WiA==} hasBin: true dependencies: atomic-sleep: 1.0.0 fast-redact: 3.3.0 on-exit-leak-free: 2.1.0 - pino-abstract-transport: 1.0.0 + pino-abstract-transport: 1.1.0 pino-std-serializers: 6.2.2 process-warning: 2.2.0 quick-format-unescaped: 4.0.4 From 53807424dc84d31e91d509dbd66b3a79f0bd7641 Mon Sep 17 00:00:00 2001 From: Jaku-BB Date: Sat, 9 Sep 2023 19:57:40 +0200 Subject: [PATCH 7/9] ci: update dependencies at 22:00 UTC --- .github/dependabot.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 5b8d999..1fdbd47 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -5,3 +5,4 @@ updates: directory: '/' schedule: interval: 'daily' + time: '22:00' From d85521ac18e5bdab1125e78787bb8d9659682a7b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 9 Sep 2023 18:00:06 +0000 Subject: [PATCH 8/9] chore(deps-dev): bump eslint from 8.48.0 to 8.49.0 Bumps [eslint](https://github.com/eslint/eslint) from 8.48.0 to 8.49.0. - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md) - [Commits](https://github.com/eslint/eslint/compare/v8.48.0...v8.49.0) --- updated-dependencies: - dependency-name: eslint dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package.json | 2 +- pnpm-lock.yaml | 70 +++++++++++++++++++++++++------------------------- 2 files changed, 36 insertions(+), 36 deletions(-) diff --git a/package.json b/package.json index 748a0ed..d1e73f7 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "@typescript-eslint/parser": "^6.6.0", "concurrently": "^8.2.1", "dotenv": "^16.3.1", - "eslint": "^8.48.0", + "eslint": "^8.49.0", "eslint-config-prettier": "^9.0.0", "eslint-plugin-prettier": "^5.0.0", "husky": "^8.0.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0096640..321a31d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -36,10 +36,10 @@ devDependencies: version: 20.5.9 '@typescript-eslint/eslint-plugin': specifier: ^6.6.0 - version: 6.6.0(@typescript-eslint/parser@6.6.0)(eslint@8.48.0)(typescript@5.2.2) + version: 6.6.0(@typescript-eslint/parser@6.6.0)(eslint@8.49.0)(typescript@5.2.2) '@typescript-eslint/parser': specifier: ^6.6.0 - version: 6.6.0(eslint@8.48.0)(typescript@5.2.2) + version: 6.6.0(eslint@8.49.0)(typescript@5.2.2) concurrently: specifier: ^8.2.1 version: 8.2.1 @@ -47,14 +47,14 @@ devDependencies: specifier: ^16.3.1 version: 16.3.1 eslint: - specifier: ^8.48.0 - version: 8.48.0 + specifier: ^8.49.0 + version: 8.49.0 eslint-config-prettier: specifier: ^9.0.0 - version: 9.0.0(eslint@8.48.0) + version: 9.0.0(eslint@8.49.0) eslint-plugin-prettier: specifier: ^5.0.0 - version: 5.0.0(eslint-config-prettier@9.0.0)(eslint@8.48.0)(prettier@3.0.3) + version: 5.0.0(eslint-config-prettier@9.0.0)(eslint@8.49.0)(prettier@3.0.3) husky: specifier: ^8.0.3 version: 8.0.3 @@ -148,13 +148,13 @@ packages: - utf-8-validate dev: false - /@eslint-community/eslint-utils@4.4.0(eslint@8.48.0): + /@eslint-community/eslint-utils@4.4.0(eslint@8.49.0): resolution: {integrity: sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^6.0.0 || ^7.0.0 || >=8.0.0 dependencies: - eslint: 8.48.0 + eslint: 8.49.0 eslint-visitor-keys: 3.4.3 dev: true @@ -180,13 +180,13 @@ packages: - supports-color dev: true - /@eslint/js@8.48.0: - resolution: {integrity: sha512-ZSjtmelB7IJfWD2Fvb7+Z+ChTIKWq6kjda95fLcQKNS5aheVHn4IkfgRQE3sIIzTcSLwLcLZUD9UBt+V7+h+Pw==} + /@eslint/js@8.49.0: + resolution: {integrity: sha512-1S8uAY/MTJqVx0SC4epBq+N2yhuwtNwLbJYNZyhL2pO1ZVKn5HFXav5T41Ryzy9K9V7ZId2JB2oy/W4aCd9/2w==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /@humanwhocodes/config-array@0.11.10: - resolution: {integrity: sha512-KVVjQmNUepDVGXNuoRRdmmEjruj0KfiGSbS8LVc12LMsWDQzRXJ0qdhN8L8uUigKpfEHRhlaQFY0ib1tnUbNeQ==} + /@humanwhocodes/config-array@0.11.11: + resolution: {integrity: sha512-N2brEuAadi0CcdeMXUkhbZB84eskAc8MEX1By6qEchoVywSgXPIjou4rYsl0V3Hj0ZnuGycGCjdNgockbzeWNA==} engines: {node: '>=10.10.0'} dependencies: '@humanwhocodes/object-schema': 1.2.1 @@ -313,7 +313,7 @@ packages: '@types/node': 20.5.9 dev: false - /@typescript-eslint/eslint-plugin@6.6.0(@typescript-eslint/parser@6.6.0)(eslint@8.48.0)(typescript@5.2.2): + /@typescript-eslint/eslint-plugin@6.6.0(@typescript-eslint/parser@6.6.0)(eslint@8.49.0)(typescript@5.2.2): resolution: {integrity: sha512-CW9YDGTQnNYMIo5lMeuiIG08p4E0cXrXTbcZ2saT/ETE7dWUrNxlijsQeU04qAAKkILiLzdQz+cGFxCJjaZUmA==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: @@ -325,13 +325,13 @@ packages: optional: true dependencies: '@eslint-community/regexpp': 4.6.2 - '@typescript-eslint/parser': 6.6.0(eslint@8.48.0)(typescript@5.2.2) + '@typescript-eslint/parser': 6.6.0(eslint@8.49.0)(typescript@5.2.2) '@typescript-eslint/scope-manager': 6.6.0 - '@typescript-eslint/type-utils': 6.6.0(eslint@8.48.0)(typescript@5.2.2) - '@typescript-eslint/utils': 6.6.0(eslint@8.48.0)(typescript@5.2.2) + '@typescript-eslint/type-utils': 6.6.0(eslint@8.49.0)(typescript@5.2.2) + '@typescript-eslint/utils': 6.6.0(eslint@8.49.0)(typescript@5.2.2) '@typescript-eslint/visitor-keys': 6.6.0 debug: 4.3.4 - eslint: 8.48.0 + eslint: 8.49.0 graphemer: 1.4.0 ignore: 5.2.4 natural-compare: 1.4.0 @@ -342,7 +342,7 @@ packages: - supports-color dev: true - /@typescript-eslint/parser@6.6.0(eslint@8.48.0)(typescript@5.2.2): + /@typescript-eslint/parser@6.6.0(eslint@8.49.0)(typescript@5.2.2): resolution: {integrity: sha512-setq5aJgUwtzGrhW177/i+DMLqBaJbdwGj2CPIVFFLE0NCliy5ujIdLHd2D1ysmlmsjdL2GWW+hR85neEfc12w==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: @@ -357,7 +357,7 @@ packages: '@typescript-eslint/typescript-estree': 6.6.0(typescript@5.2.2) '@typescript-eslint/visitor-keys': 6.6.0 debug: 4.3.4 - eslint: 8.48.0 + eslint: 8.49.0 typescript: 5.2.2 transitivePeerDependencies: - supports-color @@ -371,7 +371,7 @@ packages: '@typescript-eslint/visitor-keys': 6.6.0 dev: true - /@typescript-eslint/type-utils@6.6.0(eslint@8.48.0)(typescript@5.2.2): + /@typescript-eslint/type-utils@6.6.0(eslint@8.49.0)(typescript@5.2.2): resolution: {integrity: sha512-8m16fwAcEnQc69IpeDyokNO+D5spo0w1jepWWY2Q6y5ZKNuj5EhVQXjtVAeDDqvW6Yg7dhclbsz6rTtOvcwpHg==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: @@ -382,9 +382,9 @@ packages: optional: true dependencies: '@typescript-eslint/typescript-estree': 6.6.0(typescript@5.2.2) - '@typescript-eslint/utils': 6.6.0(eslint@8.48.0)(typescript@5.2.2) + '@typescript-eslint/utils': 6.6.0(eslint@8.49.0)(typescript@5.2.2) debug: 4.3.4 - eslint: 8.48.0 + eslint: 8.49.0 ts-api-utils: 1.0.2(typescript@5.2.2) typescript: 5.2.2 transitivePeerDependencies: @@ -417,19 +417,19 @@ packages: - supports-color dev: true - /@typescript-eslint/utils@6.6.0(eslint@8.48.0)(typescript@5.2.2): + /@typescript-eslint/utils@6.6.0(eslint@8.49.0)(typescript@5.2.2): resolution: {integrity: sha512-mPHFoNa2bPIWWglWYdR0QfY9GN0CfvvXX1Sv6DlSTive3jlMTUy+an67//Gysc+0Me9pjitrq0LJp0nGtLgftw==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: eslint: ^7.0.0 || ^8.0.0 dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@8.48.0) + '@eslint-community/eslint-utils': 4.4.0(eslint@8.49.0) '@types/json-schema': 7.0.12 '@types/semver': 7.5.0 '@typescript-eslint/scope-manager': 6.6.0 '@typescript-eslint/types': 6.6.0 '@typescript-eslint/typescript-estree': 6.6.0(typescript@5.2.2) - eslint: 8.48.0 + eslint: 8.49.0 semver: 7.5.4 transitivePeerDependencies: - supports-color @@ -811,16 +811,16 @@ packages: engines: {node: '>=12'} dev: false - /eslint-config-prettier@9.0.0(eslint@8.48.0): + /eslint-config-prettier@9.0.0(eslint@8.49.0): resolution: {integrity: sha512-IcJsTkJae2S35pRsRAwoCE+925rJJStOdkKnLVgtE+tEpqU0EVVM7OqrwxqgptKdX29NUwC82I5pXsGFIgSevw==} hasBin: true peerDependencies: eslint: '>=7.0.0' dependencies: - eslint: 8.48.0 + eslint: 8.49.0 dev: true - /eslint-plugin-prettier@5.0.0(eslint-config-prettier@9.0.0)(eslint@8.48.0)(prettier@3.0.3): + /eslint-plugin-prettier@5.0.0(eslint-config-prettier@9.0.0)(eslint@8.49.0)(prettier@3.0.3): resolution: {integrity: sha512-AgaZCVuYDXHUGxj/ZGu1u8H8CYgDY3iG6w5kUFw4AzMVXzB7VvbKgYR4nATIN+OvUrghMbiDLeimVjVY5ilq3w==} engines: {node: ^14.18.0 || >=16.0.0} peerDependencies: @@ -834,8 +834,8 @@ packages: eslint-config-prettier: optional: true dependencies: - eslint: 8.48.0 - eslint-config-prettier: 9.0.0(eslint@8.48.0) + eslint: 8.49.0 + eslint-config-prettier: 9.0.0(eslint@8.49.0) prettier: 3.0.3 prettier-linter-helpers: 1.0.0 synckit: 0.8.5 @@ -854,16 +854,16 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /eslint@8.48.0: - resolution: {integrity: sha512-sb6DLeIuRXxeM1YljSe1KEx9/YYeZFQWcV8Rq9HfigmdDEugjLEVEa1ozDjL6YDjBpQHPJxJzze+alxi4T3OLg==} + /eslint@8.49.0: + resolution: {integrity: sha512-jw03ENfm6VJI0jA9U+8H5zfl5b+FvuU3YYvZRdZHOlU2ggJkxrlkJH4HcDrZpj6YwD8kuYqvQM8LyesoazrSOQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} hasBin: true dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@8.48.0) + '@eslint-community/eslint-utils': 4.4.0(eslint@8.49.0) '@eslint-community/regexpp': 4.6.2 '@eslint/eslintrc': 2.1.2 - '@eslint/js': 8.48.0 - '@humanwhocodes/config-array': 0.11.10 + '@eslint/js': 8.49.0 + '@humanwhocodes/config-array': 0.11.11 '@humanwhocodes/module-importer': 1.0.1 '@nodelib/fs.walk': 1.2.8 ajv: 6.12.6 From 8b049416239637aa718fc76772768e2877900286 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 9 Sep 2023 18:07:46 +0000 Subject: [PATCH 9/9] chore(deps-dev): bump @types/node from 20.5.9 to 20.6.0 Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 20.5.9 to 20.6.0. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package.json | 2 +- pnpm-lock.yaml | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index d1e73f7..f2bb715 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ }, "devDependencies": { "@types/inquirer": "^9.0.3", - "@types/node": "20.5.9", + "@types/node": "20.6.0", "@typescript-eslint/eslint-plugin": "^6.6.0", "@typescript-eslint/parser": "^6.6.0", "concurrently": "^8.2.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 321a31d..d563864 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -32,8 +32,8 @@ devDependencies: specifier: ^9.0.3 version: 9.0.3 '@types/node': - specifier: 20.5.9 - version: 20.5.9 + specifier: 20.6.0 + version: 20.6.0 '@typescript-eslint/eslint-plugin': specifier: ^6.6.0 version: 6.6.0(@typescript-eslint/parser@6.6.0)(eslint@8.49.0)(typescript@5.2.2) @@ -294,8 +294,8 @@ packages: resolution: {integrity: sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA==} dev: true - /@types/node@20.5.9: - resolution: {integrity: sha512-PcGNd//40kHAS3sTlzKB9C9XL4K0sTup8nbG5lC14kzEteTNuAFh9u5nA0o5TWnSG2r/JNPRXFVcHJIIeRlmqQ==} + /@types/node@20.6.0: + resolution: {integrity: sha512-najjVq5KN2vsH2U/xyh2opaSEz6cZMR2SetLIlxlj08nOcmPOemJmUK2o4kUzfLqfrWE0PIrNeE16XhYDd3nqg==} /@types/semver@7.5.0: resolution: {integrity: sha512-G8hZ6XJiHnuhQKR7ZmysCeJWE08o8T0AXtk5darsCaTVsYZhhgUrq53jizaR2FvsoeCwJhlmwTjkXBY5Pn/ZHw==} @@ -304,13 +304,13 @@ packages: /@types/through@0.0.30: resolution: {integrity: sha512-FvnCJljyxhPM3gkRgWmxmDZyAQSiBQQWLI0A0VFL0K7W1oRUrPJSqNO0NvTnLkBcotdlp3lKvaT0JrnyRDkzOg==} dependencies: - '@types/node': 20.5.9 + '@types/node': 20.6.0 dev: true /@types/ws@8.5.5: resolution: {integrity: sha512-lwhs8hktwxSjf9UaZ9tG5M03PGogvFaH8gUgLNbN9HKIg0dvv6q+gkSuJ8HN4/VbyxkuLzCjlN7GquQ0gUJfIg==} dependencies: - '@types/node': 20.5.9 + '@types/node': 20.6.0 dev: false /@typescript-eslint/eslint-plugin@6.6.0(@typescript-eslint/parser@6.6.0)(eslint@8.49.0)(typescript@5.2.2):