revolt.js
Advanced tools
Comparing version 6.0.0-rc.10 to 6.0.0-rc.11
@@ -1,2 +0,2 @@ | ||
export declare const LIBRARY_VERSION = "6.0.0-rc.10"; | ||
export declare const LIBRARY_VERSION = "6.0.0-rc.11"; | ||
export declare const defaultConfig: { | ||
@@ -3,0 +3,0 @@ apiURL: string; |
@@ -1,2 +0,2 @@ | ||
export const LIBRARY_VERSION = "6.0.0-rc.10"; | ||
export const LIBRARY_VERSION = "6.0.0-rc.11"; | ||
export const defaultConfig = { | ||
@@ -3,0 +3,0 @@ apiURL: "https://api.revolt.chat", |
@@ -12,3 +12,4 @@ import type { DataEditMessage, DataMessageSend, Embed, Masquerade, Message as MessageI, SystemMessage } from "revolt-api"; | ||
author_id: string; | ||
content: string | SystemMessage; | ||
content: Nullable<string>; | ||
system: Nullable<SystemMessage>; | ||
attachments: Nullable<File[]>; | ||
@@ -38,4 +39,6 @@ edited: Nullable<Date>; | ||
get asSystemMessage(): { | ||
type: "text"; | ||
content: string; | ||
} | { | ||
type: string; | ||
content: string; | ||
user?: undefined; | ||
@@ -48,3 +51,2 @@ by?: undefined; | ||
by: import("./Users").User | undefined; | ||
content?: undefined; | ||
name?: undefined; | ||
@@ -54,3 +56,2 @@ } | { | ||
user: import("./Users").User | undefined; | ||
content?: undefined; | ||
by?: undefined; | ||
@@ -62,3 +63,2 @@ name?: undefined; | ||
by: import("./Users").User | undefined; | ||
content?: undefined; | ||
user?: undefined; | ||
@@ -68,3 +68,2 @@ } | { | ||
by: import("./Users").User | undefined; | ||
content?: undefined; | ||
user?: undefined; | ||
@@ -85,3 +84,4 @@ name?: undefined; | ||
author: string; | ||
content: string | { | ||
content?: string | null | undefined; | ||
system?: { | ||
type: "text"; | ||
@@ -119,3 +119,3 @@ content: string; | ||
by: string; | ||
}; | ||
} | null | undefined; | ||
attachments?: { | ||
@@ -122,0 +122,0 @@ _id: string; |
@@ -29,3 +29,4 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
this.author_id = data.author; | ||
this.content = data.content; | ||
this.content = toNullable(data.content); | ||
this.system = toNullable(data.system); | ||
this.attachments = toNullable(data.attachments); | ||
@@ -87,28 +88,28 @@ this.edited = toNullableDate(data.edited); | ||
get asSystemMessage() { | ||
const content = this.content; | ||
if (typeof content === "string") | ||
return { type: "text", content }; | ||
const { type } = content; | ||
const system = this.system; | ||
if (!system) | ||
return { type: 'none' }; | ||
const { type } = system; | ||
const get = (id) => this.client.users.get(id); | ||
switch (content.type) { | ||
switch (system.type) { | ||
case "text": | ||
return content; | ||
return system; | ||
case "user_added": | ||
return { type, user: get(content.id), by: get(content.by) }; | ||
return { type, user: get(system.id), by: get(system.by) }; | ||
case "user_remove": | ||
return { type, user: get(content.id), by: get(content.by) }; | ||
return { type, user: get(system.id), by: get(system.by) }; | ||
case "user_joined": | ||
return { type, user: get(content.id) }; | ||
return { type, user: get(system.id) }; | ||
case "user_left": | ||
return { type, user: get(content.id) }; | ||
return { type, user: get(system.id) }; | ||
case "user_kicked": | ||
return { type, user: get(content.id) }; | ||
return { type, user: get(system.id) }; | ||
case "user_banned": | ||
return { type, user: get(content.id) }; | ||
return { type, user: get(system.id) }; | ||
case "channel_renamed": | ||
return { type, name: content.name, by: get(content.by) }; | ||
return { type, name: system.name, by: get(system.by) }; | ||
case "channel_description_changed": | ||
return { type, by: get(content.by) }; | ||
return { type, by: get(system.by) }; | ||
case "channel_icon_changed": | ||
return { type, by: get(content.by) }; | ||
return { type, by: get(system.by) }; | ||
} | ||
@@ -115,0 +116,0 @@ } |
@@ -170,10 +170,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
"00000000000000000000000000") { | ||
if (typeof packet.content === "object") { | ||
switch (packet.content.type) { | ||
if (packet.system) { | ||
switch (packet.system.type) { | ||
case "user_added": | ||
case "user_remove": | ||
yield this.client.users.fetch(packet.content.by); | ||
yield this.client.users.fetch(packet.system.by); | ||
break; | ||
case "user_joined": | ||
yield this.client.users.fetch(packet.content.id); | ||
yield this.client.users.fetch(packet.system.id); | ||
break; | ||
@@ -183,3 +183,3 @@ case "channel_description_changed": | ||
case "channel_renamed": | ||
yield this.client.users.fetch(packet.content.by); | ||
yield this.client.users.fetch(packet.system.by); | ||
break; | ||
@@ -186,0 +186,0 @@ } |
{ | ||
"type": "module", | ||
"name": "revolt.js", | ||
"version": "6.0.0-rc.10", | ||
"version": "6.0.0-rc.11", | ||
"main": "dist/index.js", | ||
@@ -19,3 +19,3 @@ "repository": "https://github.com/revoltchat/revolt.js", | ||
"mobx": "^6.3.2", | ||
"revolt-api": "0.5.3-rc.12", | ||
"revolt-api": "0.5.3-rc.13", | ||
"ulid": "^2.3.0", | ||
@@ -22,0 +22,0 @@ "ws": "^8.2.2" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5923
213390
+ Addedrevolt-api@0.5.3-rc.13(transitive)
- Removedrevolt-api@0.5.3-rc.12(transitive)
Updatedrevolt-api@0.5.3-rc.13