Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion #.env.development
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ POSTGRES_PASSWORD=
DATABASE_PORT=5432
DATABASE_HOST=localhost
DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${DATABASE_HOST}:${DATABASE_PORT}/${POSTGRES_DB}?schema=public
SENDGRID_API_KEY=
SMTP2GO_API_KEY=
Comment thread
HunteRoi marked this conversation as resolved.
Outdated
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ POSTGRES_PASSWORD=
DATABASE_PORT=5432
DATABASE_HOST=localhost
DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${DATABASE_HOST}:${DATABASE_PORT}/${POSTGRES_DB}?schema=public
SENDGRID_API_KEY=
SMTP2GO_API_KEY=
```
An empty copy of this file is available as [#.env.development](./#.env.development).

Expand Down
42 changes: 20 additions & 22 deletions biome.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
{
"$schema": "https://biomejs.dev/schemas/1.6.4/schema.json",
"organizeImports": {
"enabled": true
},
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true,
"defaultBranch": "master"
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
},
"formatter": {
"enabled": true,
"indentStyle": "space",
"indentWidth": 4,
"lineEnding": "lf"
}
"$schema": "https://biomejs.dev/schemas/2.2.4/schema.json",
"assist": { "actions": { "source": { "organizeImports": "on" } } },
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true,
"defaultBranch": "master"
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
},
"formatter": {
"enabled": true,
"indentStyle": "space",
"indentWidth": 4,
"lineEnding": "lf"
}
}
4 changes: 2 additions & 2 deletions config.development.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@
},
"communicationServiceOptions": {
"mailData": {
"from": "mdpdevti@henallux.be",
"templateId": "d-c8892944b4f2417bafece2d7a5b73d1f"
"from": "fctienoreplydiscord@henallux.be",
"templateId": "9131196"
}
}
}
4 changes: 2 additions & 2 deletions config.production.json
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@
},
"communicationServiceOptions": {
"mailData": {
"from": "mdpdevti@henallux.be",
"templateId": "d-ae8dfdd7cc9c49f1af6e016ecbb4d856"
"from": "fctienoreplydiscord@henallux.be",
"templateId": "9131196"
}
}
}
43 changes: 23 additions & 20 deletions index.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,31 @@
import { GatewayIntentBits } from "discord.js";
import * as dotenvx from "@dotenvx/dotenvx";
import { GatewayIntentBits } from "discord.js";

import { readConfig } from "./src/config.js";
import { DatadropClient } from "./src/datadrop.js";
import type { Configuration } from "./src/models/Configuration.js";

dotenvx.config({ debug: Boolean(process.env.DEBUG), encoding: "utf-8" });

let client: DatadropClient;
readConfig()
.then(async (config: Configuration) => {
client = new DatadropClient(
{
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildVoiceStates,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.DirectMessages,
],
},
config,
);
const config = await readConfig();

if (!config) throw new Error("No configuration file read; aborting startup.");

const client = new DatadropClient(
{
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildVoiceStates,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.DirectMessages,
],
},
config,
);

await client.start();
})
.catch(() => client?.stop());
try {
await client.start();
} catch (err) {
console.error(err);
await client?.stop();
}
24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "datadrop",
"version": "2.1.0",
"version": "2.1.1",
"type": "module",
"main": "./build/index.js",
"scripts": {
Expand All @@ -23,20 +23,20 @@
},
"homepage": "https://github.com/section-IG/DataDrop#readme",
"dependencies": {
"@dotenvx/dotenvx": "^1.21.1",
"@dotenvx/dotenvx": "^1.51.0",
"@hunteroi/advanced-logger": "^0.2.0",
"@hunteroi/discord-selfrole": "^4.0.4",
"@hunteroi/discord-temp-channels": "^3.3.0",
"@hunteroi/discord-verification": "^1.5.0",
"@sendgrid/mail": "8.1.3",
"discord-sync-commands": "^0.3.0",
"discord.js": "^14.16.2",
"@hunteroi/discord-selfrole": "^4.0.5",
"@hunteroi/discord-temp-channels": "^3.3.1",
"@hunteroi/discord-verification": "^1.5.2",
"smtp2go-nodejs": "^0.3.5",
"discord-sync-commands": "^0.5.2",
"discord.js": "^14.22.1",
"ts-postgres": "1.3.0"
},
"devDependencies": {
"@biomejs/biome": "^1.9.4",
"@types/node": "^20.12.7",
"tsx": "^4.19.2",
"typescript": "^5.4.4"
"@biomejs/biome": "^2.2.4",
"@types/node": "^24.5.2",
"tsx": "^4.20.5",
"typescript": "^5.9.2"
}
}
7 changes: 4 additions & 3 deletions scripts/deploy-commands.cjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
const dotenv = require("dotenv");
const dotenvx = require("@dotenvx/dotenvx");
const { Client, Collection, REST, Routes } = require("discord.js");
const path = require("node:path");
const fsp = require("node:fs/promises");
const synchronizeSlashCommands = require("discord-sync-commands");

const { botId: botProdId } = require("../config.production.json");
const { guildId, botId: botDevId } = require("../config.development.json");

Expand Down Expand Up @@ -65,7 +66,7 @@ async function main(args) {
}

const client = new Client({ intents: [] });
client.once("ready", () => console.log("Ready!"));
client.once("clientReady", () => console.log("Ready!"));
client.once("error", console.error);

const commands = new Collection();
Expand All @@ -90,7 +91,7 @@ async function main(args) {
await client.destroy();
}

dotenv.config({ debug: Boolean(process.env.DEBUG), encoding: "utf-8" });
dotenvx.config({ debug: Boolean(process.env.DEBUG), encoding: "utf-8" });
if (!process.env.DISCORD_TOKEN) {
console.error(
"Error: Please provide a Discord token in the environment variable DISCORD_TOKEN.",
Expand Down
7 changes: 5 additions & 2 deletions src/commands/admins/announce.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ import {
Colors,
EmbedBuilder,
InteractionContextType,
MessageFlags,
PermissionFlagsBits,
SlashCommandBuilder,
type TextChannel,
} from "discord.js";

import type { DatadropClient } from "../../datadrop.js";
import { getErrorMessage } from "../../helpers.js";
import type { Command } from "../../models/Command.js";

export default {
Expand Down Expand Up @@ -63,7 +65,7 @@ export default {
"Ceci est une preview de l'annonce. Voulez-vous l'envoyer?",
components: [row],
embeds: [embed],
ephemeral: true,
flags: MessageFlags.Ephemeral,
});

try {
Expand Down Expand Up @@ -109,7 +111,8 @@ export default {
components: [],
});
}
} catch (e) {
} catch (error) {
client.logger.error(getErrorMessage(error));
await interaction.editReply({
content:
"❌ **Oups!** - Aucune confirmation reçue, annulation...",
Expand Down
5 changes: 3 additions & 2 deletions src/commands/others/link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
ButtonBuilder,
ButtonStyle,
type ChatInputCommandInteraction,
MessageFlags,
SlashCommandBuilder,
} from "discord.js";

Expand All @@ -25,7 +26,7 @@ export default {
await interaction.reply({
content:
"❌ **Oups!** - Tu as déjà lié ton compte Hénallux avec ton compte Discord!",
ephemeral: true,
flags: MessageFlags.Ephemeral,
});
return;
}
Expand All @@ -43,7 +44,7 @@ export default {
await interaction.reply({
content: `Pour lier ton compte, rien de plus simple! Il te suffit de cliquer sur le bouton ci-dessous et remplir le formulaire! Tu recevras un code par email qu'il faudra envoyer ici ensuite!\n⚠️ Nous conservons les informations soumises après utilisation. Si tu soumets tes informations, tu acceptes que celles-ci nous soient transmises et que nous les conservions durant toute la durée de ta présence sur le serveur!`,
components: [buttonComponent],
ephemeral: true,
flags: MessageFlags.Ephemeral,
});
},
} as Command;
79 changes: 0 additions & 79 deletions src/commands/others/pin.ts

This file was deleted.

5 changes: 3 additions & 2 deletions src/commands/owner/eval.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import {
type ChatInputCommandInteraction,
codeBlock,
MessageFlags,
PermissionFlagsBits,
SlashCommandBuilder,
codeBlock,
} from "discord.js";

import type { DatadropClient } from "../../datadrop.js";
Expand Down Expand Up @@ -32,7 +33,7 @@ export default {
await interaction.reply({
content:
"❌ **Oups!** - Vous n'êtes pas autorisé à utiliser cette commande.",
ephemeral: true,
flags: MessageFlags.Ephemeral,
});
return;
}
Expand Down
5 changes: 3 additions & 2 deletions src/commands/owner/reload.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
type ChatInputCommandInteraction,
MessageFlags,
PermissionFlagsBits,
SlashCommandBuilder,
} from "discord.js";
Expand All @@ -24,7 +25,7 @@ export default {
await interaction.reply({
content:
"❌ **Oups!** - Vous n'êtes pas autorisé à utiliser cette commande.",
ephemeral: true,
flags: MessageFlags.Ephemeral,
});
return;
}
Expand All @@ -33,7 +34,7 @@ export default {
await client.reloadConfig();
await interaction.reply({
content: "Rechargement de la configuration en cours... 👌",
ephemeral: true,
flags: MessageFlags.Ephemeral,
});
},
} as Command;
Loading