mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-18 04:23:31 +01:00
types(MessageEditOptions): Omit poll (#10509)
fix: creating poll from message edit Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
This commit is contained in:
@@ -126,7 +126,7 @@ class Webhook {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Options that can be passed into send.
|
* Options that can be passed into send.
|
||||||
* @typedef {BaseMessageOptions} WebhookMessageCreateOptions
|
* @typedef {BaseMessageOptionsWithPoll} WebhookMessageCreateOptions
|
||||||
* @property {boolean} [tts=false] Whether the message should be spoken aloud
|
* @property {boolean} [tts=false] Whether the message should be spoken aloud
|
||||||
* @property {MessageFlags} [flags] Which flags to set for the message.
|
* @property {MessageFlags} [flags] Which flags to set for the message.
|
||||||
* <info>Only the {@link MessageFlags.SuppressEmbeds} flag can be set.</info>
|
* <info>Only the {@link MessageFlags.SuppressEmbeds} flag can be set.</info>
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ class InteractionResponses {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Options for a reply to a {@link BaseInteraction}.
|
* Options for a reply to a {@link BaseInteraction}.
|
||||||
* @typedef {BaseMessageOptions} InteractionReplyOptions
|
* @typedef {BaseMessageOptionsWithPoll} InteractionReplyOptions
|
||||||
* @property {boolean} [tts=false] Whether the message should be spoken aloud
|
* @property {boolean} [tts=false] Whether the message should be spoken aloud
|
||||||
* @property {boolean} [ephemeral] Whether the reply should be ephemeral
|
* @property {boolean} [ephemeral] Whether the reply should be ephemeral
|
||||||
* @property {boolean} [fetchReply] Whether to fetch the reply
|
* @property {boolean} [fetchReply] Whether to fetch the reply
|
||||||
|
|||||||
@@ -80,6 +80,11 @@ class TextBasedChannel {
|
|||||||
* The files to send with the message.
|
* The files to send with the message.
|
||||||
* @property {Array<(ActionRowBuilder|ActionRow|APIActionRowComponent)>} [components]
|
* @property {Array<(ActionRowBuilder|ActionRow|APIActionRowComponent)>} [components]
|
||||||
* Action rows containing interactive components for the message (buttons, select menus)
|
* Action rows containing interactive components for the message (buttons, select menus)
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The base message options for messages including a poll.
|
||||||
|
* @typedef {BaseMessageOptions} BaseMessageOptionsWithPoll
|
||||||
* @property {PollData} [poll] The poll to send with the message
|
* @property {PollData} [poll] The poll to send with the message
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -93,7 +98,7 @@ class TextBasedChannel {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The options for sending a message.
|
* The options for sending a message.
|
||||||
* @typedef {BaseMessageOptions} BaseMessageCreateOptions
|
* @typedef {BaseMessageOptionsWithPoll} BaseMessageCreateOptions
|
||||||
* @property {boolean} [tts=false] Whether the message should be spoken aloud
|
* @property {boolean} [tts=false] Whether the message should be spoken aloud
|
||||||
* @property {string} [nonce] The nonce for the message
|
* @property {string} [nonce] The nonce for the message
|
||||||
* <info>This property is required if `enforceNonce` set to `true`.</info>
|
* <info>This property is required if `enforceNonce` set to `true`.</info>
|
||||||
|
|||||||
13
packages/discord.js/typings/index.d.ts
vendored
13
packages/discord.js/typings/index.d.ts
vendored
@@ -6291,7 +6291,7 @@ export interface InteractionDeferReplyOptions {
|
|||||||
|
|
||||||
export interface InteractionDeferUpdateOptions extends Omit<InteractionDeferReplyOptions, 'ephemeral'> {}
|
export interface InteractionDeferUpdateOptions extends Omit<InteractionDeferReplyOptions, 'ephemeral'> {}
|
||||||
|
|
||||||
export interface InteractionReplyOptions extends BaseMessageOptions {
|
export interface InteractionReplyOptions extends BaseMessageOptionsWithPoll {
|
||||||
tts?: boolean;
|
tts?: boolean;
|
||||||
ephemeral?: boolean;
|
ephemeral?: boolean;
|
||||||
fetchReply?: boolean;
|
fetchReply?: boolean;
|
||||||
@@ -6459,10 +6459,13 @@ export interface BaseMessageOptions {
|
|||||||
| ActionRowData<MessageActionRowComponentData | MessageActionRowComponentBuilder>
|
| ActionRowData<MessageActionRowComponentData | MessageActionRowComponentBuilder>
|
||||||
| APIActionRowComponent<APIMessageActionRowComponent>
|
| APIActionRowComponent<APIMessageActionRowComponent>
|
||||||
)[];
|
)[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface BaseMessageOptionsWithPoll extends BaseMessageOptions {
|
||||||
poll?: PollData;
|
poll?: PollData;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface MessageCreateOptions extends BaseMessageOptions {
|
export interface MessageCreateOptions extends BaseMessageOptionsWithPoll {
|
||||||
tts?: boolean;
|
tts?: boolean;
|
||||||
nonce?: string | number;
|
nonce?: string | number;
|
||||||
enforceNonce?: boolean;
|
enforceNonce?: boolean;
|
||||||
@@ -6475,7 +6478,7 @@ export interface MessageCreateOptions extends BaseMessageOptions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface GuildForumThreadMessageCreateOptions
|
export interface GuildForumThreadMessageCreateOptions
|
||||||
extends Omit<BaseMessageOptions, 'poll'>,
|
extends BaseMessageOptions,
|
||||||
Pick<MessageCreateOptions, 'flags' | 'stickers'> {}
|
Pick<MessageCreateOptions, 'flags' | 'stickers'> {}
|
||||||
|
|
||||||
export interface MessageEditAttachmentData {
|
export interface MessageEditAttachmentData {
|
||||||
@@ -6981,7 +6984,9 @@ export interface WebhookMessageEditOptions extends Omit<MessageEditOptions, 'fla
|
|||||||
threadId?: Snowflake;
|
threadId?: Snowflake;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface InteractionEditReplyOptions extends WebhookMessageEditOptions {
|
export interface InteractionEditReplyOptions
|
||||||
|
extends WebhookMessageEditOptions,
|
||||||
|
Pick<BaseMessageOptionsWithPoll, 'poll'> {
|
||||||
message?: MessageResolvable | '@original';
|
message?: MessageResolvable | '@original';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -210,6 +210,7 @@ import {
|
|||||||
ApplicationEmojiManager,
|
ApplicationEmojiManager,
|
||||||
StickerPack,
|
StickerPack,
|
||||||
SendableChannels,
|
SendableChannels,
|
||||||
|
PollData,
|
||||||
} from '.';
|
} from '.';
|
||||||
import { expectAssignable, expectDeprecated, expectNotAssignable, expectNotType, expectType } from 'tsd';
|
import { expectAssignable, expectDeprecated, expectNotAssignable, expectNotType, expectType } from 'tsd';
|
||||||
import type { ContextMenuCommandBuilder, SlashCommandBuilder } from '@discordjs/builders';
|
import type { ContextMenuCommandBuilder, SlashCommandBuilder } from '@discordjs/builders';
|
||||||
@@ -2576,6 +2577,8 @@ await textChannel.send({
|
|||||||
});
|
});
|
||||||
|
|
||||||
declare const poll: Poll;
|
declare const poll: Poll;
|
||||||
|
declare const message: Message;
|
||||||
|
declare const pollData: PollData;
|
||||||
{
|
{
|
||||||
expectType<Message>(await poll.end());
|
expectType<Message>(await poll.end());
|
||||||
|
|
||||||
@@ -2589,6 +2592,13 @@ declare const poll: Poll;
|
|||||||
messageId: snowflake,
|
messageId: snowflake,
|
||||||
answerId: 1,
|
answerId: 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await message.edit({
|
||||||
|
// @ts-expect-error
|
||||||
|
poll: pollData,
|
||||||
|
});
|
||||||
|
|
||||||
|
await chatInputInteraction.editReply({ poll: pollData });
|
||||||
}
|
}
|
||||||
|
|
||||||
expectType<Collection<Snowflake, StickerPack>>(await client.fetchStickerPacks());
|
expectType<Collection<Snowflake, StickerPack>>(await client.fetchStickerPacks());
|
||||||
|
|||||||
Reference in New Issue
Block a user