refactor: improve code quality

This commit is contained in:
2026-05-12 15:42:21 +02:00
parent 8abdfc3b2f
commit 528fff3a5b
42 changed files with 1756 additions and 1255 deletions

View File

@@ -1,20 +1,27 @@
import { EmbedBuilder } from "discord.js";
import type { Command } from "~/commands";
import { getActiveQuest, getLatestQuest } from "~/services/wov";
import { getActiveQuest, getLatestQuest } from "~/wov";
import { replyError } from "~/discord";
import type { Command } from "./index";
import { noMention } from "~/discord";
export const queteCommand: Command = async (message) => {
const quest = (await getActiveQuest()) ?? (await getLatestQuest());
const color = parseInt(quest.quest.promoImagePrimaryColor.substring(1), 16);
export const queteCommand: Command = {
help: "Affiche la quête en cours ou la dernière quête",
handler: async (message) => {
const quest = (await getActiveQuest()) ?? (await getLatestQuest());
if (!quest) {
await replyError(message, "Impossible de récupérer la quête.");
return;
}
const color = parseInt(quest.quest.promoImagePrimaryColor.substring(1), 16);
await message.channel.send({
allowedMentions: {
repliedUser: false
await message.channel.send({
options: noMention,
embeds: [
new EmbedBuilder()
.setTitle("Quête actuelle")
.setImage(quest.quest.promoImageUrl)
.setColor(color)
],
});
},
embeds: [
new EmbedBuilder()
.setTitle("Quête actuelle")
.setImage(quest.quest.promoImageUrl)
.setColor(color),
],
});
};