* call toJSON of keys in gateway when using erlpack

* dont send bitrate/etc as null when should be undefined
* set user flags to number instead of string
* send empty 'threads' in identify when not using new state v2
This commit is contained in:
Madeline
2023-07-29 16:59:21 +10:00
parent a5a6321156
commit a0d93fb252
7 changed files with 35 additions and 4 deletions
+12
View File
@@ -468,6 +468,18 @@ export class Channel extends BaseClass {
];
return disallowedChannelTypes.indexOf(this.type) == -1;
}
toJSON() {
return {
...this,
// these fields are not returned depending on the type of channel
bitrate: this.bitrate || undefined,
user_limit: this.user_limit || undefined,
rate_limit_per_user: this.rate_limit_per_user || undefined,
owner_id: this.owner_id || undefined,
};
}
}
export interface ChannelPermissionOverwrite {
+7
View File
@@ -390,4 +390,11 @@ export class Guild extends BaseClass {
return guild;
}
toJSON() {
return {
...this,
unavailable: this.unavailable == false ? undefined : true,
};
}
}
+1 -1
View File
@@ -175,7 +175,7 @@ export class User extends BaseClass {
email?: string; // email of the user
@Column()
flags: string = "0"; // UserFlags // TODO: generate
flags: number = 0; // UserFlags // TODO: generate
@Column()
public_flags: number = 0;