@@ -74,7 +74,7 @@ export interface SocketOptions {
74
74
guildSubscriptions ?: boolean ,
75
75
identifyProperties ?: IdentifyDataProperties ,
76
76
largeThreshold ?: number ,
77
- presence ?: any ,
77
+ presence ?: PresenceOptions ,
78
78
reconnectDelay ?: number ,
79
79
reconnectMax ?: number ,
80
80
shardCount ?: number ,
@@ -222,48 +222,44 @@ export class Socket extends EventEmitter {
222
222
}
223
223
}
224
224
225
- makePresence (
226
- options ?: PresenceOptions ,
227
- ) : PresenceData {
225
+ makePresence ( options ?: PresenceOptions ) : RawPresence {
228
226
options = this . presence = Object . assign ( { } , defaultPresence , this . presence , options ) ;
229
- const activities : Array < PresenceActivity > = [ ...( options . activities || [ ] ) ] ;
230
227
231
- const data : PresenceData = {
228
+ const data : RawPresence = {
229
+ activities : [ ] ,
232
230
afk : options . afk ,
233
231
since : options . since ,
234
232
status : options . status ,
235
233
} ;
236
234
237
- if ( options . activity || options . game ) {
238
- if ( options . activity ) {
239
- activities . unshift ( options . activity ) ;
240
- }
241
- if ( options . game ) {
242
- activities . unshift ( options . game ) ;
243
- }
235
+ const activities : Array < PresenceActivityOptions > = [ ...( options . activities || [ ] ) ] ;
236
+ if ( options . activity ) {
237
+ activities . unshift ( options . activity ) ;
238
+ }
239
+ if ( options . game ) {
240
+ activities . unshift ( options . game ) ;
244
241
}
245
242
246
243
if ( activities . length ) {
247
- data . activities = [ ] ;
248
244
for ( let activity of activities ) {
249
- const raw : any = {
245
+ const raw : RawPresenceActivity = {
250
246
application_id : activity . applicationId ,
251
- assets : activity . assets ,
252
- created_at : activity . createdAt ,
247
+ assets : undefined ,
253
248
details : activity . details ,
254
- emoji : activity . emoji ,
249
+ emoji : undefined ,
255
250
flags : activity . flags ,
256
251
metadata : activity . metadata ,
257
252
name : activity . name ,
258
- party : activity . party ,
259
- secrets : activity . secrets ,
253
+ party : undefined ,
254
+ secrets : undefined ,
260
255
session_id : activity . sessionId ,
261
256
state : activity . state ,
262
257
sync_id : activity . syncId ,
263
- timestamps : activity . timestamps ,
258
+ timestamps : undefined ,
264
259
type : activity . type ,
265
260
url : activity . url ,
266
261
} ;
262
+
267
263
if ( activity . assets ) {
268
264
raw . assets = {
269
265
large_image : activity . assets . largeImage ,
@@ -984,7 +980,7 @@ export interface IdentifyData {
984
980
compress ?: boolean ,
985
981
guild_subscriptions ?: boolean ,
986
982
large_threshold ?: number ,
987
- presence ?: PresenceData ,
983
+ presence ?: RawPresence ,
988
984
properties : IdentifyDataProperties ,
989
985
shard ?: Array < number > ,
990
986
token : string ,
@@ -1008,15 +1004,67 @@ export interface IdentifyDataProperties {
1008
1004
window_manager ?: string ,
1009
1005
}
1010
1006
1011
- export interface PresenceActivity {
1007
+ export interface RawPresenceActivity {
1008
+ application_id ?: string ,
1009
+ assets ?: {
1010
+ large_image ?: string ,
1011
+ large_text ?: string ,
1012
+ small_image ?: string ,
1013
+ small_text ?: string ,
1014
+ } ,
1015
+ details ?: string ,
1016
+ emoji ?: {
1017
+ animated : boolean ,
1018
+ id : null | string ,
1019
+ name : string ,
1020
+ } ,
1021
+ flags ?: number ,
1022
+ id ?: string ,
1023
+ instance ?: boolean ,
1024
+ metadata ?: { [ key : string ] : any } ,
1025
+ name : string ,
1026
+ party ?: {
1027
+ id ?: string ,
1028
+ size ?: Array < [ number , number ] > ,
1029
+ } ,
1030
+ secrets ?: {
1031
+ join ?: string ,
1032
+ match ?: string ,
1033
+ spectate ?: string ,
1034
+ } ,
1035
+ session_id ?: string ,
1036
+ state ?: string ,
1037
+ sync_id ?: string ,
1038
+ timestamps ?: {
1039
+ end ?: number ,
1040
+ start ?: number ,
1041
+ } ,
1042
+ type : number ,
1043
+ url ?: string ,
1044
+ }
1045
+
1046
+ export interface RawPresence {
1047
+ activities : Array < RawPresenceActivity > ,
1048
+ afk : boolean ,
1049
+ since : number ,
1050
+ status : string ,
1051
+ }
1052
+
1053
+ export interface ResumeData {
1054
+ seq ?: null | number ,
1055
+ session_id : null | string ,
1056
+ token : string ,
1057
+ }
1058
+
1059
+
1060
+ export interface PresenceActivityOptions {
1012
1061
applicationId ?: string ,
1013
1062
assets ?: {
1014
1063
largeImage ?: string ,
1015
1064
largeText ?: string ,
1016
1065
smallImage ?: string ,
1017
1066
smallText ?: string ,
1018
1067
} ,
1019
- createdAt ?: number ,
1020
1068
details ?: string ,
1021
1069
emoji ?: {
1022
1070
animated : boolean ,
@@ -1046,21 +1094,11 @@ export interface PresenceActivity {
1046
1094
url ?: string ,
1047
1095
}
1048
1096
1049
- export interface PresenceData {
1050
- activities ?: Array < PresenceActivity > ,
1097
+ export interface PresenceOptions {
1098
+ activities ?: Array < PresenceActivityOptions > ,
1099
+ activity ?: PresenceActivityOptions ,
1051
1100
afk : boolean ,
1052
- game ?: PresenceActivity ,
1101
+ game ?: PresenceActivityOptions ,
1053
1102
since : number ,
1054
1103
status : string ,
1055
1104
}
1056
-
1057
- export interface PresenceOptions extends PresenceData {
1058
- activity ?: PresenceActivity ,
1059
- game ?: PresenceActivity ,
1060
- }
1061
-
1062
- export interface ResumeData {
1063
- seq ?: null | number ,
1064
- session_id : null | string ,
1065
- token : string ,
1066
- }
0 commit comments