mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-19 13:03:31 +01:00
feat: Premium buttons (#10353)
* feat: premium buttons * docs: deprecation string * feat(InteractionResponses): add deprecation message * feat(builders): add tests * chore: remove @ts-expect-errors * test: update method name * refactor(formatters): stricter types * docs: deprecate method in typings --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
3
packages/discord.js/typings/index.d.ts
vendored
3
packages/discord.js/typings/index.d.ts
vendored
@@ -604,6 +604,7 @@ export abstract class CommandInteraction<Cached extends CacheType = CacheType> e
|
||||
| ModalComponentData
|
||||
| APIModalInteractionResponseCallbackData,
|
||||
): Promise<void>;
|
||||
/** @deprecated Sending a premium-style button is the new Discord behaviour. */
|
||||
public sendPremiumRequired(): Promise<void>;
|
||||
public awaitModalSubmit(
|
||||
options: AwaitModalSubmitOptions<ModalSubmitInteraction>,
|
||||
@@ -2261,6 +2262,7 @@ export class MessageComponentInteraction<Cached extends CacheType = CacheType> e
|
||||
| ModalComponentData
|
||||
| APIModalInteractionResponseCallbackData,
|
||||
): Promise<void>;
|
||||
/** @deprecated Sending a premium-style button is the new Discord behaviour. */
|
||||
public sendPremiumRequired(): Promise<void>;
|
||||
public awaitModalSubmit(
|
||||
options: AwaitModalSubmitOptions<ModalSubmitInteraction>,
|
||||
@@ -2460,6 +2462,7 @@ export class ModalSubmitInteraction<Cached extends CacheType = CacheType> extend
|
||||
options: InteractionDeferUpdateOptions & { fetchReply: true },
|
||||
): Promise<Message<BooleanCache<Cached>>>;
|
||||
public deferUpdate(options?: InteractionDeferUpdateOptions): Promise<InteractionResponse<BooleanCache<Cached>>>;
|
||||
/** @deprecated Sending a premium-style button is the new Discord behaviour. */
|
||||
public sendPremiumRequired(): Promise<void>;
|
||||
public inGuild(): this is ModalSubmitInteraction<'raw' | 'cached'>;
|
||||
public inCachedGuild(): this is ModalSubmitInteraction<'cached'>;
|
||||
|
||||
@@ -206,7 +206,7 @@ import {
|
||||
MentionableSelectMenuComponent,
|
||||
Poll,
|
||||
} from '.';
|
||||
import { expectAssignable, expectNotAssignable, expectNotType, expectType } from 'tsd';
|
||||
import { expectAssignable, expectDeprecated, expectNotAssignable, expectNotType, expectType } from 'tsd';
|
||||
import type { ContextMenuCommandBuilder, SlashCommandBuilder } from '@discordjs/builders';
|
||||
import { ReadonlyCollection } from '@discordjs/collection';
|
||||
|
||||
@@ -1763,6 +1763,7 @@ client.on('interactionCreate', async interaction => {
|
||||
expectType<AnySelectMenuInteraction | ButtonInteraction>(interaction);
|
||||
expectType<MessageActionRowComponent | APIButtonComponent | APISelectMenuComponent>(interaction.component);
|
||||
expectType<Message>(interaction.message);
|
||||
expectDeprecated(interaction.sendPremiumRequired());
|
||||
if (interaction.inCachedGuild()) {
|
||||
expectAssignable<MessageComponentInteraction>(interaction);
|
||||
expectType<MessageActionRowComponent>(interaction.component);
|
||||
@@ -1950,6 +1951,7 @@ client.on('interactionCreate', async interaction => {
|
||||
interaction.type === InteractionType.ApplicationCommand &&
|
||||
interaction.commandType === ApplicationCommandType.ChatInput
|
||||
) {
|
||||
expectDeprecated(interaction.sendPremiumRequired());
|
||||
if (interaction.inRawGuild()) {
|
||||
expectNotAssignable<Interaction<'cached'>>(interaction);
|
||||
expectAssignable<ChatInputCommandInteraction>(interaction);
|
||||
@@ -2073,6 +2075,10 @@ client.on('interactionCreate', async interaction => {
|
||||
expectType<Promise<Message>>(interaction.followUp({ content: 'a' }));
|
||||
}
|
||||
}
|
||||
|
||||
if (interaction.isModalSubmit()) {
|
||||
expectDeprecated(interaction.sendPremiumRequired());
|
||||
}
|
||||
});
|
||||
|
||||
declare const shard: Shard;
|
||||
|
||||
Reference in New Issue
Block a user