-
-
Notifications
You must be signed in to change notification settings - Fork 114
/
gateway.ts
154 lines (138 loc) · 4.94 KB
/
gateway.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
/**
* Types extracted from https://discord.com/developers/docs/topics/gateway
*/
import type { APIEmoji } from './emoji.ts';
import type { APIUser } from './user.ts';
/**
* https://discord.com/developers/docs/topics/gateway#get-gateway
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIGatewayInfo {
url: string;
}
/**
* https://discord.com/developers/docs/topics/gateway#get-gateway-bot
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIGatewayBotInfo extends APIGatewayInfo {
shards: number;
session_start_limit: APIGatewaySessionStartLimit;
}
/**
* https://discord.com/developers/docs/topics/gateway#session-start-limit-object
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIGatewaySessionStartLimit {
total: number;
remaining: number;
reset_after: number;
}
/**
* https://discord.com/developers/docs/topics/gateway#presence-update-presence-update-event-fields
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface GatewayPresenceUpdate {
user: Partial<APIUser> & {
id: string;
};
roles?: string[];
game?: GatewayActivity | null;
guild_id?: string;
status?: PresenceUpdateStatus;
activities?: GatewayActivity[];
client_status?: GatewayPresenceClientStatus;
premium_since?: string | null;
nick?: string | null;
}
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export enum PresenceUpdateStatus {
DoNotDisturb = 'dnd',
Idle = 'idle',
Invisible = 'invisible',
Offline = 'offline',
Online = 'online',
}
/**
* https://discord.com/developers/docs/topics/gateway#client-status-object
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type GatewayPresenceClientStatus = Partial<Record<'desktop' | 'mobile' | 'web', PresenceUpdateStatus>>;
/**
* https://discord.com/developers/docs/topics/gateway#activity-object
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface GatewayActivity {
name: string;
type: ActivityType;
url?: string | null;
created_at: number;
timestamps?: GatewayActivityTimestamps;
application_id?: string;
details?: string | null;
state?: string | null;
emoji?: GatewayActivityEmoji;
party?: GatewayActivityParty;
assets?: GatewayActivityAssets;
secrets?: GatewayActivitySecrets;
instance?: boolean;
flags?: ActivityFlags;
}
/**
* https://discord.com/developers/docs/topics/gateway#activity-object-activity-types
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export enum ActivityType {
Game,
Streaming,
Listening,
Custom = 4,
Competing,
}
/**
* https://discord.com/developers/docs/topics/gateway#activity-object-activity-timestamps
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface GatewayActivityTimestamps {
start?: number;
end?: number;
}
/**
* https://discord.com/developers/docs/topics/gateway#activity-object-activity-emoji
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type GatewayActivityEmoji = Partial<Pick<APIEmoji, 'name' | 'animated'>> & Pick<APIEmoji, 'id'>;
/**
* https://discord.com/developers/docs/topics/gateway#activity-object-activity-party
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface GatewayActivityParty {
id?: string;
// eslint-disable-next-line prettier/prettier
size?: [currentSize: number, maxSize: number];
}
/**
* https://discord.com/developers/docs/topics/gateway#activity-object-activity-assets
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type GatewayActivityAssets = Partial<
Record<'large_image' | 'large_text' | 'small_image' | 'small_text', string>
>;
/**
* https://discord.com/developers/docs/topics/gateway#activity-object-activity-secrets
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type GatewayActivitySecrets = Partial<Record<'join' | 'spectate' | 'match', string>>;
/**
* https://discord.com/developers/docs/topics/gateway#activity-object-activity-flags
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export enum ActivityFlags {
INSTANCE = 1 << 0,
JOIN = 1 << 1,
SPECTATE = 1 << 2,
JOIN_REQUEST = 1 << 3,
SYNC = 1 << 4,
PLAY = 1 << 5,
}