detritus-client
Version:
A Typescript NodeJS library to interact with Discord's API, both Rest and Gateway.
260 lines (259 loc) • 9.38 kB
TypeScript
import { RequestTypes } from 'detritus-client-rest';
import { ShardClient } from '../client';
import { BaseCollection } from '../collections/basecollection';
import { BaseSet } from '../collections/baseset';
import { InteractionTypes, MessageComponentButtonStyles, MessageComponentTypes, MessageTypes } from '../constants';
import { BaseStructure, BaseStructureData } from './basestructure';
import { Application } from './application';
import { Attachment } from './attachment';
import { Channel, ChannelGuildThread, ChannelTextType } from './channel';
import { Emoji } from './emoji';
import { Guild } from './guild';
import { Member } from './member';
import { MessageEmbed } from './messageembed';
import { PresenceActivity } from './presence';
import { Reaction } from './reaction';
import { Role } from './role';
import { Sticker, StickerItem } from './sticker';
import { User } from './user';
export interface MessageReplyOptions extends RequestTypes.CreateMessage {
reference?: boolean;
}
/**
* Channel Message Structure
* @category Structure
*/
export declare class Message extends BaseStructure {
readonly _keys: BaseSet<string>;
readonly _keysMerge: BaseSet<string>;
readonly _keysSkipDifference: BaseSet<string>;
_content: string;
_attachments?: BaseCollection<string, Attachment>;
_components?: BaseCollection<number, MessageComponentActionRow>;
_embeds?: BaseCollection<number, MessageEmbed>;
_mentions?: BaseCollection<string, Member | User>;
_mentionChannels?: BaseCollection<string, Channel>;
_mentionRoles?: BaseCollection<string, null | Role>;
_reactions?: BaseCollection<string, Reaction>;
_stickers?: BaseCollection<string, Sticker>;
_stickerItems?: BaseCollection<string, StickerItem>;
activity?: MessageActivity;
application?: Application;
author: User;
call?: MessageCall;
channelId: string;
content: string;
deleted: boolean;
editedTimestampUnix: number;
flags: number;
guildId?: string;
id: string;
interaction?: MessageInteraction;
member?: Member;
mentionEveryone: boolean;
messageReference?: MessageReference;
nonce?: string;
pinned: boolean;
referencedMessage: Message | null;
thread?: ChannelGuildThread;
timestampUnix: number;
tts: boolean;
type: MessageTypes;
webhookId?: string;
constructor(client: ShardClient, data?: BaseStructureData, isClone?: boolean);
get attachments(): BaseCollection<string, Attachment>;
get canDelete(): boolean;
get canEdit(): boolean;
get canManage(): boolean;
get canReact(): boolean;
get canReadHistory(): boolean;
get canReply(): boolean;
get channel(): ChannelTextType | null;
get components(): BaseCollection<number, MessageComponentActionRow>;
get createdAt(): Date;
get createdAtUnix(): number;
get editedAt(): Date | null;
get editedAtUnix(): number;
get editedTimestamp(): Date | null;
get embeds(): BaseCollection<number, MessageEmbed>;
get fromBot(): boolean;
get fromMe(): boolean;
get fromSystem(): boolean;
get fromUser(): boolean;
get fromWebhook(): boolean;
get guild(): Guild | null;
get hasAttachment(): boolean;
get hasFlagCrossposted(): boolean;
get hasFlagEphemeral(): boolean;
get hasFlagIsCrossposted(): boolean;
get hasFlagSuppressEmbeds(): boolean;
get inDm(): boolean;
get isEdited(): boolean;
get isReply(): boolean;
get jumpLink(): string;
get mentionHere(): boolean;
get mentions(): BaseCollection<string, Member | User>;
get mentionChannels(): BaseCollection<string, Channel>;
get mentionRoles(): BaseCollection<string, null | Role>;
get reactions(): BaseCollection<string, Reaction>;
get stickers(): BaseCollection<string, Sticker>;
get stickerItems(): BaseCollection<string, StickerItem>;
get systemContent(): string;
get timestamp(): Date;
convertContent(options?: {
escapeMentions?: boolean;
guildSpecific?: boolean;
nick?: boolean;
text?: string;
}): string;
hasFlag(flag: number): boolean;
ack(token: string): Promise<any>;
createThread(options: RequestTypes.CreateChannelMessageThread): Promise<ChannelGuildThread>;
crosspost(): Promise<Message>;
delete(options?: RequestTypes.DeleteMessage): Promise<any>;
deleteReaction(emoji: string, userId?: string): Promise<any>;
deleteReactions(): Promise<any>;
edit(options?: RequestTypes.EditMessage | string): Promise<Message>;
fetchReactions(emoji: string, options?: RequestTypes.FetchReactions): Promise<BaseCollection<string, User>>;
pin(): Promise<any>;
publish(options: RequestTypes.CreateApplicationNews): Promise<import("./applicationnews").ApplicationNews>;
react(emoji: string): Promise<any>;
removeMention(): Promise<any>;
reply(options?: MessageReplyOptions | string): Promise<Message>;
triggerTyping(): Promise<any>;
unpin(): Promise<any>;
difference(key: string, value: any): [boolean, any];
mergeValue(key: string, value: any): void;
toString(): string;
}
/**
* Channel Message Activity Structure, used for inviting people to listen/join
* @category Structure
*/
export declare class MessageActivity extends BaseStructure {
readonly _uncloneable = true;
readonly _keys: BaseSet<string>;
readonly message: Message;
coverImage: null | string;
name: null | string;
partyId: string;
type: number;
constructor(message: Message, data: BaseStructureData);
get activity(): null | PresenceActivity;
get group(): BaseCollection<string, User>;
}
/**
* Channel Message Call Structure, used to define the call properties in the DM it's from
* Used to format the content
* @category Structure
*/
export declare class MessageCall extends BaseStructure {
readonly _uncloneable = true;
readonly _keys: BaseSet<string>;
readonly message: Message;
endedTimestamp: Date | null;
participants: Array<string>;
constructor(message: Message, data: BaseStructureData);
get duration(): number;
get isEnded(): boolean;
mergeValue(key: string, value: any): void;
}
/**
* Channel Message Component Action Row Structure
* @category Structure
*/
export declare class MessageComponentActionRow extends BaseStructure {
readonly _uncloneable = true;
readonly _keys: BaseSet<string>;
readonly message: Message;
components: BaseCollection<string, MessageComponent | MessageComponentSelectMenu>;
type: MessageComponentTypes;
constructor(message: Message, data: BaseStructureData);
mergeValue(key: string, value: any): void;
}
/**
* Channel Message Component Structure
* @category Structure
*/
export declare class MessageComponent extends BaseStructure {
readonly _uncloneable = true;
readonly _keys: BaseSet<string>;
readonly message: Message;
customId?: string;
disabled?: boolean;
emoji?: Emoji;
label?: string;
style?: MessageComponentButtonStyles;
type: MessageComponentTypes;
url?: string;
constructor(message: Message, data: BaseStructureData);
get id(): string;
mergeValue(key: string, value: any): void;
}
/**
* Channel Message Component Select Menu Structure
* @category Structure
*/
export declare class MessageComponentSelectMenu extends BaseStructure {
readonly _uncloneable = true;
readonly _keys: BaseSet<string>;
readonly message: Message;
customId: string;
maxValues: number;
minValues: number;
options: BaseCollection<string, MessageComponentSelectMenuOption>;
placeholder: string;
type: MessageComponentTypes.SELECT_MENU;
constructor(message: Message, data: BaseStructureData);
get id(): string;
mergeValue(key: string, value: any): void;
}
/**
* Channel Message Component Select Menu Structure
* @category Structure
*/
export declare class MessageComponentSelectMenuOption extends BaseStructure {
readonly _uncloneable = true;
readonly _keys: BaseSet<string>;
readonly message: Message;
default: boolean;
description?: string;
emoji?: Emoji;
label: string;
value: string;
constructor(message: Message, data: BaseStructureData);
mergeValue(key: string, value: any): void;
}
/**
* Channel Message Interaction Structure
* @category Structure
*/
export declare class MessageInteraction extends BaseStructure {
readonly _uncloneable = true;
readonly _keys: BaseSet<string>;
readonly message: Message;
id: string;
name: string;
type: InteractionTypes;
user: User;
constructor(message: Message, data: BaseStructureData);
mergeValue(key: string, value: any): void;
}
/**
* Channel Message Reference Structure, used to tell the client that this is from a server webhook or a reply
* Used for crossposts
* @category Structure
*/
export declare class MessageReference extends BaseStructure {
readonly _uncloneable = true;
readonly _keys: BaseSet<string>;
readonly parent: Message;
channelId: string;
guildId?: string;
messageId?: string;
constructor(message: Message, data: BaseStructureData);
get channel(): ChannelTextType | null;
get guild(): null | Guild;
get message(): null | Message;
}
export declare function messageSystemContent(message: Message, text?: string): string;