fix(discord-bot): query active quest of latest in quete command
All checks were successful
Build and Push Docker Image / build (push) Successful in 31s

This commit is contained in:
2026-04-21 22:57:00 +02:00
parent b8a2ecc0df
commit 324c392e1b
2 changed files with 14 additions and 2 deletions

View File

@@ -28,6 +28,18 @@ export const getLatestQuest = async (): Promise<QuestResult> => {
return history[0];
};
export const getActiveQuest = async (): Promise<QuestResult | null> => {
const response = await fetch(
`https://api.wolvesville.com/clans/${env.WOV_CLAN_ID}/quests/active`,
{
method: "GET",
headers: { Authorization: `Bot ${env.WOV_API_KEY}` },
},
);
if (response.status === 404) return null;
return (await response.json()) as QuestResult;
};
export const checkForNewQuest = async (): Promise<QuestResult | null> => {
const lastQuest = await getLatestQuest();
const lastId = lastQuest.quest.id;