mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13: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.
|
||||
* @typedef {BaseMessageOptions} WebhookMessageCreateOptions
|
||||
* @typedef {BaseMessageOptionsWithPoll} WebhookMessageCreateOptions
|
||||
* @property {boolean} [tts=false] Whether the message should be spoken aloud
|
||||
* @property {MessageFlags} [flags] Which flags to set for the message.
|
||||
* <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}.
|
||||
* @typedef {BaseMessageOptions} InteractionReplyOptions
|
||||
* @typedef {BaseMessageOptionsWithPoll} InteractionReplyOptions
|
||||
* @property {boolean} [tts=false] Whether the message should be spoken aloud
|
||||
* @property {boolean} [ephemeral] Whether the reply should be ephemeral
|
||||
* @property {boolean} [fetchReply] Whether to fetch the reply
|
||||
|
||||
@@ -80,6 +80,11 @@ class TextBasedChannel {
|
||||
* The files to send with the message.
|
||||
* @property {Array<(ActionRowBuilder|ActionRow|APIActionRowComponent)>} [components]
|
||||
* 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
|
||||
*/
|
||||
|
||||
@@ -93,7 +98,7 @@ class TextBasedChannel {
|
||||
|
||||
/**
|
||||
* The options for sending a message.
|
||||
* @typedef {BaseMessageOptions} BaseMessageCreateOptions
|
||||
* @typedef {BaseMessageOptionsWithPoll} BaseMessageCreateOptions
|
||||
* @property {boolean} [tts=false] Whether the message should be spoken aloud
|
||||
* @property {string} [nonce] The nonce for the message
|
||||
* <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 InteractionReplyOptions extends BaseMessageOptions {
|
||||
export interface InteractionReplyOptions extends BaseMessageOptionsWithPoll {
|
||||
tts?: boolean;
|
||||
ephemeral?: boolean;
|
||||
fetchReply?: boolean;
|
||||
@@ -6459,10 +6459,13 @@ export interface BaseMessageOptions {
|
||||
| ActionRowData<MessageActionRowComponentData | MessageActionRowComponentBuilder>
|
||||
| APIActionRowComponent<APIMessageActionRowComponent>
|
||||
)[];
|
||||
}
|
||||
|
||||
export interface BaseMessageOptionsWithPoll extends BaseMessageOptions {
|
||||
poll?: PollData;
|
||||
}
|
||||
|
||||
export interface MessageCreateOptions extends BaseMessageOptions {
|
||||
export interface MessageCreateOptions extends BaseMessageOptionsWithPoll {
|
||||
tts?: boolean;
|
||||
nonce?: string | number;
|
||||
enforceNonce?: boolean;
|
||||
@@ -6475,7 +6478,7 @@ export interface MessageCreateOptions extends BaseMessageOptions {
|
||||
}
|
||||
|
||||
export interface GuildForumThreadMessageCreateOptions
|
||||
extends Omit<BaseMessageOptions, 'poll'>,
|
||||
extends BaseMessageOptions,
|
||||
Pick<MessageCreateOptions, 'flags' | 'stickers'> {}
|
||||
|
||||
export interface MessageEditAttachmentData {
|
||||
@@ -6981,7 +6984,9 @@ export interface WebhookMessageEditOptions extends Omit<MessageEditOptions, 'fla
|
||||
threadId?: Snowflake;
|
||||
}
|
||||
|
||||
export interface InteractionEditReplyOptions extends WebhookMessageEditOptions {
|
||||
export interface InteractionEditReplyOptions
|
||||
extends WebhookMessageEditOptions,
|
||||
Pick<BaseMessageOptionsWithPoll, 'poll'> {
|
||||
message?: MessageResolvable | '@original';
|
||||
}
|
||||
|
||||
|
||||
@@ -210,6 +210,7 @@ import {
|
||||
ApplicationEmojiManager,
|
||||
StickerPack,
|
||||
SendableChannels,
|
||||
PollData,
|
||||
} from '.';
|
||||
import { expectAssignable, expectDeprecated, expectNotAssignable, expectNotType, expectType } from 'tsd';
|
||||
import type { ContextMenuCommandBuilder, SlashCommandBuilder } from '@discordjs/builders';
|
||||
@@ -2576,6 +2577,8 @@ await textChannel.send({
|
||||
});
|
||||
|
||||
declare const poll: Poll;
|
||||
declare const message: Message;
|
||||
declare const pollData: PollData;
|
||||
{
|
||||
expectType<Message>(await poll.end());
|
||||
|
||||
@@ -2589,6 +2592,13 @@ declare const poll: Poll;
|
||||
messageId: snowflake,
|
||||
answerId: 1,
|
||||
});
|
||||
|
||||
await message.edit({
|
||||
// @ts-expect-error
|
||||
poll: pollData,
|
||||
});
|
||||
|
||||
await chatInputInteraction.editReply({ poll: pollData });
|
||||
}
|
||||
|
||||
expectType<Collection<Snowflake, StickerPack>>(await client.fetchStickerPacks());
|
||||
|
||||
Reference in New Issue
Block a user