Skip to content

Commit

Permalink
refactor: remove deprecated interfaces, decorators and comments
Browse files Browse the repository at this point in the history
BREAKING CHANGE: `@Values` and `@SelectMenu` removed

Refs: #515
  • Loading branch information
SocketSomeone committed Jul 22, 2023
1 parent 5172d73 commit 8a72279
Show file tree
Hide file tree
Showing 7 changed files with 0 additions and 53 deletions.
1 change: 0 additions & 1 deletion src/commands/slash-commands/slash-command.discovery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { OPTIONS_METADATA } from '../../necord.constants';
import { APIApplicationCommandOptionBase } from 'discord-api-types/payloads/v10/_interactions/_applicationCommands/_chatInput/base';
import { CommandDiscovery } from '../command.discovery';

// TODO: Separate to SlashCommandDiscovery, SubcommandGroupDiscovery, SubcommandDiscovery
// @ts-ignore
export interface SlashCommandMeta extends ChatInputApplicationCommandData {
type?:
Expand Down
1 change: 0 additions & 1 deletion src/context/necord-base.discovery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ interface DiscoveredItem {
handler?: (...args: any[]) => any;
}

// TODO: Move TypeGuards to ExecutionContext
export abstract class NecordBaseDiscovery<T = any> {
protected readonly reflector = new Reflector();

Expand Down
9 changes: 0 additions & 9 deletions src/context/necord-context.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,6 @@ export type ModalContext = [ModalSubmitInteraction];

export type ButtonContext = [ButtonInteraction];

// TODO: Remove in v6
/**
* @deprecated since v5.4 - old name for `StringSelectContext`. Will be removed in v6. Discord now uses new select menus
* @see {@link https://discord.js.org/#/docs/discord.js/main/class/SelectMenuInteraction DiscordJS docs}
* @see {@link https://discord.com/developers/docs/interactions/message-components#select-menus Discord API docs}
* @see {@link https://discord.com/developers/docs/interactions/message-components#component-object-component-types ComponentType}
*/
export type SelectMenuContext = [SelectMenuInteraction];

export type StringSelectContext = [StringSelectMenuInteraction];

export type ChannelSelectContext = [ChannelSelectMenuInteraction];
Expand Down
1 change: 0 additions & 1 deletion src/message-components/decorators/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ export * from './button.decorator';
export * from './component-param.decorator';
export * from './message-component.decorator';
export * from './select-menu.decorator';
export * from './values.decorator';
export * from './selected.decorator';
9 changes: 0 additions & 9 deletions src/message-components/decorators/select-menu.decorator.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
import { ComponentType } from 'discord.js';
import { MessageComponent } from './message-component.decorator';

/**
* @deprecated since 5.4 - This is the old name for StringSelect. Will be deleted in v6. Discord now uses new select menus
* @see {@link https://discord.js.org/#/docs/discord.js/main/class/SelectMenuInteraction DiscordJS docs}
* @see {@link https://discord.com/developers/docs/interactions/message-components#select-menus Discord API docs}
* @see {@link https://discord.com/developers/docs/interactions/message-components#component-object-component-types ComponentType}
*/
export const SelectMenu = (customId: string) =>
MessageComponent({ customId, type: ComponentType.SelectMenu }); // TODO: Remove in v6

export const StringSelect = (customId: string) =>
MessageComponent({ customId, type: ComponentType.StringSelect });

Expand Down
16 changes: 0 additions & 16 deletions src/message-components/decorators/values.decorator.ts

This file was deleted.

16 changes: 0 additions & 16 deletions test/message-components.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ import {
SelectedRoles,
SelectedStrings,
SelectedUsers,
SelectMenu,
SelectMenuContext,
SlashCommand,
SlashCommandContext,
StringSelect,
Expand Down Expand Up @@ -88,20 +86,6 @@ export class MessageComponentsSpec {
return interaction.reply({ content: `Button clicked! Value: ${value}` });
}

// TODO: Remove in v6
/**
* @deprecated since v5.4 - old name for `@SelectedStrings`. Will be removed in v6. Discord now uses new select menus
* @see {@link https://discord.js.org/#/docs/discord.js/main/class/SelectMenuInteraction DiscordJS docs}
* @see {@link https://discord.com/developers/docs/interactions/message-components#select-menus Discord API docs}
* @see {@link https://discord.com/developers/docs/interactions/message-components#component-object-component-types ComponentType}
*/
@SelectMenu('SELECT_MENU')
public onSelectMenu(@Context() [interaction]: SelectMenuContext) {
return interaction.reply({
content: `Your selected color - ${interaction.values.join(' ')}`
});
}

@SlashCommand({ name: 'string-select', description: 'Creates string select menu component.' })
public async createStringSelect(@Context() [interaction]: SlashCommandContext) {
return interaction.reply({
Expand Down

0 comments on commit 8a72279

Please sign in to comment.