diff --git a/package.json b/package.json index 4158a259..b128a84b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "revolt.js", - "version": "5.0.0-alpha.20", + "version": "5.0.0-alpha.21", "main": "dist/index.js", "repository": "https://gitlab.insrt.uk/revolt/revolt.js", "author": "Paul Makles ", diff --git a/src/index.ts b/src/index.ts index 875f97d8..bac09602 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,7 +1,7 @@ export * from './Client'; export { UserPermission, ChannelPermission, ServerPermission } from './api/permissions'; -export const LIBRARY_VERSION = '5.0.0-alpha.20'; +export const LIBRARY_VERSION = '5.0.0-alpha.21'; export const defaultConfig = { apiURL: 'https://api.revolt.chat', diff --git a/src/maps/Channels.ts b/src/maps/Channels.ts index 8e669dba..ebf9dbe2 100644 --- a/src/maps/Channels.ts +++ b/src/maps/Channels.ts @@ -188,7 +188,7 @@ export class Channel { const apply = (key: string, target?: string) => { // This code has been tested. // @ts-expect-error - if (data[key] && !isEqual(this[target ?? key], data[key])) { + if (typeof data[key] !== 'undefined' && !isEqual(this[target ?? key], data[key])) { // @ts-expect-error this[target ?? key] = data[key]; } diff --git a/src/maps/Members.ts b/src/maps/Members.ts index 43d44ecc..fe04cf44 100644 --- a/src/maps/Members.ts +++ b/src/maps/Members.ts @@ -36,7 +36,7 @@ export class Member { const apply = (key: string) => { // This code has been tested. // @ts-expect-error - if (data[key] && !isEqual(this[key], data[key])) { + if (typeof data[key] !== 'undefined' && !isEqual(this[key], data[key])) { // @ts-expect-error this[key] = data[key]; } diff --git a/src/maps/Messages.ts b/src/maps/Messages.ts index 2267a0d7..39909fea 100644 --- a/src/maps/Messages.ts +++ b/src/maps/Messages.ts @@ -92,7 +92,7 @@ export class Message { const apply = (key: string, target?: string, transform?: (obj: unknown) => unknown) => { // This code has been tested. // @ts-expect-error - if (data[key] && !isEqual(this[target ?? key], data[key])) { + if (typeof data[key] !== 'undefined' && !isEqual(this[target ?? key], data[key])) { // @ts-expect-error this[target ?? key] = transform ? transform(data[key]) : data[key]; } diff --git a/src/maps/Servers.ts b/src/maps/Servers.ts index 5621e136..d62857a7 100644 --- a/src/maps/Servers.ts +++ b/src/maps/Servers.ts @@ -61,7 +61,7 @@ export class Server { const apply = (key: string, target?: string) => { // This code has been tested. // @ts-expect-error - if (data[key] && !isEqual(this[target ?? key], data[key])) { + if (typeof data[key] !== 'undefined' && !isEqual(this[target ?? key], data[key])) { // @ts-expect-error this[target ?? key] = data[key]; } diff --git a/src/maps/Users.ts b/src/maps/Users.ts index 406f53b7..51ee0cf3 100644 --- a/src/maps/Users.ts +++ b/src/maps/Users.ts @@ -54,7 +54,7 @@ export class User { const apply = (key: string) => { // This code has been tested. // @ts-expect-error - if (data[key] && !isEqual(this[key], data[key])) { + if (typeof data[key] !== 'undefined' && !isEqual(this[key], data[key])) { // @ts-expect-error this[key] = data[key];