guilded.ts
Version:
A powerful NPM module that allows you to easily interact with the Guilded API.
87 lines • 3.29 kB
TypeScript
import { APIWebhook } from 'guilded-api-typings';
import { Base } from './Base';
import { FetchOptions } from '../managers/BaseManager';
import { Channel } from './channel/Channel';
import { WebhookMessagePayloadResolvable } from '../managers/channel/ChannelWebhookManager';
/**
* Represents a webhook on Guilded.
* @example new Webhook(channel, rawWebhook);
*/
export declare class Webhook extends Base {
readonly channel: Channel;
readonly raw: APIWebhook;
/** The name of the webhook. */
readonly name: string;
/** The ID of the server the webhook belongs to. */
readonly serverId: string;
/** The ID of the channel the webhook belongs to. */
readonly channelId: string;
/** The date the webhook was created. */
readonly createdAt: Date;
/** The ID of the user that created the webhook. */
readonly createdBy: string;
/** The date the webhook was deleted. */
readonly deletedAt?: Date;
/** The token of the webhook. */
readonly token?: string;
/**
* @param channel The channel the webhook belongs to.
* @param raw The raw data of the webhook.
* @param cache Whether to cache the webhook.
*/
constructor(channel: Channel, raw: APIWebhook, cache?: boolean);
/** Whether the webhook is cached. */
get isCached(): boolean;
/** The server the webhook belongs to. */
get server(): import("..").Server | undefined;
/** The timestamp the webhook was created. */
get createdTimestamp(): number;
/** The server member that created the webhook. */
get author(): import("..").ServerMember | undefined;
/** The ID of the user that created the webhook. */
get authorId(): string;
/** The timestamp the webhook was deleted. */
get deletedTimestamp(): number | undefined;
/**
* Fetch the webhook.
* @param options The options to fetch the webhook with.
* @returns The fetched webhook.
* @example webhook.fetch();
*/
fetch(options?: FetchOptions): Promise<this>;
/**
* Fetch the server the webhook belongs to.
* @param options The options to fetch the server with.
* @returns The fetched server.
* @example webhook.fetchServer();
*/
fetchServer(options?: FetchOptions): Promise<import("..").Server>;
/**
* Fetch the server member that created the webhook.
* @param options The options to fetch the server member with.
* @returns The fetched server member.
* @example webhook.fetchAuthor();
*/
fetchAuthor(options?: FetchOptions): Promise<import("..").ServerMember>;
/**
* Send a message with the webhook.
* @param payload The payload of the message.
* @example webhook.send('Hello world!');
*/
send(payload: WebhookMessagePayloadResolvable): Promise<void>;
/**
* Edit the webhook.
* @param name The name of the webhook.
* @param channelId The ID of the channel the webhook belongs to.
* @returns The edited webhook.
* @example webhook.edit('New name');
*/
edit(name: string, channelId?: string): Promise<Webhook>;
/**
* Delete the webhook.
* @returns The deleted webhook.
* @example webhook.delete();
*/
delete(): Promise<this>;
}
//# sourceMappingURL=Webhook.d.ts.map