UNPKG

@amelix/phoenix.js

Version:

A feature-rich API wrapper for the critically acclaimed chatting app Phoenix.. or something.

35 lines (34 loc) 1.48 kB
import Base from "./Base"; import { Client } from "./Client"; import Invite from "./Invite"; import Member from "./Member"; import Server from "./Server"; import { AnyServerChannel } from "./ServerChannel"; import { AnyUser } from "./User"; /** Represents a message in a channel. */ export default class Message extends Base { private _invitesCached; content: string; edited: boolean; /** Whether or not the client can edit this message. */ editable: boolean; /** Whether or not the client can delete this message. */ deletable: boolean; server: Server; channel: AnyServerChannel; /** The User who sent this message. Undefined if the message is a system message. */ author?: AnyUser; /** The Member who sent this message. Undefined if author is a DeletedUser or Phoenix (system message) */ member?: Member; /** All *valid* invites contained within this message. */ invites?: Map<string, Invite>; /** if fetchInvites has been run, stores all the IDs that didn't match a valid invite. */ invalidInvites?: string[]; constructor(client: Client, data: any); /** Edit this message. */ edit(newContent: string): Promise<void>; /** Delete this message. */ delete(): Promise<void>; /** Go through all Phoenix invites in this message and cache Invite objects for them, returning the invites. */ fetchInvites(): Promise<Map<string, Invite> | undefined>; }