Skip to content

Commit 68779e3

Browse files
authored
feat: add voice-on-demand functionality (#2)
1 parent 7e5e20c commit 68779e3

28 files changed

+3186
-10
lines changed

.dockerignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.gitignore

.env.example

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
DISCORD_TOKEN=
2+
DISCORD_CLIENT_ID=
3+
DISCORD_GUILD_ID=
4+
REDIS_URL=

.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.gitignore

.eslintrc.yaml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
parser: '@typescript-eslint/parser'
2+
parserOptions:
3+
sourceType: module
4+
ecmaVersion: 2022
5+
project: ./tsconfig.json
6+
7+
extends:
8+
- plugin:@typescript-eslint/recommended
9+
- plugin:@typescript-eslint/recommended-requiring-type-checking
10+
- plugin:sonarjs/recommended
11+
- plugin:prettier/recommended
12+
13+
plugins:
14+
- simple-import-sort
15+
- import
16+
- only-error
17+
- unused-imports
18+
19+
rules:
20+
import/exports-last: error
21+
import/first: error
22+
import/no-duplicates: error
23+
import/order: off
24+
25+
simple-import-sort/imports: error
26+
simple-import-sort/exports: error
27+
28+
unused-imports/no-unused-imports: error

.github/workflows/good-practices.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ jobs:
1919

2020
permissions:
2121
security-events: write
22+
pull-requests: read
2223

2324
steps:
2425
- name: Checkout repository

.github/workflows/integration.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ jobs:
4343
run: pnpm typecheck
4444

4545
- name: Lint project
46-
run: pnpm affected:lint
46+
run: pnpm lint
4747

4848
- name: Build project
49-
run: pnpm affected:build
49+
run: pnpm build
5050

5151
- name: Build Docker image for project
5252
uses: docker/build-push-action@v4

.npmrc

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
save-exact=true
2+
prefer-offline=true
3+
engines-strict=true
4+
strict-peer-dependencies=true

.nvmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
20.1.0

.prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.gitignore

CONTRIBUTING.md

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<h1 align="center">Contributing our Discord bot</h1>
2+
3+
## Installation
4+
5+
We use [pnpm](https://pnpm.io) to manage our dependencies.
6+
You can [install it](https://pnpm.io/installation) using your preferred
7+
method, but we recommend using [Corepack](https://nodejs.org/api/corepack.html#supported-package-managers) so that you
8+
keep your package manager version in sync with ours.
9+
10+
Make sure you run **Node 20** or the dependencies' installation will fail.
11+
We recommend using [nvm](https://github.com/nvm-sh/nvm) to manage your Node version.
12+
13+
Finally, run `pnpm install`.
14+
15+
## Tooling
16+
17+
We use [Prettier](https://prettier.io/) and [ESLint](https://eslint.org/) to maintain
18+
consistency in our code.
19+
You should set your editor up so that those tools are properly integrated.
20+
21+
Make sure to have [Docker](https://www.docker.com/) & [docker-compose](https://github.com/docker/compose) installed on
22+
your machine as you
23+
will need it to create your development environment.
24+
If needed, you can install it following [its documentation](https://docs.docker.com/get-docker/).
25+
26+
## Making Pull Requests
27+
28+
In order to contribute to the project, you will need to fork the repository first.
29+
Then, create a **Draft pull request** to let us known that you are working on it.
30+
Make sure your title follows the [conventional commits naming scheme](https://conventionalcommits.org/)
31+
as it helps us to sort pull requests (you can view examples searching throughout our git history).
32+
When, you think that your work is ready, mark your PR as **Ready for review**.

Dockerfile

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
FROM node:20.1.0-alpine as base
2+
3+
WORKDIR /app
4+
5+
RUN corepack enable
6+
RUN apk add --no-cache python3 make g++
7+
8+
COPY pnpm-lock.yaml package.json ./
9+
10+
RUN pnpm fetch
11+
12+
FROM base as build
13+
14+
WORKDIR /app
15+
16+
COPY tsup.config.ts ./
17+
COPY src ./src
18+
19+
RUN pnpm install --frozen-lockfile --offline && \
20+
pnpm run build
21+
22+
FROM base as production-dependencies
23+
24+
WORKDIR /app
25+
26+
RUN pnpm install --production --frozen-lockfile --offline
27+
28+
FROM node:20.1.0-alpine as application
29+
30+
WORKDIR /app
31+
32+
COPY --from=production-dependencies --chown=node /app/node_modules ./node_modules
33+
COPY --from=build --chown=node /app/dist ./
34+
35+
RUN echo '{"type":"module"}' > package.json
36+
37+
USER node
38+
39+
CMD node --enable-source-maps main.js

LICENSE.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 Codinglab
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<h1 align="center">Discord bot</h1>
2+
3+
<p align="center">Discord bot used in our server</p>
4+
5+
<br/>
6+
7+
## Contributing
8+
9+
See our [contributing guide](./CONTRIBUTING.md)

docker-compose.yaml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: '3'
2+
3+
volumes:
4+
redis-data:
5+
6+
services:
7+
redis:
8+
image: redis:7.0.11-alpine
9+
ports:
10+
- '6379:6379'
11+
volumes:
12+
- redis-data:/data

package.json

+40-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,44 @@
11
{
2+
"name": "discord-bot",
3+
"type": "module",
4+
"private": true,
5+
"description": "Discord bot for our server",
6+
"author": "Codinglab <[email protected]>",
7+
"license": "MIT",
8+
"scripts": {
9+
"build": "tsup-node src/main.ts",
10+
"dev": "tsup-node src/main.ts --watch --on-success \"clear && node --enable-source-maps -r dotenv/config dist/main.js\"",
11+
"lint": "eslint src/**/*.ts --report-unused-disable-directives",
12+
"typecheck": "tsc --noEmit"
13+
},
14+
"dependencies": {
15+
"@keyv/redis": "2.5.6",
16+
"discord-api-types": "0.37.42",
17+
"discord.js": "14.11.0",
18+
"env-var": "7.3.0",
19+
"keyv": "4.5.2",
20+
"param-case": "3.0.4"
21+
},
222
"devDependencies": {
3-
"prettier": "^2.8.8"
23+
"@types/node": "20.1.7",
24+
"@typescript-eslint/eslint-plugin": "5.59.2",
25+
"@typescript-eslint/parser": "5.59.5",
26+
"dotenv": "16.0.3",
27+
"eslint": "8.39.0",
28+
"eslint-config-prettier": "8.8.0",
29+
"eslint-plugin-import": "2.27.5",
30+
"eslint-plugin-only-error": "1.0.2",
31+
"eslint-plugin-prettier": "4.2.1",
32+
"eslint-plugin-simple-import-sort": "10.0.0",
33+
"eslint-plugin-sonarjs": "0.19.0",
34+
"eslint-plugin-unused-imports": "2.0.0",
35+
"prettier": "2.8.8",
36+
"tsup": "6.7.0",
37+
"type-fest": "3.10.0",
38+
"typescript": "5.0.4"
39+
},
40+
"packageManager": "[email protected]",
41+
"engines": {
42+
"node": "20.1.0"
443
}
544
}

0 commit comments

Comments
 (0)