From 4cc6b5fecc2b70ed3e11e945dbc7058b9d9728d2 Mon Sep 17 00:00:00 2001 From: zkldi <20380519+zkldi@users.noreply.github.com> Date: Wed, 21 Dec 2022 09:10:56 +0000 Subject: [PATCH] fix: make bot able to respond to goal things --- bot/src/utils/apiRequests.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bot/src/utils/apiRequests.ts b/bot/src/utils/apiRequests.ts index 1c202b608..853b6d0a0 100644 --- a/bot/src/utils/apiRequests.ts +++ b/bot/src/utils/apiRequests.ts @@ -43,7 +43,7 @@ export async function GetUGPTStats(userID: integer | string, game: Game, playtyp } export async function GetGoalWithID(goalID: string, game: Game, playtype: Playtype) { - const res = await TachiServerV1Get( + const res = await TachiServerV1Get<{ goal: GoalDocument }>( `/games/${game}/${playtype}/targets/goals/${goalID}`, null ); @@ -52,20 +52,20 @@ export async function GetGoalWithID(goalID: string, game: Game, playtype: Playty throw new Error(`Failed to fetch goal with ID ${goalID}. '${res.description}'.`); } - return res.body; + return res.body.goal; } export async function GetQuestWithID(questID: string, game: Game, playtype: Playtype) { - const res = await TachiServerV1Get( + const res = await TachiServerV1Get<{ quest: QuestDocument }>( `/games/${game}/${playtype}/targets/quests/${questID}`, null ); if (!res.success) { - throw new Error(`Failed to fetch goal with ID ${questID}. '${res.description}'.`); + throw new Error(`Failed to fetch quest with ID ${questID}. '${res.description}'.`); } - return res.body; + return res.body.quest; } export async function GetChartInfoForUser(