Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/schema/common.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as zod from 'zod';
import {zodCoerceUnhandledValue} from '../utils/zodUtils';
import {AuthenticateResponseSchema} from '../generated/schemas';
import {AuthenticateResponseSchema, GetRelationshipsResponseSchema} from '../generated/schemas';

// DISPATCH is sent as cmd but is a special case, so is excluded from Commands enum
export const DISPATCH = 'DISPATCH';
Expand Down Expand Up @@ -58,6 +58,8 @@ export const ScopesObject = {

export const Scopes = zodCoerceUnhandledValue(ScopesObject);

export const Relationship = GetRelationshipsResponseSchema.shape.relationships.element;

export const User = zod.object({
id: zod.string(),
username: zod.string(),
Expand Down
9 changes: 8 additions & 1 deletion src/schema/events.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as zod from 'zod';
import {Orientation} from '../Constants';
import {DISPATCH, GuildMemberRPC, UserVoiceState} from './common';
import {DISPATCH, GuildMemberRPC, Relationship, UserVoiceState} from './common';
import {zodCoerceUnhandledValue} from '../utils/zodUtils';
import {
Entitlement,
Expand All @@ -27,6 +27,7 @@ export enum Events {
ENTITLEMENT_CREATE = 'ENTITLEMENT_CREATE',
THERMAL_STATE_UPDATE = 'THERMAL_STATE_UPDATE',
ACTIVITY_INSTANCE_PARTICIPANTS_UPDATE = 'ACTIVITY_INSTANCE_PARTICIPANTS_UPDATE',
RELATIONSHIP_UPDATE = 'RELATIONSHIP_UPDATE',
}

export const DispatchEventFrame = ReceiveFrame.extend({
Expand Down Expand Up @@ -229,4 +230,10 @@ export const EventSchema = {
}),
}),
},
[Events.RELATIONSHIP_UPDATE]: {
payload: DispatchEventFrame.extend({
evt: zod.literal(Events.RELATIONSHIP_UPDATE),
data: Relationship,
}),
},
} satisfies Record<keyof typeof Events, EventArgs>;