refactor: improve code quality
This commit is contained in:
@@ -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),
|
||||
],
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user