Skip to content

Commit 54e054a

Browse files
chore: update to latest discordjs and node + repl command. (#957)
* chore: update to latest discordjs and node. also changed from ts-node to tsx * chore: delete console.logs * chore: update config files, remove console.log * chore: update workflow node version * chore: remove debug code, rename single letter vars * Feat repel (#959) * chore: add docker commands to package.json and update package manager version * feat: add repel command and mini mod role support --------- Co-authored-by: Cake <[email protected]>
1 parent aec8779 commit 54e054a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+6753
-6037
lines changed

.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,5 @@ ONBOARDING_CHANNEL=
4040
JOIN_LOG_CHANNEL=
4141
INTRO_CHANNEL=
4242
INTRO_ROLE=
43+
REPEL_ROLE_NAME=MiniMod # The name of the role that is used for MiniMods
44+
REPEL_DELETE_COUNT=2 # The number of messages to delete when using the repel command

.github/workflows/test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
uses: actions/checkout@v3
1212
- uses: actions/setup-node@v3
1313
with:
14-
node-version: 16.18.1
14+
node-version: 20.12.2
1515

1616
- name: Cache npm dependencies
1717
uses: actions/cache@v3

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
16.18.1
1+
20.12.2

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"**/dist": true
1414
},
1515
"editor.codeActionsOnSave": {
16-
"source.fixAll.eslint": true
16+
"source.fixAll.eslint": "always"
1717
},
1818
"deno.enable": false
1919
}

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:16.18.1-slim AS deps
1+
FROM node:20.12.2-slim AS deps
22

33
WORKDIR /app
44

@@ -10,7 +10,7 @@ COPY src ./src
1010
RUN yarn install --frozen-lockfile
1111
RUN npm run build
1212

13-
FROM node:16.18.1-slim
13+
FROM node:20.12.2-slim
1414

1515
WORKDIR /app
1616

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,15 @@ cd webdev-support-bot
105105

106106
cp .env.example .env # and enter a token
107107

108+
108109
yarn install # or npm install
109110
code .
110111

112+
yarn docker:dev:up
111113
yarn dev # or npm dev
112114

113115
# or be fancy with a one-liner
114-
git clone https://github.com/ljosberinn/webdev-support-bot/ && cd webdev-support-bot && cp .env.example .env && yarn install && code . && yarn dev
116+
git clone https://github.com/ljosberinn/webdev-support-bot/ && cd webdev-support-bot && cp .env.example .env && yarn install && code . && yarn docker:dev:up && yarn dev
115117
```
116118

117119
## Environment variables

docker-compose.dev.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
services:
2+
mongodb:
3+
image: mongo:7.0
4+
container_name: webdev-support-bot-mongo-dev
5+
restart: unless-stopped
6+
environment:
7+
MONGO_INITDB_ROOT_USERNAME: admin
8+
MONGO_INITDB_ROOT_PASSWORD: password
9+
MONGO_INITDB_DATABASE: webdev-support-bot
10+
ports:
11+
- "27017:27017"
12+
volumes:
13+
- mongodb_dev_data:/data/db
14+
15+
volumes:
16+
mongodb_dev_data:

package.json

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
"main": "index.js",
66
"type": "module",
77
"engines": {
8-
"node": "16.18.1"
8+
"node": "20.12.2"
99
},
1010
"scripts": {
11-
"dev": "cross-env TS_NODE_FILES=true TS_NODE_PROJECT=\"./tsconfig.json\" nodemon -r dotenv/config -x node --experimental-specifier-resolution=node --loader ts-node/esm ./src/index.ts",
11+
"dev": "tsx watch -r dotenv/config ./src/index.ts",
1212
"start": "node build/index.js",
1313
"build": "tsc",
1414
"lint": "eslint src && tsc --noEmit",
@@ -17,47 +17,48 @@
1717
"test:ci": "jest --ci",
1818
"lint:fix": "eslint --fix src && prettier --write src",
1919
"lint:types": "tsc --noEmit",
20-
"install:clean": "rm -rf node_modules && rm yarn.lock && yarn"
20+
"install:clean": "rm -rf node_modules && rm yarn.lock && yarn",
21+
"docker:dev:up": "docker compose -f docker-compose.dev.yml up -d",
22+
"docker:dev:down": "docker compose -f docker-compose.dev.yml down"
2123
},
2224
"keywords": [],
2325
"author": "",
2426
"license": "ISC",
2527
"dependencies": {
26-
"@mdn/browser-compat-data": "5.2.17",
27-
"@sentry/node": "7.20.0",
28-
"compare-versions": "4.1.3",
28+
"@mdn/browser-compat-data": "5.5.49",
29+
"@sentry/node": "8.27.0",
30+
"compare-versions": "6.1.1",
2931
"cross-env": "^7.0.3",
30-
"date-fns": "2.28.0",
31-
"discord.js": "13.8.1",
32-
"dom-parser": "0.1.6",
32+
"date-fns": "3.6.0",
33+
"discord.js": "14.15.3",
34+
"dom-parser": "1.1.5",
3335
"domyno": "1.0.1",
34-
"fuse.js": "6.6.2",
35-
"html-entities": "2.3.3",
36+
"fuse.js": "7.0.0",
37+
"html-entities": "2.5.2",
3638
"lodash-es": "4.17.21",
37-
"mongoose": "6.4.6",
39+
"mongoose": "8.5.4",
3840
"node-cache": "5.1.2",
39-
"node-fetch": "3.2.10",
40-
"node-html-parser": "5.3.3",
41-
"ts-node": "10.9.1",
42-
"typescript": "4.7.4"
41+
"node-fetch": "3.3.2",
42+
"node-html-parser": "6.1.13",
43+
"typescript": "5.5.4"
4344
},
4445
"devDependencies": {
45-
"@sentry/types": "7.20.0",
46-
"@types/dom-parser": "0.1.1",
46+
"@sentry/types": "8.27.0",
47+
"@types/dom-parser": "0.1.4",
4748
"@types/html-entities": "1.3.4",
48-
"@types/jest": "28.1.8",
49+
"@types/jest": "29.5.12",
4950
"@types/mongoose": "5.11.97",
50-
"@types/node": "18.0.0",
51+
"@types/node": "22.5.0",
5152
"@types/node-fetch": "3.0.3",
52-
"dotenv": "16.0.1",
53-
"eslint-config-galex": "4.3.2",
54-
"eslint": "8.28.0",
55-
"husky": "8.0.1",
56-
"jest": "28.1.3",
57-
"lint-staged": "13.0.3",
58-
"nodemon": "2.0.20",
59-
"prettier": "2.7.1",
60-
"ts-jest": "28.0.8"
53+
"dotenv": "16.4.5",
54+
"eslint": "8.57.0",
55+
"eslint-config-galex": "4.5.2",
56+
"husky": "9.1.5",
57+
"jest": "29.7.0",
58+
"lint-staged": "15.2.9",
59+
"prettier": "3.3.3",
60+
"ts-jest": "29.2.5",
61+
"tsx": "^4.19.0"
6162
},
6263
"husky": {
6364
"hooks": {
@@ -67,5 +68,6 @@
6768
"lint-staged": {
6869
"src/**/*.{js,jsx,ts,tsx,json,css,scss,md}": "prettier --write",
6970
"*.js": "eslint --fix"
70-
}
71+
},
72+
"packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
7173
}

src/env.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,7 @@ export const { ONBOARDING_CHANNEL } = process.env;
4242
export const { JOIN_LOG_CHANNEL } = process.env;
4343
export const { INTRO_CHANNEL } = process.env;
4444
export const { INTRO_ROLE } = process.env;
45+
46+
export const { REPEL_ROLE_NAME } = process.env;
47+
export const REPEL_DELETE_COUNT =
48+
Number.parseInt(process.env.REPEL_DELETE_COUNT) || 2;

src/types.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import type {
22
ChatInputApplicationCommandData,
3+
ChatInputCommandInteraction,
34
Client,
45
CommandInteraction,
56
Guild,
67
} from 'discord.js';
78

89
export type CommandDataWithHandler = ChatInputApplicationCommandData & {
9-
handler: (client: Client, interaction: CommandInteraction) => Promise<void>;
10+
handler: (client: Client, interaction: ChatInputCommandInteraction) => Promise<void>;
1011
onAttach?: (client: Client) => void;
1112
guildValidate?: (guild: Guild) => boolean;
1213
};

0 commit comments

Comments
 (0)