Initial work on quests

This commit is contained in:
Puyodead1
2025-12-24 23:46:38 -05:00
parent 55b3416957
commit 724ebe1792
54 changed files with 2039 additions and 9 deletions

View File

@@ -13,7 +13,8 @@
"BASE_TYPE_CONSTANT": "This field must be {{value}}",
"EMAIL_TYPE_INVALID_EMAIL": "Not a well-formed email address",
"DATE_TYPE_PARSE": "Could not parse {{date}}. Should be ISO8601",
"BASE_TYPE_BAD_LENGTH": "Must be between {{length}} in length"
"BASE_TYPE_BAD_LENGTH": "Must be between {{length}} in length",
"ENUM_TYPE_COERCE": "Value \"{{value}}\" is not a valid enum value."
},
"body": {
"INVALID_BODY": "Invalid Body",

Binary file not shown.

View File

@@ -51,6 +51,8 @@ export const NO_AUTHORIZATION_ROUTES = [
"GET /policies/instance/",
// Oauth callback
"/oauth2/callback",
// get quest config
/^GET \/quests\/\d+/,
// Asset delivery
/^(GET|HEAD) \/guilds\/\d+\/widget\.(json|png)/,
/^(GET|HEAD) \/guilds\/\d+\/shield\.svg/,

View File

@@ -0,0 +1,86 @@
/*
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
Copyright (C) 2023 Spacebar and Spacebar Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { route } from "@spacebar/api";
import { EntitlementSpecialSourceType, EntitlementType, QuestClaimRewardRequestSchema, QuestClaimRewardResponseSchema } from "@spacebar/schemas/quests";
import { emitEvent } from "@spacebar/util";
import { Request, Response, Router } from "express";
const router = Router({ mergeParams: true });
router.post(
"/",
route({
description:
"Claims the quest's rewards, setting the completed_at and claimed_at fields of the quest user status to the current timestamp. Fires a Quests User Status Update Gateway event.",
requestBody: "QuestClaimRewardRequestSchema",
responses: {
200: {
body: "QuestClaimRewardResponseSchema",
},
},
}),
async (req: Request, res: Response) => {
const { quest_id } = req.params;
const { location, platform } = req.body as QuestClaimRewardRequestSchema;
// TODO: implement
console.debug(`POST /quests/${quest_id}/claim-reward is incomplete`);
await emitEvent({
event: "QUESTS_USER_STATUS_UPDATE",
data: {
user_status: {
claimed_at: null,
claimed_tier: null,
completed_at: null,
dismissed_quest_content: 0,
enrolled_at: new Date().toISOString(),
last_stream_heartbeat_at: null,
progress: {},
quest_id,
stream_progress_seconds: 0,
user_id: req.user.id,
},
},
});
res.json({
claimed_at: new Date().toISOString(),
entitlement_expiration_metadata: {},
entitlements: [
{
id: "1453600390154162249",
sku_id: "1287881739531976815",
application_id: "1287870191526613112",
user_id: req.user.id,
deleted: false,
starts_at: null,
ends_at: null,
type: EntitlementType.QUEST_REWARD,
tenant_metadata: {},
source_type: EntitlementSpecialSourceType.QUEST_REWARD,
gift_code_flags: 0, // PAYMENT_SOURCE_REQUIRED, todo: make a bitfield enum
promotion_id: null,
},
],
errors: [],
} as QuestClaimRewardResponseSchema);
},
);
export default router;

View File

@@ -0,0 +1,62 @@
/*
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
Copyright (C) 2023 Spacebar and Spacebar Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { route } from "@spacebar/api";
import { QuestEnrollRequestSchema, QuestUserStatusSchema } from "@spacebar/schemas";
import { emitEvent } from "@spacebar/util";
import { Request, Response, Router } from "express";
const router = Router({ mergeParams: true });
router.post(
"/",
route({
description: "Accepts a quest and returns a quest user status object. Fires a Quests User Status Update Gateway event.",
requestBody: "QuestEnrollRequestSchema",
}),
async (req: Request, res: Response) => {
const { quest_id } = req.params;
const { location } = req.body as QuestEnrollRequestSchema;
// TODO: implement
console.debug(`POST /quests/${quest_id}/enroll is incomplete`);
const status: QuestUserStatusSchema = {
claimed_at: null,
claimed_tier: null,
completed_at: null,
dismissed_quest_content: 0,
enrolled_at: new Date().toISOString(),
last_stream_heartbeat_at: null,
progress: {},
quest_id,
stream_progress_seconds: 0,
user_id: req.user.id,
};
await emitEvent({
event: "QUESTS_USER_STATUS_UPDATE",
data: {
user_status: status,
},
});
res.json(status);
},
);
export default router;

View File

@@ -0,0 +1,141 @@
/*
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
Copyright (C) 2023 Spacebar and Spacebar Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { route } from "@spacebar/api";
import { QuestAssignmentMethod, QuestConfigResponseSchema, QuestEventType, QuestFeature, QuestPlatformType, QuestRewardType, QuestSharePolicy } from "@spacebar/schemas";
import { Request, Response, Router } from "express";
const router = Router({ mergeParams: true });
router.get(
"/",
route({
description: "Returns a quest config object for the specified quest. Quest must be currently active.",
responses: {
200: {
body: "QuestConfigResponseSchema",
},
},
}),
async (req: Request, res: Response) => {
const { quest_id } = req.params;
// TODO: implement
console.debug(`GET /quests/${quest_id} is incomplete`);
// just a dummy response for now
res.json({
id: "1333839522189938740",
config_version: 2,
starts_at: "2025-07-14T14:00:00+00:00",
expires_at: "2099-08-15T23:00:00+00:00",
features: [QuestFeature.QUEST_BAR_V2, QuestFeature.REWARD_HIGHLIGHTING, QuestFeature.DISMISSAL_SURVEY, QuestFeature.QUESTS_CDN, QuestFeature.PACING_CONTROLLER],
application: {
link: "https://spacebar.chat",
id: "545364944258990091",
name: "Spacebar",
},
colors: {
primary: "#5865F2",
secondary: "#000000",
},
assets: {
hero: "quests/1333839522189938740/orbs_quest_card_banner_4.jpeg",
hero_video: null,
quest_bar_hero: "quests/1333839522189938740/orbs_quest_bar.png",
quest_bar_hero_video: null,
game_tile: "discord_game_tile.png",
logotype: "discord_logo.png",
game_tile_light: "quests/1333839522189938740/1417603112168067182.png",
game_tile_dark: "quests/1333839522189938740/1417603112742551603.png",
logotype_light: "quests/1333839522189938740/1417603113304719540.png",
logotype_dark: "quests/1333839522189938740/1417603113791131668.png",
},
messages: {
quest_name: "Spacebar Bars Intro",
game_title: "Spacebar",
game_publisher: "Spacebar",
},
task_config_v2: {
tasks: {
[QuestEventType.WATCH_VIDEO]: {
type: QuestEventType.WATCH_VIDEO,
target: 31,
assets: {
video: {
url: "quests/1410358070831480904/1420884840815005717_1080.mp4",
width: 1080,
height: 1920,
thumbnail: "quests/1410358070831480904/1421253196549984267.png",
caption: "quests/1410358070831480904/1410370389451866112.vtt",
transcript: "quests/1410358070831480904/1410370413032374293.txt",
},
video_low_res: {
url: "quests/1410358070831480904/1420884840815005717_720.mp4",
width: 1080,
height: 1920,
thumbnail: "quests/1410358070831480904/1421253196549984267.png",
caption: "quests/1410358070831480904/1410370389451866112.vtt",
transcript: "quests/1410358070831480904/1410370413032374293.txt",
},
video_hls: {
url: "quests/1410358070831480904/1420884840815005717.m3u8",
width: 1080,
height: 1920,
thumbnail: "quests/1410358070831480904/1421253196549984267.png",
caption: "quests/1410358070831480904/1410370389451866112.vtt",
transcript: "quests/1410358070831480904/1410370413032374293.txt",
},
},
messages: {
video_title: "Intro to Spacebar Bars",
// video_end_cta_title: "Learn more about Bars",
// video_end_cta_subtitle: "Head to our Help Center for more information.",
},
},
},
join_operator: "or",
},
rewards_config: {
assignment_method: QuestAssignmentMethod.ALL,
rewards: [
{
type: QuestRewardType.VIRTUAL_CURRENCY,
sku_id: "1287881739531976815",
messages: {
name: "150 Bars",
name_with_article: "150 Bars",
redemption_instructions_by_platform: {
[QuestPlatformType.CROSS_PLATFORM]: "Default",
},
},
orb_quantity: 150,
},
],
rewards_expire_at: "2099-02-01T00:00:27+00:00",
platforms: [QuestPlatformType.CROSS_PLATFORM],
},
share_policy: QuestSharePolicy.SHAREABLE_EVERYWHERE,
cta_config: {
link: "https://spacebar.chat",
button_label: "Learn More",
subtitle: "Head to our Help Center for more information.",
},
} as QuestConfigResponseSchema);
},
);
export default router;

View File

@@ -0,0 +1,50 @@
/*
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
Copyright (C) 2023 Spacebar and Spacebar Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { route } from "@spacebar/api";
import { QuestPlatformType, QuestRewardCodeResponseSchema } from "@spacebar/schemas/quests";
import { Request, Response, Router } from "express";
const router = Router({ mergeParams: true });
router.get(
"/",
route({
description: "Retrieves the reward code for the specified platform. Returns a quest reward code object on success.",
responses: {
200: {
body: "QuestRewardCodeResponseSchema",
},
},
}),
async (req: Request, res: Response) => {
const { quest_id } = req.params;
// TODO: implement
console.debug(`GET /quests/${quest_id}/reward-code is incomplete`);
res.json({
quest_id,
claimed_at: "2025-08-01T12:00:00+00:00",
code: "REWARD-CODE-1234",
platform: QuestPlatformType.CROSS_PLATFORM,
user_id: req.user.id,
} as QuestRewardCodeResponseSchema);
},
);
export default router;

View File

@@ -0,0 +1,68 @@
/*
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
Copyright (C) 2023 Spacebar and Spacebar Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { route } from "@spacebar/api";
import { QuestUserStatusSchema, QuestVideoProgressRequestSchema } from "@spacebar/schemas/quests";
import { emitEvent } from "@spacebar/util";
import { Request, Response, Router } from "express";
const router = Router({ mergeParams: true });
router.post(
"/",
route({
description:
"Tells the server to update the value field of the current video task. Used for keeping track of how long the video has been watched for, and for checking if the user has met the task duration requirement. Returns a quest user status object on success. Fires a Quests User Status Update Gateway event.",
requestBody: "QuestVideoProgressRequestSchema",
responses: {
200: {
body: "QuestVideoProgressResponseSchema",
},
},
}),
async (req: Request, res: Response) => {
const { quest_id } = req.params;
const { timestamp } = req.body as QuestVideoProgressRequestSchema;
// TODO: implement
console.debug(`POST /quests/${quest_id}/video-progress is incomplete`);
const status: QuestUserStatusSchema = {
claimed_at: null,
claimed_tier: null,
completed_at: null,
dismissed_quest_content: 0,
enrolled_at: new Date().toISOString(),
last_stream_heartbeat_at: null,
progress: {},
quest_id,
stream_progress_seconds: 0,
user_id: req.user.id,
};
await emitEvent({
event: "QUESTS_USER_STATUS_UPDATE",
data: {
user_status: status,
},
});
res.json(status);
},
);
export default router;

View File

@@ -0,0 +1,340 @@
/*
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
Copyright (C) 2023 Spacebar and Spacebar Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { route } from "@spacebar/api";
import { ClaimedQuestsResponseSchema, QuestAssignmentMethod, QuestEventType, QuestFeature, QuestPlatformType, QuestRewardType, QuestSharePolicy } from "@spacebar/schemas";
import { QuestsResponseSchema } from "@spacebar/schemas/responses";
import { Request, Response, Router } from "express";
const router = Router({ mergeParams: true });
router.get(
"/",
route({
description: "Returns information on the current quests for the current user.",
responses: {
200: {
body: "QuestsResponseSchema",
},
},
}),
async (req: Request, res: Response) => {
// TODO: pull quests from config
console.debug("GET /quests/@me is incomplete");
res.json({
excluded_quests: [],
quest_enrollment_blocked_until: null,
quests: [
{
id: "1333839522189938740",
config: {
id: "1333839522189938740",
config_version: 2,
starts_at: "2025-07-14T14:00:00+00:00",
expires_at: "2099-08-15T23:00:00+00:00",
features: [
QuestFeature.QUEST_BAR_V2,
QuestFeature.REWARD_HIGHLIGHTING,
QuestFeature.DISMISSAL_SURVEY,
QuestFeature.QUESTS_CDN,
QuestFeature.PACING_CONTROLLER,
],
application: {
link: "https://spacebar.chat",
id: "545364944258990091",
name: "Spacebar",
},
colors: {
primary: "#5865F2",
secondary: "#000000",
},
assets: {
hero: "quests/1333839522189938740/orbs_quest_card_banner_4.jpeg",
hero_video: null,
quest_bar_hero: "quests/1333839522189938740/orbs_quest_bar.png",
quest_bar_hero_video: null,
game_tile: "discord_game_tile.png",
logotype: "discord_logo.png",
game_tile_light: "quests/1333839522189938740/1417603112168067182.png",
game_tile_dark: "quests/1333839522189938740/1417603112742551603.png",
logotype_light: "quests/1333839522189938740/1417603113304719540.png",
logotype_dark: "quests/1333839522189938740/1417603113791131668.png",
},
messages: {
quest_name: "Spacebar Bars Intro",
game_title: "Spacebar",
game_publisher: "Spacebar",
},
task_config_v2: {
tasks: {
[QuestEventType.WATCH_VIDEO]: {
type: QuestEventType.WATCH_VIDEO,
target: 31,
assets: {
video: {
url: "quests/1410358070831480904/1420884840815005717_1080.mp4",
width: 1080,
height: 1920,
thumbnail: "quests/1410358070831480904/1421253196549984267.png",
caption: "quests/1410358070831480904/1410370389451866112.vtt",
transcript: "quests/1410358070831480904/1410370413032374293.txt",
},
video_low_res: {
url: "quests/1410358070831480904/1420884840815005717_720.mp4",
width: 1080,
height: 1920,
thumbnail: "quests/1410358070831480904/1421253196549984267.png",
caption: "quests/1410358070831480904/1410370389451866112.vtt",
transcript: "quests/1410358070831480904/1410370413032374293.txt",
},
video_hls: {
url: "quests/1410358070831480904/1420884840815005717.m3u8",
width: 1080,
height: 1920,
thumbnail: "quests/1410358070831480904/1421253196549984267.png",
caption: "quests/1410358070831480904/1410370389451866112.vtt",
transcript: "quests/1410358070831480904/1410370413032374293.txt",
},
},
messages: {
video_title: "Intro to Spacebar Bars",
// video_end_cta_title: "Learn more about Bars",
// video_end_cta_subtitle: "Head to our Help Center for more information.",
},
},
},
join_operator: "or",
},
rewards_config: {
assignment_method: QuestAssignmentMethod.ALL,
rewards: [
{
type: QuestRewardType.VIRTUAL_CURRENCY,
sku_id: "1287881739531976815",
messages: {
name: "150 Bars",
name_with_article: "150 Bars",
redemption_instructions_by_platform: {
[QuestPlatformType.CROSS_PLATFORM]: "Default",
},
},
orb_quantity: 150,
},
],
rewards_expire_at: "2099-02-01T00:00:27+00:00",
platforms: [QuestPlatformType.CROSS_PLATFORM],
},
share_policy: QuestSharePolicy.SHAREABLE_EVERYWHERE,
cta_config: {
link: "https://spacebar.chat",
button_label: "Learn More",
subtitle: "Head to our Help Center for more information.",
},
},
// user_status: {
// user_id: "498989696412549120",
// quest_id: "1333839522189938740",
// enrolled_at: "2025-07-14T21:20:04.640772+00:00",
// completed_at: "2025-07-14T21:21:05.941315+00:00",
// claimed_at: "2025-07-14T21:21:26.983570+00:00",
// claimed_tier: null,
// last_stream_heartbeat_at: null,
// stream_progress_seconds: 0,
// dismissed_quest_content: 0,
// progress: {
// WATCH_VIDEO: {
// value: 31,
// event_name: "WATCH_VIDEO",
// updated_at: "2025-07-14T21:21:05.941317+00:00",
// completed_at: "2025-07-14T21:21:05.941315+00:00",
// heartbeat: null,
// },
// },
// },
user_status: null,
},
{
id: "1410358070831480904",
config: {
id: "1410358070831480904",
config_version: 2,
starts_at: "2025-11-17T16:30:27+00:00",
expires_at: "2099-01-02T00:00:27+00:00",
features: [
QuestFeature.QUEST_BAR_V2,
QuestFeature.REWARD_HIGHLIGHTING,
QuestFeature.DISMISSAL_SURVEY,
QuestFeature.MOBILE_QUEST_DOCK,
QuestFeature.QUESTS_CDN,
QuestFeature.PACING_CONTROLLER,
QuestFeature.VIDEO_QUEST_FORCE_HLS_VIDEO,
QuestFeature.VIDEO_QUEST_FORCE_END_CARD_CTA_SWAP,
QuestFeature.MOBILE_ONLY_QUEST_PUSH_TO_MOBILE,
],
application: {
link: "https://spacebar.chat",
id: "545364944258990091",
name: "Spacebar",
},
assets: {
hero: "quests/1410358070831480904/1440427094801911919.jpg",
hero_video: null,
quest_bar_hero: "quests/1410358070831480904/1440368088196579358.jpg",
quest_bar_hero_video: null,
game_tile: "687100d5-5958-43aa-b221-dfe4f2b79e14.png",
logotype: "0c58c77e-4ab4-482e-b784-ea4646b992ca.png",
game_tile_light: "quests/1410358070831480904/1417602409018163210.png",
game_tile_dark: "quests/1410358070831480904/1417602409668153406.png",
logotype_light: "quests/1410358070831480904/1417602410142105680.png",
logotype_dark: "quests/1410358070831480904/1417602410733375498.png",
},
colors: {
primary: "#4752C4",
secondary: "#000000",
},
messages: {
quest_name: "Mobile Bars Intro",
game_title: "Earn from Quests. Spend in Shop. Reward Your Play.",
game_publisher: "Spacebar",
},
// task_config: {
// type: 1,
// join_operator: "or",
// tasks: {
// WATCH_VIDEO_ON_MOBILE: {
// event_name: "WATCH_VIDEO_ON_MOBILE",
// target: 31,
// external_ids: [],
// },
// },
// },
task_config_v2: {
tasks: {
[QuestEventType.WATCH_VIDEO_ON_MOBILE]: {
type: QuestEventType.WATCH_VIDEO_ON_MOBILE,
target: 31,
assets: {
video: {
url: "quests/1410358070831480904/1420884840815005717_1080.mp4",
width: 1080,
height: 1920,
thumbnail: "quests/1410358070831480904/1421253196549984267.png",
caption: "quests/1410358070831480904/1410370389451866112.vtt",
transcript: "quests/1410358070831480904/1410370413032374293.txt",
},
video_low_res: {
url: "quests/1410358070831480904/1420884840815005717_720.mp4",
width: 1080,
height: 1920,
thumbnail: "quests/1410358070831480904/1421253196549984267.png",
caption: "quests/1410358070831480904/1410370389451866112.vtt",
transcript: "quests/1410358070831480904/1410370413032374293.txt",
},
video_hls: {
url: "quests/1410358070831480904/1420884840815005717.m3u8",
width: 1080,
height: 1920,
thumbnail: "quests/1410358070831480904/1421253196549984267.png",
caption: "quests/1410358070831480904/1410370389451866112.vtt",
transcript: "quests/1410358070831480904/1410370413032374293.txt",
},
},
messages: {
video_title: "Intro to Spacebar Bars",
// video_end_cta_title: "Learn more about Bars",
// video_end_cta_subtitle: "Head to our Help Center for more information.",
},
},
},
join_operator: "or",
},
rewards_config: {
assignment_method: QuestAssignmentMethod.ALL,
rewards: [
{
type: QuestRewardType.VIRTUAL_CURRENCY,
sku_id: "1287881739531976815",
messages: {
name: "150 Bars",
name_with_article: "150 Bars",
redemption_instructions_by_platform: {
[QuestPlatformType.CROSS_PLATFORM]: "Default",
},
},
orb_quantity: 150,
},
],
rewards_expire_at: "2099-02-01T00:00:27+00:00",
platforms: [QuestPlatformType.CROSS_PLATFORM],
},
share_policy: QuestSharePolicy.SHAREABLE_EVERYWHERE,
cta_config: {
link: "https://spacebar.chat",
button_label: "Learn More",
subtitle: "Head to our Help Center for more information.",
},
},
// user_status: {
// user_id: "498989696412549120",
// quest_id: "1410358070831480904",
// enrolled_at: "2025-11-19T04:17:07.950593+00:00",
// completed_at: "2025-11-19T04:17:45.920547+00:00",
// claimed_at: "2025-11-19T04:17:51.972621+00:00",
// claimed_tier: null,
// last_stream_heartbeat_at: null,
// stream_progress_seconds: 0,
// dismissed_quest_content: 0,
// progress: {
// WATCH_VIDEO_ON_MOBILE: {
// value: 31,
// event_name: "WATCH_VIDEO_ON_MOBILE",
// updated_at: "2025-11-19T04:17:45.920548+00:00",
// completed_at: "2025-11-19T04:17:45.920547+00:00",
// heartbeat: null,
// },
// },
// },
user_status: null,
targeted_content: [],
preview: false,
},
],
} as QuestsResponseSchema);
},
);
router.get(
"/claimed",
route({
description: "Returns information on the claimed quests for the current user.",
responses: {
200: {
body: "ClaimedQuestsResponseSchema",
},
},
}),
async (req: Request, res: Response) => {
// TODO: implement
res.json({
quests: [],
} as ClaimedQuestsResponseSchema);
},
);
export default router;

View File

@@ -0,0 +1,63 @@
/*
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
Copyright (C) 2023 Spacebar and Spacebar Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { route } from "@spacebar/api";
import { QuestPlacementArea, QuestPlacementResponseSchema } from "@spacebar/schemas";
import { FieldErrors } from "@spacebar/util";
import { Request, Response, Router } from "express";
const router = Router({ mergeParams: true });
router.get(
"/",
route({
description: "Returns the sponsored quest that should be shown to the user in a specific placement.",
query: {
placement: {
type: "number",
description: "The quest placement area to get the quest for",
},
client_heartbeat_session_id: {
type: "string",
description: "A client-generated UUID representing the current persisted analytics heartbeat",
},
},
responses: {
200: {
body: "QuestPlacementResponseSchema",
},
},
}),
async (req: Request, res: Response) => {
const { placement, client_heartbeat_session_id } = req.query;
// check if placement is a valid QuestPlacementArea
if (!Object.values(QuestPlacementArea).includes(placement as unknown as number)) {
throw FieldErrors({
placement: {
code: "ENUM_TYPE_COERCE",
message: req.t("common:field.ENUM_TYPE_COERCE", {
value: placement,
}),
},
});
}
res.json({} as QuestPlacementResponseSchema);
},
);
export default router;

View File

@@ -0,0 +1,39 @@
/*
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
Copyright (C) 2023 Spacebar and Spacebar Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { route } from "@spacebar/api";
import { Request, Response, Router } from "express";
const router = Router({ mergeParams: true });
router.get(
"/",
route({
responses: {
200: {
body: "VirtualCurrencyResponseSchema",
},
},
}),
async (req: Request, res: Response) => {
res.json({
balance: req.user.currency,
});
},
);
export default router;

View File

@@ -17,9 +17,10 @@
*/
export * from "./api";
export * from "./gateway";
export * from "./responses";
export * from "./uncategorised";
export * from "./webrtc";
export * from "./HelperTypes";
export * from "./Identifiers";
export * from "./quests";
export * from "./responses";
export * from "./uncategorised";
export * from "./Validator";
export * from "./webrtc";

View File

@@ -0,0 +1,26 @@
/*
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
Copyright (C) 2025 Spacebar and Spacebar Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { QuestConfigSchema } from "./QuestConfigSchema";
import { QuestUserStatusSchema } from "./QuestUserStatusSchema";
export interface ClaimedQuestSchema {
id: string;
config: QuestConfigSchema;
user_status: QuestUserStatusSchema;
}

View File

@@ -0,0 +1,30 @@
/*
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
Copyright (C) 2023 Spacebar and Spacebar Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
export interface QuestAdIdentifiersSchema {
// The ID of the advertisement campaign
campaign_id: string;
// The ID of the advertisement set
ad_set_id: string;
// The ID of the advertisement
ad_id: string;
// The ID of the advertisement creative
creative_id: string;
// The type of advertisement creative
creative_type: string;
}

View File

@@ -0,0 +1,26 @@
/*
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
Copyright (C) 2023 Spacebar and Spacebar Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
export interface QuestApplicationSchema {
// The ID of the application
id: string;
// The link to the game's page
link?: string;
// The name of the application
name: string;
}

View File

@@ -0,0 +1,22 @@
/*
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
Copyright (C) 2025 Spacebar and Spacebar Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
export enum QuestAssignmentMethod {
ALL = 1,
TIERED,
}

View File

@@ -0,0 +1,24 @@
/*
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
Copyright (C) 2025 Spacebar and Spacebar Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { QuestPlatformType } from "./QuestPlatformType";
export interface QuestClaimRewardRequestSchema {
location: number; // https://docs.discord.food/resources/quests#quest-content-type
platform: QuestPlatformType;
}

View File

@@ -0,0 +1,77 @@
/*
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
Copyright (C) 2023 Spacebar and Spacebar Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { QuestRewardConfigSchema } from "./QuestRewardConfigSchema";
import { QuestFeature, QuestSharePolicy } from ".";
import { QuestApplicationSchema } from "./QuestApplicationSchema";
import { QuestTaskConfigV2Schema } from "./QuestTaskConfigV2Schema";
export interface QuestConfigSchema {
id: string;
config_version: number; // as of now (12/24/2025) its 2
starts_at: string; // ISO date
expires_at: string; // ISO date
features: QuestFeature[];
application: QuestApplicationSchema;
assets: {
// The quest's hero image
hero: string | null;
// A video representation of the hero image
hero_video?: string | null;
// The hero image used in the quest popup that appears when launching the game before accepting the quest
quest_bar_hero: string | null;
// A video representation of the quest bar hero image
quest_bar_hero_video?: string | null;
// The game's icon
game_tile: string | null;
game_tile_dark: string | null;
game_tile_light: string | null;
// The game's logo
logotype: string | null;
logotype_dark: string | null;
logotype_light: string | null;
};
colors: {
primary: string; // hex color
secondary: string; // hex color
};
messages: {
// The name of the quest
quest_name: string;
// The title of the game the quest is for
game_title: string;
// The publisher of the game the quest is for
game_publisher: string;
};
task_config?: unknown; // seems to be unused now in favor of task_config_v2
task_config_v2: QuestTaskConfigV2Schema;
rewards_config: QuestRewardConfigSchema;
share_policy: QuestSharePolicy;
cta_config: {
button_label: string;
link: string;
subtitle?: string;
android?: {
android_app_id: string;
};
ios?: {
ios_app_id: string;
};
};
}

View File

@@ -0,0 +1,24 @@
/*
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
Copyright (C) 2025 Spacebar and Spacebar Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
export interface QuestEnrollRequestSchema {
location: number; // https://docs.discord.food/resources/quests#quest-content-
is_targeted?: boolean;
metadata_raw?: string | null;
metadata_sealed?: string | null;
}

View File

@@ -0,0 +1,24 @@
/*
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
Copyright (C) 2023 Spacebar and Spacebar Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
export interface QuestEntitlementExpirationMetadataSchema {
// Whether the entitlement expiration has been extended due to a premium subscription
extended: boolean;
// Whether the entitlement expiration can be extended due to a premium subscription
extendable: boolean;
}

View File

@@ -0,0 +1,30 @@
/*
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
Copyright (C) 2025 Spacebar and Spacebar Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
export enum QuestEventType {
STREAM_ON_DESKTOP = "STREAM_ON_DESKTOP",
PLAY_ON_DESKTOP = "PLAY_ON_DESKTOP",
PLAY_ON_XBOX = "PLAY_ON_XBOX",
PLAY_ON_PLAYSTATION = "PLAY_ON_PLAYSTATION",
PLAY_ON_DESKTOP_V2 = "PLAY_ON_DESKTOP_V2",
WATCH_VIDEO = "WATCH_VIDEO",
WATCH_VIDEO_ON_MOBILE = "WATCH_VIDEO_ON_MOBILE",
PLAY_ACTIVITY = "PLAY_ACTIVITY",
ACHIEVEMENT_IN_GAME = "ACHIEVEMENT_IN_GAME",
ACHIEVEMENT_IN_ACTIVITY = "ACHIEVEMENT_IN_ACTIVITY",
}

View File

@@ -0,0 +1,53 @@
/*
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
Copyright (C) 2025 Spacebar and Spacebar Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
export enum QuestFeature {
POST_ENROLLMENT_CTA = 1,
QUEST_BAR_V2 = 3,
EXCLUDE_MINORS = 4, // removed from the client apparently
EXCLUDE_RUSSIA = 5,
IN_HOUSE_CONSOLE_QUEST = 6,
MOBILE_CONSOLE_QUEST = 7,
START_QUEST_CTA = 8,
REWARD_HIGHLIGHTING = 9,
FRACTIONS_QUEST = 10,
ADDITIONAL_REDEMPTION_INSTRUCTIONS = 11,
PACING_V2 = 12,
DISMISSAL_SURVEY = 13,
MOBILE_QUEST_DOCK = 14,
QUESTS_CDN = 15,
PACING_CONTROLLER = 16,
QUEST_HOME_FORCE_STATIC_IMAGE = 17,
VIDEO_QUEST_FORCE_HLS_VIDEO = 18,
VIDEO_QUEST_FORCE_END_CARD_CTA_SWAP = 19,
EXPERIMENTAL_TARGETING_TRAITS = 20,
DO_NOT_DISPLAY = 21,
EXTERNAL_DIALOG = 22,
MOBILE_ONLY_QUEST_PUSH_TO_MOBILE = 23,
MANUAL_HEARTBEAT_INITIALIZATION = 24,
CLOUD_GAMING_ACTIVITY = 25,
NON_GAMING_PLAY_QUEST = 26,
ACTIVITY_QUEST_AUTO_ENROLLMENT = 27,
PACKAGE_ACTION_ADVENTURE = 28,
PACKAGE_RPG_MMO = 29,
PACKAGE_RACING_SPORTS = 30,
PACKAGE_SANDBOX_CREATIVE = 31,
PACKAGE_FAMILY_FRIENDLY = 32,
PACKAGE_HOLIDAY_SEASON = 33,
PACKAGE_NEW_YEARS = 34,
}

View File

@@ -0,0 +1,22 @@
/*
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
Copyright (C) 2025 Spacebar and Spacebar Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
export enum QuestJoinOperator {
AND = "and",
OR = "or",
}

View File

@@ -0,0 +1,24 @@
/*
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
Copyright (C) 2025 Spacebar and Spacebar Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
export enum QuestPlacementArea {
// Account panel on desktop
DESKTOP_ACCOUNT_PANEL_AREA = 1,
// Home dock on mobile
MOBILE_HOME_DOCK_AREA,
}

View File

@@ -0,0 +1,25 @@
/*
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
Copyright (C) 2025 Spacebar and Spacebar Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
export enum QuestPlatformType {
CROSS_PLATFORM = 0,
XBOX,
PLAYSTATION,
SWITCH,
PC,
}

View File

@@ -0,0 +1,34 @@
/*
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
Copyright (C) 2023 Spacebar and Spacebar Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { QuestPlatformType } from ".";
export interface QuestRewardCodeSchema {
// The ID of the quest
quest_id: string;
// The redeem code
code: string;
// The platform this redeem code applies to
platform: QuestPlatformType;
// The ID of the user who this code belongs to
user_id: string;
// When the user claimed the quest's reward
claimed_at: string;
// Which reward tier the code belongs to, if the quest's assignment_method is set to TIERED
tier: number | null;
}

View File

@@ -0,0 +1,28 @@
/*
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
Copyright (C) 2023 Spacebar and Spacebar Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { QuestAssignmentMethod } from "./QuestAssignmentMethod";
import { QuestPlatformType } from "./QuestPlatformType";
import { QuestRewardSchema } from "./QuestRewardSchema";
export interface QuestRewardConfigSchema {
assignment_method: QuestAssignmentMethod;
platforms: QuestPlatformType[];
rewards: QuestRewardSchema[];
rewards_expire_at: string; // ISO8601 timestamp
}

View File

@@ -0,0 +1,23 @@
/*
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
Copyright (C) 2025 Spacebar and Spacebar Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
export enum QuestRewardExpirationMode {
NORMAL = 1,
PREMIUM_EXTENSION,
PREMIUM_PERMANENT,
}

View File

@@ -0,0 +1,46 @@
/*
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
Copyright (C) 2023 Spacebar and Spacebar Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { QuestRewardExpirationMode } from "./QuestRewardExpirationMode";
import { QuestRewardType } from "./QuestRewardType";
export interface QuestRewardSchema {
type: QuestRewardType;
sku_id: string;
asset?: string;
asset_video?: string | null;
messages: {
name: string;
name_with_article: string;
redemption_instructions_by_platform: Record<string, string>;
};
// An approximate count of how many users can claim the reward
approximate_count?: number | null;
// The link to redeem the reward
redemption_link?: string | null;
// When the reward expires
expires_at?: string | null;
// When the reward expires for premium users
expires_at_premium?: string | null;
// The expiration mode
expiration_mode?: QuestRewardExpirationMode;
// The amount of virtual currency awarded
orb_quantity?: number;
// The days of fractional premium awarded
quantity?: number;
}

View File

@@ -0,0 +1,25 @@
/*
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
Copyright (C) 2025 Spacebar and Spacebar Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
export enum QuestRewardType {
REWARD_CODE = 1,
IN_GAME,
COLLECTIBLE,
VIRTUAL_CURRENCY,
FRACTIONAL_PREMIUM,
}

View File

@@ -0,0 +1,33 @@
/*
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
Copyright (C) 2023 Spacebar and Spacebar Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { QuestConfigSchema } from "./QuestConfigSchema";
import { QuestUserStatusSchema } from "./QuestUserStatusSchema";
export interface QuestSchema {
// The ID of the quest
id: string;
// The configuration and metadata for the quest
config: QuestConfigSchema;
// Whether the quest is unreleased and in preview for Discord employees
preview: boolean;
// The content areas where the quest can be shown, deprecated
targeted_content: unknown[];
// The user's quest progress, if it has been accepted
user_status: null | QuestUserStatusSchema;
}

View File

@@ -0,0 +1,22 @@
/*
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
Copyright (C) 2025 Spacebar and Spacebar Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
export enum QuestSharePolicy {
SHAREABLE_EVERYWHERE = "shareable_everywhere",
NOT_SHAREABLE = "not_shareable",
}

View File

@@ -0,0 +1,25 @@
/*
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
Copyright (C) 2023 Spacebar and Spacebar Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { QuestEventType, QuestJoinOperator } from ".";
import { QuestTaskSchema } from "./QuestTaskSchema";
export interface QuestTaskConfigV2Schema {
join_operator: QuestJoinOperator;
tasks: Partial<Record<QuestEventType, QuestTaskSchema>>;
}

View File

@@ -0,0 +1,40 @@
/*
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
Copyright (C) 2023 Spacebar and Spacebar Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { QuestEventType } from ".";
import { QuestVideoAssetSchema } from "./QuestVideoAssetSchema";
export interface QuestTaskSchema {
type: QuestEventType;
target: number; // seconds the task requires
assets?: {
video: QuestVideoAssetSchema; // pretty sure this is always present
video_low_res?: QuestVideoAssetSchema;
video_hls?: QuestVideoAssetSchema;
}; // WATCH_VIDEO, WATCH_VIDEO_ON_MOBILE
applications?: {
id: string;
}[]; // All except watch video types
external_ids?: string[]; // game id on the external platform im pretty sure. PLAY_ON_XBOX, PLAY_ON_PLAYSTATION
messages?: {
video_title?: string; // WATCH_VIDEO, WATCH_VIDEO_ON_MOBILE
task_title?: string; // ACHIEVEMENT_IN_GAME, ACHIEVEMENT_IN_ACTIVITY
task_description?: string; // ACHIEVEMENT_IN_GAME, ACHIEVEMENT_IN_ACTIVITY
}; // ACHIEVEMENT_IN_GAME, ACHIEVEMENT_IN_ACTIVITY, WATCH_VIDEO, WATCH_VIDEO_ON_MOBILE
event_name?: string; // ?? seems to be used in a request. ACHIEVEMENT_IN_GAME, ACHIEVEMENT_IN_ACTIVITY
}

View File

@@ -0,0 +1,30 @@
/*
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
Copyright (C) 2023 Spacebar and Spacebar Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { QuestEventType } from ".";
export interface QuestUserStatusProgressSchema {
value: number;
event_name: QuestEventType;
updated_at: string; // ISO8601 timestamp
completed_at: string | null; // ISO8601 timestamp
heartbeat: {
last_beat_at: string; // ISO8601 timestamp
expires_at: null | string; // ISO8601 timestamp
} | null;
}

View File

@@ -0,0 +1,42 @@
/*
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
Copyright (C) 2023 Spacebar and Spacebar Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { QuestUserStatusProgressSchema } from "./QuestUserStatusProgressSchema";
export interface QuestUserStatusSchema {
// The ID of the user
user_id: string;
// The ID of the quest
quest_id: string;
// When the user accepted the quest
enrolled_at: null | string;
// When the user completed the quest
completed_at: null | string;
// When the user claimed the quest's reward
claimed_at: null | string;
// Which reward tier the user has claimed, if the quest's assignment_method is TIERED
claimed_tier?: number | null;
// When the last heartbeat was received. only used for quest config version 1, where the event is always STREAM_ON_DESKTOP.
last_stream_heartbeat_at?: null | string;
// Duration (in seconds) the user has streamed the game for since the quest was accepted. only used for quest config version 1, where the event is always STREAM_ON_DESKTOP.
stream_progress_seconds: number;
// The content areas the user has dismissed for the quest
dismissed_quest_content?: number;
// The user's progress for each task in the quest, keyed by their event name
progress?: Record<string, QuestUserStatusProgressSchema>; // ive only seen this for watch video, watch video on mobile, and play on desktop
}

View File

@@ -0,0 +1,26 @@
/*
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
Copyright (C) 2023 Spacebar and Spacebar Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
export interface QuestVideoAssetSchema {
url: string;
width: number;
height: number;
thumbnail: string;
caption?: string;
transcript?: string;
}

View File

@@ -0,0 +1,22 @@
/*
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
Copyright (C) 2025 Spacebar and Spacebar Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
export interface QuestVideoProgressRequestSchema {
// How far into the video the user is (in seconds)
timestamp: number;
}

View File

@@ -0,0 +1,44 @@
/*
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
Copyright (C) 2025 Spacebar and Spacebar Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
export * from "./ClaimedQuestSchema";
export * from "./QuestAdIdentifiersSchema";
export * from "./QuestApplicationSchema";
export * from "./QuestAssignmentMethod";
export * from "./QuestClaimRewardRequestSchema";
export * from "./QuestConfigSchema";
export * from "./QuestEnrollRequestSchema";
export * from "./QuestEntitlementExpirationMetadataSchema";
export * from "./QuestEventType";
export * from "./QuestFeature";
export * from "./QuestJoinOperator";
export * from "./QuestPlacementArea";
export * from "./QuestPlatformType";
export * from "./QuestRewardCodeSchema";
export * from "./QuestRewardConfigSchema";
export * from "./QuestRewardExpirationMode";
export * from "./QuestRewardSchema";
export * from "./QuestRewardType";
export * from "./QuestSchema";
export * from "./QuestSharePolicy";
export * from "./QuestTaskConfigV2Schema";
export * from "./QuestTaskSchema";
export * from "./QuestUserStatusProgressSchema";
export * from "./QuestUserStatusSchema";
export * from "./QuestVideoAssetSchema";
export * from "./QuestVideoProgressRequestSchema";

View File

@@ -0,0 +1,23 @@
/*
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
Copyright (C) 2023 Spacebar and Spacebar Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { ClaimedQuestSchema } from "@spacebar/schemas";
export interface ClaimedQuestsResponseSchema {
quests: ClaimedQuestSchema[];
}

View File

@@ -0,0 +1,26 @@
/*
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
Copyright (C) 2023 Spacebar and Spacebar Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { EntitlementSchema, QuestEntitlementExpirationMetadataSchema } from "@spacebar/schemas";
export interface QuestClaimRewardResponseSchema {
claimed_at: string;
entitlement_expiration_metadata: Record<string, QuestEntitlementExpirationMetadataSchema>;
entitlements: EntitlementSchema[];
errors: { message: string; code: number }[];
}

View File

@@ -0,0 +1,21 @@
/*
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
Copyright (C) 2023 Spacebar and Spacebar Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { QuestConfigSchema } from "@spacebar/schemas";
export type QuestConfigResponseSchema = QuestConfigSchema;

View File

@@ -0,0 +1,33 @@
/*
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
Copyright (C) 2023 Spacebar and Spacebar Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { QuestAdIdentifiersSchema, QuestSchema } from "@spacebar/schemas";
export interface QuestPlacementResponseSchema {
// The advertisement decision ID
request_id: string;
// The quest to show to the user
quest: QuestSchema | null;
// The advertisement identifiers for the delivered quest
ad_identifiers: QuestAdIdentifiersSchema | null;
// The advertisement context for the delivered quest
ad_context: { is_campaign_ias_enabled: boolean } | null;
response_ttl_seconds: number;
// Base64-encoded protobuf metadata for the advertisement
metadata_raw: string | null;
}

View File

@@ -0,0 +1,21 @@
/*
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
Copyright (C) 2023 Spacebar and Spacebar Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { QuestRewardCodeSchema } from "@spacebar/schemas";
export type QuestRewardCodeResponseSchema = QuestRewardCodeSchema;

View File

@@ -0,0 +1,21 @@
/*
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
Copyright (C) 2023 Spacebar and Spacebar Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { QuestUserStatusSchema } from "@spacebar/schemas";
export type QuestUserStatusResponseSchema = QuestUserStatusSchema;

View File

@@ -0,0 +1,28 @@
/*
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
Copyright (C) 2023 Spacebar and Spacebar Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { QuestSchema } from "@spacebar/schemas";
export interface QuestsResponseSchema {
excluded_quests: {
id: string;
replacement_id?: string;
}[];
quest_enrollment_blocked_until: unknown; // idk, i assume null | ISO8601 timestamp?
quests: QuestSchema[];
}

View File

@@ -0,0 +1,21 @@
/*
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
Copyright (C) 2023 Spacebar and Spacebar Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
export interface VirtualCurrencyResponseSchema {
balance: number;
}

View File

@@ -15,11 +15,12 @@
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
export * from "./AccountStandingResponse";
export * from "./APIErrorOrCaptchaResponse";
export * from "./APIErrorResponse";
export * from "./AccountStandingResponse";
export * from "./BackupCodesChallengeResponse";
export * from "./CaptchaRequiredResponse";
export * from "./ClaimedQuestsResponseSchema";
export * from "./CollectiblesCategoriesResponse";
export * from "./CollectiblesMarketingResponse";
export * from "./CollectiblesShopResponse";
@@ -50,6 +51,12 @@ export * from "./LocationMetadataResponse";
export * from "./MemberJoinGuildResponse";
export * from "./OAuthAuthorizeResponse";
export * from "./PreloadMessagesResponseSchema";
export * from "./QuestClaimRewardResponseSchema";
export * from "./QuestConfigResponseSchema";
export * from "./QuestPlacementResponseSchema";
export * from "./QuestRewardCodeResponseSchema";
export * from "./QuestsResponseSchema";
export * from "./QuestUserStatusResponseSchema";
export * from "./RefreshUrlsResponse";
export * from "./SettingsProtoUpdateResponse";
export * from "./TeamListResponse";
@@ -60,7 +67,8 @@ export * from "./UpdatesResponse";
export * from "./UploadAttachmentResponseSchema";
export * from "./UserNoteResponse";
export * from "./UserProfileResponse";
export * from "./UserRelationsResponse";
export * from "./UserRelationshipsResponse";
export * from "./UserRelationsResponse";
export * from "./VirtualCurrencyResponseSchema";
export * from "./WebAuthnCreateResponse";
export * from "./WebhookCreateResponse";

View File

@@ -0,0 +1,49 @@
/*
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
Copyright (C) 2023 Spacebar and Spacebar Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { User } from "@spacebar/util";
import { EntitlementSpecialSourceType } from "./EntitlementSpecialSourceType";
import { EntitlementType } from "./EntitlementType";
export interface EntitlementSchema {
id: string;
type: EntitlementType;
sku_id: string;
application_id: string;
user_id: string;
user?: Partial<User>;
guild_id?: string;
parent_id?: string;
deleted: boolean;
consumed?: boolean;
branches?: string[];
starts_at: string | null;
ends_at: string | null;
promotion_id: string | null;
subscription_id?: string;
gift_code_flags: number;
gift_code_batch_id?: string;
gifter_user_id?: string;
gift_style?: number;
fulfillment_status?: number;
fulfilled_at?: string;
source_type?: EntitlementSpecialSourceType;
tenant_metadata?: Record<string, unknown>;
sku?: unknown;
subscription_plan?: Partial<unknown>;
}

View File

@@ -0,0 +1,30 @@
/*
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
Copyright (C) 2023 Spacebar and Spacebar Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
export enum EntitlementSpecialSourceType {
QUEST_REWARD = 1,
DEVELOPER_GIFT,
INVOICE,
REVERSE_TRIAL,
USER_GIFT,
GUILD_POWERUP,
HOLIDAY_PROMOTION,
FRACTIONAL_PREMIUM_GIVEBACK,
SUBSCRIPTION,
SUBSCRIPTION_MEMBER = 11,
}

View File

@@ -0,0 +1,33 @@
/*
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
Copyright (C) 2023 Spacebar and Spacebar Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
export enum EntitlementType {
PURCHASE = 1,
PREMIUM_SUBSCRIPTION,
DEVELOPER_GIFT,
TEST_MODE_PURCHASE,
FREE_PURCHASE,
USER_GIFT,
PREMIUM_PURCHASE,
APPLICATION_SUBSCRIPTION,
FREE_STAFF_PURCHASE,
QUEST_REWARD,
FRACTIONAL_REDEMPTION,
VIRTUAL_CURRENCY_REDEMPTION,
GUILD_POWERUP,
}

View File

@@ -38,6 +38,9 @@ export * from "./EmailDomainLookupSchema";
export * from "./EmailDomainLookupVerifyCodeSchema";
export * from "./EmojiCreateSchema";
export * from "./EmojiModifySchema";
export * from "./EntitlementSchema";
export * from "./EntitlementSpecialSourceType";
export * from "./EntitlementType";
export * from "./ForgotPasswordSchema";
export * from "./GreetRequestSchema";
export * from "./GuildCreateSchema";
@@ -63,8 +66,8 @@ export * from "./PruneSchema";
export * from "./PurgeSchema";
export * from "./RefreshUrlsRequestSchema";
export * from "./RegisterSchema";
export * from "./RelationshipPostSchema";
export * from "./RelationshipPatchSchema";
export * from "./RelationshipPostSchema";
export * from "./RelationshipPutSchema";
export * from "./RequestGuildMembersSchema";
export * from "./RoleModifySchema";

View File

@@ -168,6 +168,9 @@ export class User extends BaseClass {
@Column({ type: "simple-array", nullable: true })
badge_ids?: string[];
@Column()
currency: number = 0; // virtual currency amount
// TODO: I don't like this method?
validate() {
if (this.discriminator) {

View File

@@ -38,7 +38,7 @@ import {
Snowflake,
} from "@spacebar/util";
import { JsonValue } from "@protobuf-ts/runtime";
import { ApplicationCommand, GuildCreateResponse, PartialEmoji, PublicMember, PublicUser, PublicVoiceState, RelationshipType, UserPrivate } from "@spacebar/schemas";
import { ApplicationCommand, GuildCreateResponse, PartialEmoji, PublicMember, PublicUser, PublicVoiceState, QuestUserStatusSchema, RelationshipType, UserPrivate } from "@spacebar/schemas";
export interface Event {
guild_id?: string;
@@ -608,6 +608,13 @@ export interface GuildMemberListUpdate extends Event {
};
}
export interface QuestsUserStatusUpdate extends Event {
event: "QUESTS_USER_STATUS_UPDATE";
data: {
user_status: QuestUserStatusSchema;
};
}
export type EventData =
| InvalidatedEvent
| ReadyEvent
@@ -658,7 +665,8 @@ export type EventData =
| InteractionFailureEvent
| MessageAckEvent
| RelationshipAddEvent
| RelationshipRemoveEvent;
| RelationshipRemoveEvent
| QuestsUserStatusUpdate;
// located in collection events
@@ -712,6 +720,7 @@ export enum EVENTEnum {
ApplicationCommandUpdate = "APPLICATION_COMMAND_UPDATE",
ApplicationCommandDelete = "APPLICATION_COMMAND_DELETE",
SessionsReplace = "SESSIONS_REPLACE",
QuestsUserStatusUpdate = "QUESTS_USER_STATUS_UPDATE",
}
export type EVENT =
@@ -775,6 +784,7 @@ export type EVENT =
| "RELATIONSHIP_UPDATE"
| "SESSIONS_REPLACE"
| "USER_SETTINGS_PROTO_UPDATE"
| "QUESTS_USER_STATUS_UPDATE"
| CUSTOMEVENTS;
export type CUSTOMEVENTS = "INVALIDATED" | "RATELIMIT";