-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into dev
# Conflicts: # pnpm-lock.yaml
- Loading branch information
Showing
5 changed files
with
168 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ updates: | |
directory: '/' | ||
schedule: | ||
interval: 'daily' | ||
time: '22:00' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# d.js-template | ||
|
||
![Build](https://img.shields.io/github/actions/workflow/status/Jaku-BB/d.js-template/test.yml) | ||
|
||
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 usage examples | ||
- event handler | ||
- 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 | ||
|
||
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. | ||
|
||
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 dev | ||
pnpm dlx prisma generate | ||
|
||
pnpm run watch | ||
``` | ||
|
||
## Usage | ||
|
||
The `src` directory already contains everything you need to start your project. | ||
There are also some examples to help you along the way. | ||
|
||
### Your own handler | ||
|
||
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 | ||
|
||
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 | ||
|
||
[MIT](https://github.com/Jaku-BB/d.js-template/blob/main/LICENSE.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.