diff --git a/core/CHANGELOG.md b/core/CHANGELOG.md index 080ebd9..1435522 100644 --- a/core/CHANGELOG.md +++ b/core/CHANGELOG.md @@ -1,3 +1,7 @@ +v1.1.14 + +- Added `SystemMessageDetail` type. + v1.1.13 - Fixed `channelStartTyping` and `channelStopTyping` events returning incorrect arguments. diff --git a/core/package.json b/core/package.json index 3d4b5e6..d3f7e3a 100644 --- a/core/package.json +++ b/core/package.json @@ -1,6 +1,6 @@ { "name": "revkit", - "version": "1.1.13", + "version": "1.1.14", "description": "An alternative to revolt.js that aims to be familiar to use.", "main": "dist/cjs/index.js", "module": "dist/es6/index.js", diff --git a/core/src/objects/SystemMessage.ts b/core/src/objects/SystemMessage.ts index decef00..92e87b7 100644 --- a/core/src/objects/SystemMessage.ts +++ b/core/src/objects/SystemMessage.ts @@ -3,23 +3,25 @@ import { Client } from "../Client"; import { BaseMessage } from "./BaseMessage"; import { User } from "./User"; +export type SystemMessageDetail = + | { type: SystemMessageType.Text; content: string } + | { type: SystemMessageType.GroupDescriptionChange; by: User } + | { type: SystemMessageType.GroupIconChange; by: User } + | { type: SystemMessageType.GroupOwnershipChange; from: User; to: User } + | { type: SystemMessageType.GroupRenamed; name: string; by: User } + | { type: SystemMessageType.UserAdded; user: User; by: User } + | { type: SystemMessageType.UserBanned; user: User } + | { type: SystemMessageType.UserJoined; user: User } + | { type: SystemMessageType.UserKicked; user: User } + | { type: SystemMessageType.UserLeft; user: User } + | { type: SystemMessageType.UserRemoved; user: User; by: User }; + export class SystemMessage extends BaseMessage { constructor(client: Client, data: APIMessage) { super(client, data); } - public get detail(): - | { type: SystemMessageType.Text; content: string } - | { type: SystemMessageType.UserAdded; user: User; by: User } - | { type: SystemMessageType.UserRemoved; user: User; by: User } - | { type: SystemMessageType.UserJoined; user: User } - | { type: SystemMessageType.UserLeft; user: User } - | { type: SystemMessageType.UserKicked; user: User } - | { type: SystemMessageType.UserBanned; user: User } - | { type: SystemMessageType.GroupRenamed; name: string; by: User } - | { type: SystemMessageType.GroupDescriptionChange; by: User } - | { type: SystemMessageType.GroupIconChange; by: User } - | { type: SystemMessageType.GroupOwnershipChange; from: User; to: User } { + public get detail(): SystemMessageDetail { const sys = this.source.system, get = (id: string) => this.client.users.get(id);