UNPKG

guilded.ts

Version:

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

73 lines 3.17 kB
import { APIMessagePayload, APIEmbed, APIMessageFetchManyOptions, APIMessageEditPayload } from 'guilded-api-typings'; import { Embed } from '@guildedts/builders'; import { BaseManager, FetchManyOptions, FetchOptions } from '../BaseManager'; import { Message } from '../../structures/message/Message'; import { ChatChannel } from '../../structures/channel/ChatChannel'; import { Collection } from '@discordjs/collection'; /** * The manager of messages that belong to a chat based channel. * @example new MessageManager(channel); */ export declare class MessageManager extends BaseManager<string, Message> { readonly channel: ChatChannel; /** @param channel The chat based channel the messages belong to. */ constructor(channel: ChatChannel); /** * Fetch a message from the chat based channel, or cache. * @param message The message to fetch. * @param options The options to fetch the message with. * @returns The fetched message. * @example messages.fetch(message); */ fetch(message: string | Message, options?: FetchOptions): Promise<Message>; /** * Fetch messages from the chat based channel. * @param options The options to fetch the messages with. * @returns The fetched messages. * @example messages.fetch(); */ fetch(options?: MessageFetchManyOptions): Promise<Collection<string, Message>>; /** @ignore */ private fetchSingle; /** @ignore */ private fetchMany; /** * Create a message in the chat based channel. * @param payload The payload of the message. * @returns The created message. * @example messages.create('Hello world!'); */ create(payload: MessagePayloadResolvable): Promise<Message>; /** * Edit a message in the chat based channel. * @param message The message to edit. * @param payload The payload of the message. * @returns The edited message. * @example messages.edit(message, 'Hello world!'); */ edit(message: string | Message, payload: MessageEditPayloadResolvable): Promise<Message>; /** * Delete a message in the chat based channel. * @param message The message to delete. * @example messages.delete(message); */ delete(message: string | Message): Promise<void>; } /** The options for fetching messages. */ export interface MessageFetchManyOptions extends FetchManyOptions, APIMessageFetchManyOptions { } /** The payload for creating a message. */ export interface MessagePayload extends Omit<APIMessagePayload, 'embeds'> { /** The embeds of the message. */ embeds?: (Embed | APIEmbed)[]; } /** The payload for editing a message. */ export interface MessageEditPayload extends Omit<APIMessageEditPayload, 'embeds'> { /** The embeds of the message. */ embeds?: (Embed | APIEmbed)[]; } /** The resolvable payload for creating a message. */ export declare type MessagePayloadResolvable = string | (Embed | APIEmbed)[] | MessagePayload; /** The resolvable payload for editing a message. */ export declare type MessageEditPayloadResolvable = string | (Embed | APIEmbed)[] | MessageEditPayload; //# sourceMappingURL=MessageManager.d.ts.map