feat: Implement interactive quest command allowing users to view active/available quests and accept new ones.

This commit is contained in:
syntaxbullet
2026-01-15 15:30:01 +01:00
parent eb108695d3
commit 9e5c6b5ac3
4 changed files with 212 additions and 14 deletions

View File

@@ -118,5 +118,20 @@ export const questService = {
quest: true,
}
});
},
getAvailableQuests: async (userId: string) => {
const userQuestIds = (await DrizzleClient.query.userQuests.findMany({
where: eq(userQuests.userId, BigInt(userId)),
columns: {
questId: true
}
})).map(uq => uq.questId);
return await DrizzleClient.query.quests.findMany({
where: (quests, { notInArray }) => userQuestIds.length > 0
? notInArray(quests.id, userQuestIds)
: undefined
});
}
};