Skip to content

Commit b8b54ea

Browse files
committed
feat: add RELATIONSHIP_UPDATE event
1 parent 8bff274 commit b8b54ea

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/schema/common.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as zod from 'zod';
22
import {zodCoerceUnhandledValue} from '../utils/zodUtils';
3-
import {AuthenticateResponseSchema} from '../generated/schemas';
3+
import {AuthenticateResponseSchema, GetRelationshipsResponseSchema} from '../generated/schemas';
44

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

5959
export const Scopes = zodCoerceUnhandledValue(ScopesObject);
6060

61+
export const Relationship = GetRelationshipsResponseSchema.shape.relationships.element;
62+
6163
export const User = zod.object({
6264
id: zod.string(),
6365
username: zod.string(),

src/schema/events.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as zod from 'zod';
22
import {Orientation} from '../Constants';
3-
import {DISPATCH, GuildMemberRPC, UserVoiceState} from './common';
3+
import {DISPATCH, GuildMemberRPC, Relationship, UserVoiceState} from './common';
44
import {zodCoerceUnhandledValue} from '../utils/zodUtils';
55
import {
66
Entitlement,
@@ -27,6 +27,7 @@ export enum Events {
2727
ENTITLEMENT_CREATE = 'ENTITLEMENT_CREATE',
2828
THERMAL_STATE_UPDATE = 'THERMAL_STATE_UPDATE',
2929
ACTIVITY_INSTANCE_PARTICIPANTS_UPDATE = 'ACTIVITY_INSTANCE_PARTICIPANTS_UPDATE',
30+
RELATIONSHIP_UPDATE = 'RELATIONSHIP_UPDATE',
3031
}
3132

3233
export const DispatchEventFrame = ReceiveFrame.extend({
@@ -229,4 +230,10 @@ export const EventSchema = {
229230
}),
230231
}),
231232
},
233+
[Events.RELATIONSHIP_UPDATE]: {
234+
payload: DispatchEventFrame.extend({
235+
evt: zod.literal(Events.RELATIONSHIP_UPDATE),
236+
data: Relationship,
237+
}),
238+
},
232239
} satisfies Record<keyof typeof Events, EventArgs>;

0 commit comments

Comments
 (0)