UNPKG

guilded.ts

Version:

A powerful NPM module that allows you to easily interact with the Guilded API.

166 lines 6.8 kB
import { APIMessage, APIEmbed, APIMentions, MessageType } from 'guilded-api-typings'; import { Base } from '../Base'; import { MessageEditPayloadResolvable, MessagePayloadResolvable } from '../../managers/message/MessageManager'; import { MessageReactionManager } from '../../managers/message/MessageReactionManager'; import { MessageReaction } from './MessageReaction'; import { CollectorOptions } from '../../collectors/Collector'; import { MessageReactionCollector } from '../../collectors/MessageReactionCollector'; import { FetchManyOptions, FetchOptions } from '../../managers/BaseManager'; import { ChatChannel } from '../channel/ChatChannel'; import { Collection } from '@discordjs/collection'; /** * Represents a message on Guilded. * @example new Message(channel, rawMessage); */ export declare class Message extends Base { readonly channel: ChatChannel; readonly raw: APIMessage; /** The type of the message. */ readonly type: MessageType; /** The ID of the server the message belongs to. */ readonly serverId?: string; /** The ID of the channel the message belongs to. */ readonly channelId: string; /** The content of the message. */ readonly content?: string; /** The embeds in the message. */ readonly embeds: APIEmbed[]; /** The IDs of messages that were replied to. */ readonly replyMessageIds: string[]; /** Whether the message is private. */ readonly isPrivate?: boolean; /** Whether the message is silent. */ readonly isSilent?: boolean; /** The mentions of the message. */ readonly mentions?: APIMentions; /** The date the message was created. */ readonly createdAt: Date; /** The ID of the user that created the message. */ readonly createdBy: string; /** The ID of the webhook that created the message. */ readonly createdByWebhookId?: string; /** The date the message was edited. */ readonly editedAt?: Date; /** The date the message was deleted. */ deletedAt?: Date; /** A manager of reactions that belong to the message. */ readonly reactions: MessageReactionManager; /** * @param channel The chat channel the message belongs to. * @param raw The raw data of the message. * @param cache Whether to cache the message. */ constructor(channel: ChatChannel, raw: APIMessage, cache?: boolean); /** Whether the message is cached. */ get isCached(): boolean; /** Whether the message is a default message. */ get isDefault(): boolean; /** Whether the message is a system message. */ get isSystem(): boolean; /** The server the message belongs to. */ get server(): import("../..").Server | undefined; /** The group the message belongs to. */ get group(): import("../Group").Group | undefined; /** The timestamp the message was created. */ get createdTimestamp(): number; /** The timestamp the message was edited. */ get editedTimestamp(): number | undefined; /** Whether the message is deleted. */ get isDeleted(): boolean; /** The server member that created the message. */ get author(): import("../..").ServerMember | undefined; /** The webhook that created the message. */ get webhook(): import("../Webhook").Webhook | undefined; /** The ID of the user that created the message. */ get authorId(): string; /** The messages that were replied to. */ get replies(): Collection<string, Message>; /** The timestamp the message was deleted. */ get deletedTimestamp(): number | undefined; /** Whether the message is editable. */ get isEditable(): boolean; /** * Fetch the message. * @param options The options to fetch the message with. * @returns The fetched message. * @example message.fetch(); */ fetch(options?: FetchOptions): Promise<this>; /** * Fetch the server the message belongs to. * @param options The options to fetch the server with. * @returns The fetched server. * @example message.fetchServer(); */ fetchServer(options?: FetchOptions): Promise<import("../..").Server>; /** * Fetch the group the message belongs to. * @param options The options to fetch the group with. * @returns The fetched group. * @example message.fetchGroup(); */ fetchGroup(options?: FetchOptions): import("../Group").Group; /** * Fetch the server member that created the message. * @param options The options to fetch the server member with. * @returns The fetched server member. * @example message.fetchAuthor(); */ fetchAuthor(options?: FetchOptions): Promise<import("../..").ServerMember>; /** * Fetch the webhook that created the message. * @param options The options to fetch the webhook with. * @returns The fetched webhook. * @example message.fetchWebhook(); */ fetchWebhook(options?: FetchOptions): Promise<import("../Webhook").Webhook> | undefined; /** * Fetch the messages that were replied to. * @param options The options to fetch the messages with. * @returns The fetched messages. */ fetchReplies(options?: FetchManyOptions): Promise<Collection<string, Message>>; /** * Edit the message. * @param payload The payload of the message. * @returns The edited message. * @example message.edit('Hello World!'); */ edit(payload: MessageEditPayloadResolvable): Promise<this>; /** * Delete the message. * @returns The deleted message. * @example message.delete(); */ delete(): Promise<this>; /** * Reply to the message. * @param payload The payload of the message. * @returns The created message. * @example message.reply('Hello World!'); */ reply(payload: MessagePayloadResolvable): Promise<Message>; /** * React to the message. * @param emojiId The ID of the emoji to react with. * @returns The message. * @example message.react(123); */ react(emojiId: number): Promise<this>; /** * Create a reaction collector for the message. * @params options The options of the reaction collector. * @returns The created reaction collector. * @example message.createReactionCollector(); */ createReactionCollector(options?: CollectorOptions<MessageReaction>): MessageReactionCollector; /** * Similar to createReactionCollector but in promise form. * @param options The options of the reaction collector. * @returns The collected reactions. * @example message.awaitReactions(); */ awaitReactions(options?: CollectorOptions<MessageReaction>): Promise<Collection<number, MessageReaction>>; } export { MessageType }; //# sourceMappingURL=Message.d.ts.map