Skip to content

Commit 4bdcb19

Browse files
authored
chore: use latest version of custom modules, move to ESM (#103)
* chore: use latest version of custom modules, move to ESM * ci: bump node version in build pipeline
1 parent f9ce43a commit 4bdcb19

28 files changed

Lines changed: 738 additions & 712 deletions

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ on:
88
jobs:
99
build:
1010
concurrency: ci-${{ github.ref }}
11-
11+
1212
runs-on: ubuntu-latest
1313

1414
strategy:
1515
matrix:
16-
node-version: [18.x]
16+
node-version: [20.x]
1717

1818
steps:
1919
- uses: actions/checkout@v3

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"node_modules": true
1010
},
1111
"editor.codeActionsOnSave": {
12-
"source.fixAll.eslint": true
12+
"source.fixAll.eslint": "explicit"
1313
},
1414
"npm.packageManager": "yarn",
1515
"files.eol": "\n",

config.development.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,42 @@
5353
{
5454
"roleid": "1028257512312557597",
5555
"emote": "🇫"
56+
},
57+
{
58+
"roleid": "1285929298192240641",
59+
"emote": "🇦"
60+
},
61+
{
62+
"roleid": "1285929502697984093",
63+
"emote": "🇧"
64+
},
65+
{
66+
"roleid": "1285929552887156798",
67+
"emote": "🇨"
68+
},
69+
{
70+
"roleid": "1285929600005705800",
71+
"emote": "🇩"
72+
},
73+
{
74+
"roleid": "1285929658541408306",
75+
"emote": "🇪"
76+
},
77+
{
78+
"roleid": "1285929681240981577",
79+
"emote": "🇫"
80+
},
81+
{
82+
"roleid": "1285929699725545493",
83+
"emote": "🇬"
84+
},
85+
{
86+
"roleid": "1285929715269636176",
87+
"emote": "🇭"
88+
},
89+
{
90+
"roleid": "1285929727462346763",
91+
"emote": "🇮"
5692
}
5793
]
5894
},

config.production.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,42 @@
6161
{
6262
"roleid": "1152381279136927914",
6363
"emote": "🇭"
64+
},
65+
{
66+
"roleid": "1283404168257605672",
67+
"emote": "🇦"
68+
},
69+
{
70+
"roleid": "1283404559397683241",
71+
"emote": "🇧"
72+
},
73+
{
74+
"roleid": "1283404592985542686",
75+
"emote": "🇨"
76+
},
77+
{
78+
"roleid": "1283404631925588081",
79+
"emote": "🇩"
80+
},
81+
{
82+
"roleid": "1283404659381375058",
83+
"emote": "🇪"
84+
},
85+
{
86+
"roleid": "1283404688632451155",
87+
"emote": "🇫"
88+
},
89+
{
90+
"roleid": "1283404711252197376",
91+
"emote": "🇬"
92+
},
93+
{
94+
"roleid": "1283404744039202917",
95+
"emote": "🇭"
96+
},
97+
{
98+
"roleid": "1283404783264206859",
99+
"emote": "🇮"
64100
}
65101
]
66102
},

index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import * as dotenv from 'dotenv';
22
import { GatewayIntentBits } from 'discord.js';
33

4-
import { DatadropClient } from './src/datadrop';
5-
import { readConfig } from './src/config';
6-
import { Configuration } from './src/models/Configuration';
4+
import { DatadropClient } from './src/datadrop.js';
5+
import { readConfig } from './src/config.js';
6+
import { Configuration } from './src/models/Configuration.js';
77

88
dotenv.config({ debug: Boolean(process.env.DEBUG) });
99

package.json

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
{
22
"name": "datadrop",
3-
"version": "1.10.2",
3+
"version": "1.11.0",
4+
"type": "module",
45
"main": "./build/index.js",
56
"scripts": {
67
"start": "docker-compose up --build",
78
"stop": "docker-compose down",
89
"build": "rm -rf build/ && tsc",
910
"lint": "eslint --fix --ext .ts .",
10-
"env-gen": "node ./scripts/envgen.js"
11+
"env-gen": "node ./scripts/envgen.cjs"
1112
},
1213
"repository": {
1314
"type": "git",
@@ -20,19 +21,20 @@
2021
},
2122
"homepage": "https://github.com/section-IG/DataDrop#readme",
2223
"dependencies": {
23-
"@hunteroi/advanced-logger": "^0.0.3",
24-
"@hunteroi/discord-selfrole": "^3.2.0",
25-
"@hunteroi/discord-temp-channels": "^3.1.0",
26-
"@hunteroi/discord-verification": "^1.4.0",
27-
"discord.js": "^14.8.0",
28-
"dotenv": "^16.0.3",
29-
"ts-postgres": "^1.3.0"
24+
"@hunteroi/advanced-logger": "^0.2.0",
25+
"@hunteroi/discord-selfrole": "^4.0.4",
26+
"@hunteroi/discord-temp-channels": "^3.3.0",
27+
"@hunteroi/discord-verification": "^1.5.0",
28+
"@sendgrid/mail": "8.1.3",
29+
"discord.js": "^14.16.2",
30+
"dotenv": "^16.4.5",
31+
"ts-postgres": "^1.9.0"
3032
},
3133
"devDependencies": {
32-
"@types/node": "^18.7.14",
33-
"@typescript-eslint/eslint-plugin": "^5.36.2",
34-
"@typescript-eslint/parser": "^5.36.2",
35-
"eslint": "^8.23.0",
36-
"typescript": "^4.8.2"
34+
"@types/node": "^20.12.7",
35+
"@typescript-eslint/eslint-plugin": "^7.6.0",
36+
"@typescript-eslint/parser": "^7.6.0",
37+
"eslint": "^9.0.0",
38+
"typescript": "^5.4.4"
3739
}
3840
}
File renamed without changes.

src/commands/announce.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { ChannelType, Colors, EmbedBuilder, Message, TextChannel } from 'discord.js';
22

3-
import { DatadropClient } from '../datadrop';
3+
import { DatadropClient } from '../datadrop.js';
44

5-
module.exports = {
5+
export default {
66
name: 'announce',
77
aliases: ['annonce'],
88
description:
@@ -13,7 +13,8 @@ module.exports = {
1313
adminOnly: true,
1414

1515
async execute(client: DatadropClient, message: Message, args: string[]) {
16-
if (!message.guild) return;
16+
if (!message.inGuild()) return;
17+
1718
const { announce } = client.config;
1819

1920
const embed = new EmbedBuilder()

src/commands/email.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { EmbedBuilder, Message } from 'discord.js';
22

3-
import { DatadropClient } from '../datadrop';
3+
import { DatadropClient } from '../datadrop.js';
44

55
const people = [
66
{
@@ -13,7 +13,7 @@ const people = [
1313
},
1414
];
1515

16-
module.exports = {
16+
export default {
1717
name: 'email',
1818
aliases: ['emails'],
1919
description:
@@ -30,6 +30,7 @@ module.exports = {
3030
people.map(p => ({ name: p.name, value: p.emails.join(', '), inline: true }))
3131
);
3232

33-
await message.channel.send({ embeds: [embed] });
33+
if (message.channel.isSendable())
34+
await message.channel.send({ embeds: [embed] });
3435
}
3536
};

src/commands/eval.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { Message, codeBlock } from 'discord.js';
22

3-
import { DatadropClient } from '../datadrop';
4-
import { clean } from '../helpers';
3+
import { DatadropClient } from '../datadrop.js';
4+
import { clean } from '../helpers.js';
55

6-
module.exports = {
6+
export default {
77
name: 'eval',
88
description: 'Évalue du code Javascript.',
99
ownerOnly: true,
@@ -29,7 +29,8 @@ module.exports = {
2929
} catch (err) {
3030
content = `// An error occured\n\n${clean(err)}`;
3131
} finally {
32-
message.channel.send(codeBlock('xl', content));
32+
if (message.channel.isSendable())
33+
message.channel.send(codeBlock('xl', content));
3334
}
3435
}
3536
};

0 commit comments

Comments
 (0)