mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
refactor(MessagePayload): rename APIMessage (#5921)
This commit is contained in:
@@ -57,7 +57,6 @@ module.exports = {
|
||||
ApplicationCommand: require('./structures/ApplicationCommand'),
|
||||
Base: require('./structures/Base'),
|
||||
Activity: require('./structures/Presence').Activity,
|
||||
APIMessage: require('./structures/APIMessage'),
|
||||
BaseGuild: require('./structures/BaseGuild'),
|
||||
BaseGuildEmoji: require('./structures/BaseGuildEmoji'),
|
||||
BaseGuildVoiceChannel: require('./structures/BaseGuildVoiceChannel'),
|
||||
@@ -96,6 +95,7 @@ module.exports = {
|
||||
MessageComponentInteractionCollector: require('./structures/MessageComponentInteractionCollector'),
|
||||
MessageEmbed: require('./structures/MessageEmbed'),
|
||||
MessageMentions: require('./structures/MessageMentions'),
|
||||
MessagePayload: require('./structures/MessagePayload'),
|
||||
MessageReaction: require('./structures/MessageReaction'),
|
||||
MessageSelectMenu: require('./structures/MessageSelectMenu'),
|
||||
NewsChannel: require('./structures/NewsChannel'),
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
const BaseManager = require('./BaseManager');
|
||||
const { TypeError } = require('../errors');
|
||||
const APIMessage = require('../structures/APIMessage');
|
||||
const Message = require('../structures/Message');
|
||||
const MessagePayload = require('../structures/MessagePayload');
|
||||
const Collection = require('../util/Collection');
|
||||
const LimitedCollection = require('../util/LimitedCollection');
|
||||
|
||||
@@ -116,16 +116,16 @@ class MessageManager extends BaseManager {
|
||||
/**
|
||||
* Edits a message, even if it's not cached.
|
||||
* @param {MessageResolvable} message The message to edit
|
||||
* @param {MessageEditOptions|APIMessage} [options] The options to provide
|
||||
* @param {MessageEditOptions|MessagePayload} [options] The options to provide
|
||||
* @returns {Promise<Message>}
|
||||
*/
|
||||
async edit(message, options) {
|
||||
const messageID = this.resolveID(message);
|
||||
if (!messageID) throw new TypeError('INVALID_TYPE', 'message', 'MessageResolvable');
|
||||
|
||||
const { data, files } = await (options instanceof APIMessage
|
||||
const { data, files } = await (options instanceof MessagePayload
|
||||
? options
|
||||
: APIMessage.create(message instanceof Message ? message : this, options)
|
||||
: MessagePayload.create(message instanceof Message ? message : this, options)
|
||||
)
|
||||
.resolveData()
|
||||
.resolveFiles();
|
||||
|
||||
@@ -28,8 +28,8 @@ class InteractionWebhook {
|
||||
/* eslint-disable no-empty-function, valid-jsdoc */
|
||||
/**
|
||||
* Sends a message with this webhook.
|
||||
* @param {string|APIMessage|InteractionReplyOptions} options The content for the reply
|
||||
* @returns {Promise<Message|APIMessageRaw>}
|
||||
* @param {string|MessagePayload|InteractionReplyOptions} options The content for the reply
|
||||
* @returns {Promise<Message|APIMessage>}
|
||||
*/
|
||||
send() {}
|
||||
fetchMessage() {}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
const APIMessage = require('./APIMessage');
|
||||
const Base = require('./Base');
|
||||
const BaseMessageComponent = require('./BaseMessageComponent');
|
||||
const ClientApplication = require('./ClientApplication');
|
||||
@@ -8,6 +7,7 @@ const MessageAttachment = require('./MessageAttachment');
|
||||
const MessageComponentInteractionCollector = require('./MessageComponentInteractionCollector');
|
||||
const Embed = require('./MessageEmbed');
|
||||
const Mentions = require('./MessageMentions');
|
||||
const MessagePayload = require('./MessagePayload');
|
||||
const ReactionCollector = require('./ReactionCollector');
|
||||
const Sticker = require('./Sticker');
|
||||
const { Error } = require('../errors');
|
||||
@@ -26,7 +26,7 @@ const Util = require('../util/Util');
|
||||
class Message extends Base {
|
||||
/**
|
||||
* @param {Client} client The instantiating client
|
||||
* @param {APIMessageRaw} data The data for the message
|
||||
* @param {APIMessage} data The data for the message
|
||||
* @param {TextChannel|DMChannel|NewsChannel} channel The channel the message was sent in
|
||||
*/
|
||||
constructor(client, data, channel) {
|
||||
@@ -300,7 +300,7 @@ class Message extends Base {
|
||||
|
||||
/**
|
||||
* Updates the message and returns the old message.
|
||||
* @param {APIMessageRaw} data Raw Discord message update data
|
||||
* @param {APIMessage} data Raw Discord message update data
|
||||
* @returns {Message}
|
||||
* @private
|
||||
*/
|
||||
@@ -565,7 +565,7 @@ class Message extends Base {
|
||||
|
||||
/**
|
||||
* Edits the content of the message.
|
||||
* @param {string|APIMessage|MessageEditOptions} options The options to provide
|
||||
* @param {string|MessagePayload|MessageEditOptions} options The options to provide
|
||||
* @returns {Promise<Message>}
|
||||
* @example
|
||||
* // Update the content of a message
|
||||
@@ -667,7 +667,7 @@ class Message extends Base {
|
||||
|
||||
/**
|
||||
* Send an inline reply to this message.
|
||||
* @param {string|APIMessage|ReplyMessageOptions} options The options to provide
|
||||
* @param {string|MessagePayload|ReplyMessageOptions} options The options to provide
|
||||
* @returns {Promise<Message|Message[]>}
|
||||
* @example
|
||||
* // Reply to a message
|
||||
@@ -678,10 +678,10 @@ class Message extends Base {
|
||||
reply(options) {
|
||||
let data;
|
||||
|
||||
if (options instanceof APIMessage) {
|
||||
if (options instanceof MessagePayload) {
|
||||
data = options;
|
||||
} else {
|
||||
data = APIMessage.create(this, options, {
|
||||
data = MessagePayload.create(this, options, {
|
||||
reply: {
|
||||
messageReference: this,
|
||||
failIfNotExists: options?.failIfNotExists ?? true,
|
||||
@@ -754,7 +754,7 @@ class Message extends Base {
|
||||
* without checking all the properties, use `message.id === message2.id`, which is much more efficient. This
|
||||
* method allows you to see if there are differences in content, embeds, attachments, nonce and tts properties.
|
||||
* @param {Message} message The message to compare it to
|
||||
* @param {APIMessageRaw} rawData Raw data passed through the WebSocket about this message
|
||||
* @param {APIMessage} rawData Raw data passed through the WebSocket about this message
|
||||
* @returns {boolean}
|
||||
*/
|
||||
equals(message, rawData) {
|
||||
|
||||
@@ -16,7 +16,7 @@ class MessageComponentInteraction extends Interaction {
|
||||
|
||||
/**
|
||||
* The message to which the component was attached
|
||||
* @type {?(Message|APIMessageRaw)}
|
||||
* @type {?(Message|APIMessage)}
|
||||
*/
|
||||
this.message = data.message ? this.channel?.messages.add(data.message) ?? data.message : null;
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ const Util = require('../util/Util');
|
||||
/**
|
||||
* Represents a message to be sent to the API.
|
||||
*/
|
||||
class APIMessage {
|
||||
class MessagePayload {
|
||||
/**
|
||||
* @param {MessageTarget} target - The target for this message to be sent to
|
||||
* @param {MessageOptions|WebhookMessageOptions} options - Options passed in from send
|
||||
@@ -31,7 +31,7 @@ class APIMessage {
|
||||
|
||||
/**
|
||||
* Data sendable to the API
|
||||
* @type {?APIMessageRaw}
|
||||
* @type {?APIMessage}
|
||||
*/
|
||||
this.data = null;
|
||||
|
||||
@@ -119,7 +119,7 @@ class APIMessage {
|
||||
|
||||
/**
|
||||
* Resolves data.
|
||||
* @returns {APIMessage}
|
||||
* @returns {MessagePayload}
|
||||
*/
|
||||
resolveData() {
|
||||
if (this.data) return this;
|
||||
@@ -202,7 +202,7 @@ class APIMessage {
|
||||
|
||||
/**
|
||||
* Resolves files.
|
||||
* @returns {Promise<APIMessage>}
|
||||
* @returns {Promise<MessagePayload>}
|
||||
*/
|
||||
async resolveFiles() {
|
||||
if (this.files) return this;
|
||||
@@ -247,7 +247,7 @@ class APIMessage {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an `APIMessage` from user-level arguments.
|
||||
* Creates a `MessagePayload` from user-level arguments.
|
||||
* @param {MessageTarget} target Target to send to
|
||||
* @param {string|MessageOptions|WebhookMessageOptions} options Options or content to use
|
||||
* @param {MessageOptions|WebhookMessageOptions} [extra={}] - Extra options to add onto specified options
|
||||
@@ -261,7 +261,7 @@ class APIMessage {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = APIMessage;
|
||||
module.exports = MessagePayload;
|
||||
|
||||
/**
|
||||
* A target for a message.
|
||||
@@ -270,6 +270,6 @@ module.exports = APIMessage;
|
||||
*/
|
||||
|
||||
/**
|
||||
* @external APIMessageRaw
|
||||
* @external APIMessage
|
||||
* @see {@link https://discord.com/developers/docs/resources/channel#message-object}
|
||||
*/
|
||||
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
const APIMessage = require('./APIMessage');
|
||||
const Channel = require('./Channel');
|
||||
const MessagePayload = require('./MessagePayload');
|
||||
const { Error } = require('../errors');
|
||||
const { WebhookTypes } = require('../util/Constants');
|
||||
const DataResolver = require('../util/DataResolver');
|
||||
@@ -109,8 +109,8 @@ class Webhook {
|
||||
|
||||
/**
|
||||
* Sends a message with this webhook.
|
||||
* @param {string|APIMessage|WebhookMessageOptions} options The options to provide
|
||||
* @returns {Promise<Message|APIMessageRaw>}
|
||||
* @param {string|MessagePayload|WebhookMessageOptions} options The options to provide
|
||||
* @returns {Promise<Message|APIMessage>}
|
||||
* @example
|
||||
* // Send a basic message
|
||||
* webhook.send('hello!')
|
||||
@@ -158,21 +158,21 @@ class Webhook {
|
||||
async send(options) {
|
||||
if (!this.token) throw new Error('WEBHOOK_TOKEN_UNAVAILABLE');
|
||||
|
||||
let apiMessage;
|
||||
let messagePayload;
|
||||
|
||||
if (options instanceof APIMessage) {
|
||||
apiMessage = options.resolveData();
|
||||
if (options instanceof MessagePayload) {
|
||||
messagePayload = options.resolveData();
|
||||
} else {
|
||||
apiMessage = APIMessage.create(this, options).resolveData();
|
||||
messagePayload = MessagePayload.create(this, options).resolveData();
|
||||
}
|
||||
|
||||
const { data, files } = await apiMessage.resolveFiles();
|
||||
const { data, files } = await messagePayload.resolveFiles();
|
||||
return this.client.api
|
||||
.webhooks(this.id, this.token)
|
||||
.post({
|
||||
data,
|
||||
files,
|
||||
query: { thread_id: apiMessage.options.threadID, wait: true },
|
||||
query: { thread_id: messagePayload.options.threadID, wait: true },
|
||||
auth: false,
|
||||
})
|
||||
.then(d => {
|
||||
@@ -247,7 +247,7 @@ class Webhook {
|
||||
* Gets a message that was sent by this webhook.
|
||||
* @param {Snowflake|'@original'} message The ID of the message to fetch
|
||||
* @param {boolean} [cache=true] Whether to cache the message
|
||||
* @returns {Promise<Message|APIMessageRaw>} Returns the raw message data if the webhook was instantiated as a
|
||||
* @returns {Promise<Message|APIMessage>} Returns the raw message data if the webhook was instantiated as a
|
||||
* {@link WebhookClient} or if the channel is uncached, otherwise a {@link Message} will be returned
|
||||
*/
|
||||
async fetchMessage(message, cache = true) {
|
||||
@@ -260,19 +260,19 @@ class Webhook {
|
||||
/**
|
||||
* Edits a message that was sent by this webhook.
|
||||
* @param {MessageResolvable|'@original'} message The message to edit
|
||||
* @param {string|APIMessage|WebhookEditMessageOptions} options The options to provide
|
||||
* @returns {Promise<Message|APIMessageRaw>} Returns the raw message data if the webhook was instantiated as a
|
||||
* @param {string|MessagePayload|WebhookEditMessageOptions} options The options to provide
|
||||
* @returns {Promise<Message|APIMessage>} Returns the raw message data if the webhook was instantiated as a
|
||||
* {@link WebhookClient} or if the channel is uncached, otherwise a {@link Message} will be returned
|
||||
*/
|
||||
async editMessage(message, options) {
|
||||
if (!this.token) throw new Error('WEBHOOK_TOKEN_UNAVAILABLE');
|
||||
|
||||
let apiMessage;
|
||||
let messagePayload;
|
||||
|
||||
if (options instanceof APIMessage) apiMessage = options;
|
||||
else apiMessage = APIMessage.create(this, options);
|
||||
if (options instanceof MessagePayload) messagePayload = options;
|
||||
else messagePayload = MessagePayload.create(this, options);
|
||||
|
||||
const { data, files } = await apiMessage.resolveData().resolveFiles();
|
||||
const { data, files } = await messagePayload.resolveData().resolveFiles();
|
||||
|
||||
const d = await this.client.api
|
||||
.webhooks(this.id, this.token)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
const { Error } = require('../../errors');
|
||||
const { InteractionResponseTypes } = require('../../util/Constants');
|
||||
const MessageFlags = require('../../util/MessageFlags');
|
||||
const APIMessage = require('../APIMessage');
|
||||
const MessagePayload = require('../MessagePayload');
|
||||
|
||||
/**
|
||||
* Interface for classes that support shared interaction response types.
|
||||
@@ -53,7 +53,7 @@ class InteractionResponses {
|
||||
|
||||
/**
|
||||
* Creates a reply to this interaction.
|
||||
* @param {string|APIMessage|InteractionReplyOptions} options The options for the reply
|
||||
* @param {string|MessagePayload|InteractionReplyOptions} options The options for the reply
|
||||
* @returns {Promise<void>}
|
||||
* @example
|
||||
* // Reply to the interaction with an embed
|
||||
@@ -72,11 +72,11 @@ class InteractionResponses {
|
||||
if (this.deferred || this.replied) throw new Error('INTERACTION_ALREADY_REPLIED');
|
||||
this.ephemeral = options.ephemeral ?? false;
|
||||
|
||||
let apiMessage;
|
||||
if (options instanceof APIMessage) apiMessage = options;
|
||||
else apiMessage = APIMessage.create(this, options);
|
||||
let messagePayload;
|
||||
if (options instanceof MessagePayload) messagePayload = options;
|
||||
else messagePayload = MessagePayload.create(this, options);
|
||||
|
||||
const { data, files } = await apiMessage.resolveData().resolveFiles();
|
||||
const { data, files } = await messagePayload.resolveData().resolveFiles();
|
||||
|
||||
await this.client.api.interactions(this.id, this.token).callback.post({
|
||||
data: {
|
||||
@@ -91,7 +91,7 @@ class InteractionResponses {
|
||||
/**
|
||||
* Fetches the initial reply to this interaction.
|
||||
* @see Webhook#fetchMessage
|
||||
* @returns {Promise<Message|APIMessageRaw>}
|
||||
* @returns {Promise<Message|APIMessage>}
|
||||
* @example
|
||||
* // Fetch the reply to this interaction
|
||||
* interaction.fetchReply()
|
||||
@@ -106,8 +106,8 @@ class InteractionResponses {
|
||||
/**
|
||||
* Edits the initial reply to this interaction.
|
||||
* @see Webhook#editMessage
|
||||
* @param {string|APIMessage|WebhookEditMessageOptions} options The new options for the message
|
||||
* @returns {Promise<Message|APIMessageRaw>}
|
||||
* @param {string|MessagePayload|WebhookEditMessageOptions} options The new options for the message
|
||||
* @returns {Promise<Message|APIMessage>}
|
||||
* @example
|
||||
* // Edit the reply to this interaction
|
||||
* interaction.editReply('New content')
|
||||
@@ -138,8 +138,8 @@ class InteractionResponses {
|
||||
|
||||
/**
|
||||
* Send a follow-up message to this interaction.
|
||||
* @param {string|APIMessage|InteractionReplyOptions} options The options for the reply
|
||||
* @returns {Promise<Message|APIMessageRaw>}
|
||||
* @param {string|MessagePayload|InteractionReplyOptions} options The options for the reply
|
||||
* @returns {Promise<Message|APIMessage>}
|
||||
*/
|
||||
followUp(options) {
|
||||
return this.webhook.send(options);
|
||||
@@ -166,7 +166,7 @@ class InteractionResponses {
|
||||
|
||||
/**
|
||||
* Updates the original message whose button was pressed
|
||||
* @param {string|APIMessage|WebhookEditMessageOptions} options The options for the reply
|
||||
* @param {string|MessagePayload|WebhookEditMessageOptions} options The options for the reply
|
||||
* @returns {Promise<void>}
|
||||
* @example
|
||||
* // Remove the components from the message
|
||||
@@ -180,11 +180,11 @@ class InteractionResponses {
|
||||
async update(options) {
|
||||
if (this.deferred || this.replied) throw new Error('INTERACTION_ALREADY_REPLIED');
|
||||
|
||||
let apiMessage;
|
||||
if (options instanceof APIMessage) apiMessage = options;
|
||||
else apiMessage = APIMessage.create(this, options);
|
||||
let messagePayload;
|
||||
if (options instanceof MessagePayload) messagePayload = options;
|
||||
else messagePayload = MessagePayload.create(this, options);
|
||||
|
||||
const { data, files } = await apiMessage.resolveData().resolveFiles();
|
||||
const { data, files } = await messagePayload.resolveData().resolveFiles();
|
||||
|
||||
await this.client.api.interactions(this.id, this.token).callback.post({
|
||||
data: {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
/* eslint-disable import/order */
|
||||
const MessageCollector = require('../MessageCollector');
|
||||
const APIMessage = require('../APIMessage');
|
||||
const MessagePayload = require('../MessagePayload');
|
||||
const SnowflakeUtil = require('../../util/SnowflakeUtil');
|
||||
const Collection = require('../../util/Collection');
|
||||
const { RangeError, TypeError, Error } = require('../../errors');
|
||||
@@ -105,7 +105,7 @@ class TextBasedChannel {
|
||||
|
||||
/**
|
||||
* Sends a message to this channel.
|
||||
* @param {string|APIMessage|MessageOptions} options The options to provide
|
||||
* @param {string|MessagePayload|MessageOptions} options The options to provide
|
||||
* @returns {Promise<Message|Message[]>}
|
||||
* @example
|
||||
* // Send a basic message
|
||||
@@ -156,15 +156,15 @@ class TextBasedChannel {
|
||||
return this.createDM().then(dm => dm.send(options));
|
||||
}
|
||||
|
||||
let apiMessage;
|
||||
let messagePayload;
|
||||
|
||||
if (options instanceof APIMessage) {
|
||||
apiMessage = options.resolveData();
|
||||
if (options instanceof MessagePayload) {
|
||||
messagePayload = options.resolveData();
|
||||
} else {
|
||||
apiMessage = APIMessage.create(this, options).resolveData();
|
||||
messagePayload = MessagePayload.create(this, options).resolveData();
|
||||
}
|
||||
|
||||
const { data, files } = await apiMessage.resolveFiles();
|
||||
const { data, files } = await messagePayload.resolveFiles();
|
||||
return this.client.api.channels[this.id].messages
|
||||
.post({ data, files })
|
||||
.then(d => this.client.actions.MessageCreate.handle(d).message);
|
||||
|
||||
78
typings/index.d.ts
vendored
78
typings/index.d.ts
vendored
@@ -139,17 +139,17 @@ declare module 'discord.js' {
|
||||
import BaseCollection from '@discordjs/collection';
|
||||
import { ChildProcess } from 'child_process';
|
||||
import {
|
||||
APIActionRowComponent as RawActionRowComponent,
|
||||
APIInteractionDataResolvedChannel as RawInteractionDataResolvedChannel,
|
||||
APIInteractionDataResolvedGuildMember as RawInteractionDataResolvedGuildMember,
|
||||
APIInteractionGuildMember as RawInteractionGuildMember,
|
||||
APIMessage as RawMessage,
|
||||
APIMessageComponent as RawMessageComponent,
|
||||
APIOverwrite as RawOverwrite,
|
||||
APIPartialEmoji as RawEmoji,
|
||||
APIRole as RawRole,
|
||||
Snowflake as APISnowflake,
|
||||
APIActionRowComponent,
|
||||
APIInteractionDataResolvedChannel,
|
||||
APIInteractionDataResolvedGuildMember,
|
||||
APIInteractionGuildMember,
|
||||
APIMessage,
|
||||
APIMessageComponent,
|
||||
APIOverwrite,
|
||||
APIPartialEmoji,
|
||||
APIRole,
|
||||
APIUser,
|
||||
Snowflake as APISnowflake,
|
||||
ApplicationCommandOptionType as ApplicationCommandOptionTypes,
|
||||
ApplicationCommandPermissionType as ApplicationCommandPermissionTypes,
|
||||
} from 'discord-api-types/v8';
|
||||
@@ -209,7 +209,7 @@ declare module 'discord.js' {
|
||||
public splashURL(options?: StaticImageURLOptions): string | null;
|
||||
}
|
||||
|
||||
export class APIMessage {
|
||||
export class MessagePayload {
|
||||
constructor(target: MessageTarget, options: MessageOptions | WebhookMessageOptions);
|
||||
public data: unknown | null;
|
||||
public readonly isUser: boolean;
|
||||
@@ -225,7 +225,7 @@ declare module 'discord.js' {
|
||||
target: MessageTarget,
|
||||
options: string | MessageOptions | WebhookMessageOptions,
|
||||
extra?: MessageOptions | WebhookMessageOptions,
|
||||
): APIMessage;
|
||||
): MessagePayload;
|
||||
public static resolveFile(fileLike: BufferResolvable | Stream | FileOptions | MessageAttachment): Promise<unknown>;
|
||||
|
||||
public makeContent(): string | undefined;
|
||||
@@ -524,10 +524,10 @@ declare module 'discord.js' {
|
||||
public webhook: InteractionWebhook;
|
||||
public defer(options?: InteractionDeferOptions): Promise<void>;
|
||||
public deleteReply(): Promise<void>;
|
||||
public editReply(options: string | APIMessage | WebhookEditMessageOptions): Promise<Message | RawMessage>;
|
||||
public fetchReply(): Promise<Message | RawMessage>;
|
||||
public followUp(options: string | APIMessage | InteractionReplyOptions): Promise<Message | RawMessage>;
|
||||
public reply(options: string | APIMessage | InteractionReplyOptions): Promise<void>;
|
||||
public editReply(options: string | MessagePayload | WebhookEditMessageOptions): Promise<Message | APIMessage>;
|
||||
public fetchReply(): Promise<Message | APIMessage>;
|
||||
public followUp(options: string | MessagePayload | InteractionReplyOptions): Promise<Message | APIMessage>;
|
||||
public reply(options: string | MessagePayload | InteractionReplyOptions): Promise<void>;
|
||||
private transformOption(option: unknown, resolved: unknown): CommandInteractionOption;
|
||||
private _createOptionsCollection(options: unknown, resolved: unknown): Collection<string, CommandInteractionOption>;
|
||||
}
|
||||
@@ -1171,7 +1171,7 @@ declare module 'discord.js' {
|
||||
public readonly guild: Guild | null;
|
||||
public guildID: Snowflake | null;
|
||||
public id: Snowflake;
|
||||
public member: GuildMember | RawInteractionGuildMember | null;
|
||||
public member: GuildMember | APIInteractionGuildMember | null;
|
||||
public readonly token: string;
|
||||
public type: InteractionType;
|
||||
public user: User;
|
||||
@@ -1185,7 +1185,7 @@ declare module 'discord.js' {
|
||||
export class InteractionWebhook extends PartialWebhookMixin() {
|
||||
constructor(client: Client, id: Snowflake, token: string);
|
||||
public token: string;
|
||||
public send(options: string | APIMessage | InteractionReplyOptions): Promise<Message | RawMessage>;
|
||||
public send(options: string | MessagePayload | InteractionReplyOptions): Promise<Message | RawMessage>;
|
||||
}
|
||||
|
||||
export class Invite extends Base {
|
||||
@@ -1283,7 +1283,7 @@ declare module 'discord.js' {
|
||||
options?: MessageComponentInteractionCollectorOptions,
|
||||
): MessageComponentInteractionCollector;
|
||||
public delete(): Promise<Message>;
|
||||
public edit(content: string | MessageEditOptions | APIMessage): Promise<Message>;
|
||||
public edit(content: string | MessageEditOptions | MessagePayload): Promise<Message>;
|
||||
public equals(message: Message, rawData: unknown): boolean;
|
||||
public fetchReference(): Promise<Message>;
|
||||
public fetchWebhook(): Promise<Webhook>;
|
||||
@@ -1292,7 +1292,7 @@ declare module 'discord.js' {
|
||||
public pin(): Promise<Message>;
|
||||
public react(emoji: EmojiIdentifierResolvable): Promise<MessageReaction>;
|
||||
public removeAttachments(): Promise<Message>;
|
||||
public reply(options: string | APIMessage | ReplyMessageOptions): Promise<Message>;
|
||||
public reply(options: string | MessagePayload | ReplyMessageOptions): Promise<Message>;
|
||||
public startThread(
|
||||
name: string,
|
||||
autoArchiveDuration: ThreadAutoArchiveDuration,
|
||||
@@ -1341,7 +1341,7 @@ declare module 'discord.js' {
|
||||
constructor(data?: MessageButton | MessageButtonOptions);
|
||||
public customID: string | null;
|
||||
public disabled: boolean;
|
||||
public emoji: RawEmoji | null;
|
||||
public emoji: APIPartialEmoji | null;
|
||||
public label: string | null;
|
||||
public style: MessageButtonStyle | null;
|
||||
public type: 'BUTTON';
|
||||
@@ -1377,17 +1377,17 @@ declare module 'discord.js' {
|
||||
public customID: string;
|
||||
public deferred: boolean;
|
||||
public ephemeral: boolean | null;
|
||||
public message: Message | RawMessage;
|
||||
public message: Message | APIMessage;
|
||||
public replied: boolean;
|
||||
public webhook: InteractionWebhook;
|
||||
public defer(options?: InteractionDeferOptions): Promise<void>;
|
||||
public deferUpdate(): Promise<void>;
|
||||
public deleteReply(): Promise<void>;
|
||||
public editReply(options: string | APIMessage | WebhookEditMessageOptions): Promise<Message | RawMessage>;
|
||||
public fetchReply(): Promise<Message | RawMessage>;
|
||||
public followUp(options: string | APIMessage | InteractionReplyOptions): Promise<Message | RawMessage>;
|
||||
public reply(options: string | APIMessage | InteractionReplyOptions): Promise<void>;
|
||||
public update(content: string | APIMessage | WebhookEditMessageOptions): Promise<void>;
|
||||
public editReply(options: string | MessagePayload | WebhookEditMessageOptions): Promise<Message | APIMessage>;
|
||||
public fetchReply(): Promise<Message | APIMessage>;
|
||||
public followUp(options: string | MessagePayload | InteractionReplyOptions): Promise<Message | APIMessage>;
|
||||
public reply(options: string | MessagePayload | InteractionReplyOptions): Promise<void>;
|
||||
public update(content: string | MessagePayload | WebhookEditMessageOptions): Promise<void>;
|
||||
public static resolveType(type: MessageComponentTypeResolvable): MessageComponentType;
|
||||
}
|
||||
|
||||
@@ -1587,7 +1587,7 @@ declare module 'discord.js' {
|
||||
options: PermissionOverwriteOptions,
|
||||
initialPermissions: { allow?: PermissionResolvable; deny?: PermissionResolvable },
|
||||
): ResolvedOverwriteOptions;
|
||||
public static resolve(overwrite: OverwriteResolvable, guild: Guild): RawOverwrite;
|
||||
public static resolve(overwrite: OverwriteResolvable, guild: Guild): APIOverwrite;
|
||||
}
|
||||
|
||||
export class Permissions extends BitField<PermissionString, bigint> {
|
||||
@@ -2026,7 +2026,7 @@ declare module 'discord.js' {
|
||||
public static moveElementInArray(array: any[], element: any, newIndex: number, offset?: boolean): number;
|
||||
public static parseEmoji(text: string): { animated: boolean; name: string; id: Snowflake | null } | null;
|
||||
public static resolveColor(color: ColorResolvable): number;
|
||||
public static resolvePartialEmoji(emoji: EmojiIdentifierResolvable): Partial<RawEmoji> | null;
|
||||
public static resolvePartialEmoji(emoji: EmojiIdentifierResolvable): Partial<APIPartialEmoji> | null;
|
||||
public static verifyString(data: string, error?: typeof Error, errorMessage?: string, allowEmpty?: boolean): string;
|
||||
public static setPosition<T extends Channel | Role>(
|
||||
item: T,
|
||||
@@ -2122,10 +2122,10 @@ declare module 'discord.js' {
|
||||
public token: string;
|
||||
public editMessage(
|
||||
message: MessageResolvable,
|
||||
options: string | APIMessage | WebhookEditMessageOptions,
|
||||
options: string | MessagePayload | WebhookEditMessageOptions,
|
||||
): Promise<RawMessage>;
|
||||
public fetchMessage(message: Snowflake, cache?: boolean): Promise<RawMessage>;
|
||||
public send(options: string | APIMessage | WebhookMessageOptions): Promise<RawMessage>;
|
||||
public send(options: string | MessagePayload | WebhookMessageOptions): Promise<RawMessage>;
|
||||
}
|
||||
|
||||
export class WebSocketManager extends EventEmitter {
|
||||
@@ -2480,7 +2480,7 @@ declare module 'discord.js' {
|
||||
public cache: Collection<Snowflake, Message>;
|
||||
public crosspost(message: MessageResolvable): Promise<Message>;
|
||||
public delete(message: MessageResolvable): Promise<void>;
|
||||
public edit(message: MessageResolvable, options: APIMessage | MessageEditOptions): Promise<Message>;
|
||||
public edit(message: MessageResolvable, options: MessagePayload | MessageEditOptions): Promise<Message>;
|
||||
public fetch(message: Snowflake, options?: BaseFetchOptions): Promise<Message>;
|
||||
public fetch(
|
||||
options?: ChannelLogsQueryOptions,
|
||||
@@ -2587,7 +2587,7 @@ declare module 'discord.js' {
|
||||
interface PartialTextBasedChannelFields {
|
||||
lastMessageID: Snowflake | null;
|
||||
readonly lastMessage: Message | null;
|
||||
send(options: string | APIMessage | MessageOptions): Promise<Message>;
|
||||
send(options: string | MessagePayload | MessageOptions): Promise<Message>;
|
||||
}
|
||||
|
||||
interface TextBasedChannelFields extends PartialTextBasedChannelFields {
|
||||
@@ -2623,10 +2623,10 @@ declare module 'discord.js' {
|
||||
deleteMessage(message: MessageResolvable | '@original'): Promise<void>;
|
||||
editMessage(
|
||||
message: MessageResolvable | '@original',
|
||||
options: string | APIMessage | WebhookEditMessageOptions,
|
||||
options: string | MessagePayload | WebhookEditMessageOptions,
|
||||
): Promise<Message | RawMessage>;
|
||||
fetchMessage(message: Snowflake | '@original', cache?: boolean): Promise<Message | RawMessage>;
|
||||
send(options: string | APIMessage | WebhookMessageOptions): Promise<Message | RawMessage>;
|
||||
send(options: string | MessagePayload | WebhookMessageOptions): Promise<Message | RawMessage>;
|
||||
}
|
||||
|
||||
interface WebhookFields extends PartialWebhookFields {
|
||||
@@ -3095,9 +3095,9 @@ declare module 'discord.js' {
|
||||
value?: string | number | boolean;
|
||||
options?: Collection<string, CommandInteractionOption>;
|
||||
user?: User;
|
||||
member?: GuildMember | RawInteractionDataResolvedGuildMember;
|
||||
channel?: GuildChannel | RawInteractionDataResolvedChannel;
|
||||
role?: Role | RawRole;
|
||||
member?: GuildMember | APIInteractionDataResolvedGuildMember;
|
||||
channel?: GuildChannel | APIInteractionDataResolvedChannel;
|
||||
role?: Role | APIRole;
|
||||
}
|
||||
|
||||
interface CreateRoleOptions extends RoleData {
|
||||
@@ -3776,7 +3776,7 @@ declare module 'discord.js' {
|
||||
interface MessageSelectOption {
|
||||
default: boolean;
|
||||
description: string | null;
|
||||
emoji: RawEmoji | null;
|
||||
emoji: APIPartialEmoji | null;
|
||||
label: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user