Skip to content

Commit

Permalink
feat: make all pieces virtual (#686)
Browse files Browse the repository at this point in the history
* feat: make all pieces virtual

* fix: register optional command registries correctly

* chore: update /pieces
  • Loading branch information
kyranet authored Nov 16, 2023
1 parent d310a8a commit 41bcc9b
Show file tree
Hide file tree
Showing 73 changed files with 498 additions and 60 deletions.
8 changes: 7 additions & 1 deletion src/arguments/CoreBoolean.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { PieceContext } from '@sapphire/pieces';
import { container, type PieceContext } from '@sapphire/pieces';
import { resolveBoolean } from '../lib/resolvers/boolean';
import { Argument } from '../lib/structures/Argument';
import type { BooleanArgumentContext } from '../lib/types/ArgumentContexts';
Expand All @@ -20,3 +20,9 @@ export class CoreArgument extends Argument<boolean> {
);
}
}

void container.stores.loadPiece({
name: 'boolean',
piece: CoreArgument,
store: 'arguments'
});
8 changes: 7 additions & 1 deletion src/arguments/CoreChannel.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ChannelTypes } from '@sapphire/discord.js-utilities';
import type { PieceContext } from '@sapphire/pieces';
import { container, type PieceContext } from '@sapphire/pieces';
import { resolveChannel } from '../lib/resolvers/channel';
import { Argument } from '../lib/structures/Argument';

Expand All @@ -20,3 +20,9 @@ export class CoreArgument extends Argument<ChannelTypes> {
);
}
}

void container.stores.loadPiece({
name: 'channel',
piece: CoreArgument,
store: 'arguments'
});
8 changes: 7 additions & 1 deletion src/arguments/CoreDMChannel.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { PieceContext } from '@sapphire/pieces';
import { container, type PieceContext } from '@sapphire/pieces';
import type { DMChannel } from 'discord.js';
import { resolveDMChannel } from '../lib/resolvers/dmChannel';
import { Argument } from '../lib/structures/Argument';
Expand All @@ -20,3 +20,9 @@ export class CoreArgument extends Argument<DMChannel> {
);
}
}

void container.stores.loadPiece({
name: 'dmChannel',
piece: CoreArgument,
store: 'arguments'
});
8 changes: 7 additions & 1 deletion src/arguments/CoreDate.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { PieceContext } from '@sapphire/pieces';
import { container, type PieceContext } from '@sapphire/pieces';
import { Identifiers } from '../lib/errors/Identifiers';
import { resolveDate } from '../lib/resolvers/date';
import { Argument } from '../lib/structures/Argument';
Expand Down Expand Up @@ -26,3 +26,9 @@ export class CoreArgument extends Argument<Date> {
);
}
}

void container.stores.loadPiece({
name: 'date',
piece: CoreArgument,
store: 'arguments'
});
8 changes: 7 additions & 1 deletion src/arguments/CoreEmoji.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { PieceContext } from '@sapphire/pieces';
import { container, type PieceContext } from '@sapphire/pieces';
import { resolveEmoji, type EmojiObject } from '../lib/resolvers/emoji';
import { Argument } from '../lib/structures/Argument';

Expand All @@ -19,3 +19,9 @@ export class CoreArgument extends Argument<EmojiObject> {
);
}
}

void container.stores.loadPiece({
name: 'emoji',
piece: CoreArgument,
store: 'arguments'
});
8 changes: 7 additions & 1 deletion src/arguments/CoreEnum.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { PieceContext } from '@sapphire/pieces';
import { container, type PieceContext } from '@sapphire/pieces';
import { resolveEnum } from '../lib/resolvers/enum';
import { Argument } from '../lib/structures/Argument';
import type { EnumArgumentContext } from '../lib/types/ArgumentContexts';
Expand All @@ -20,3 +20,9 @@ export class CoreArgument extends Argument<string> {
);
}
}

void container.stores.loadPiece({
name: 'enum',
piece: CoreArgument,
store: 'arguments'
});
8 changes: 7 additions & 1 deletion src/arguments/CoreFloat.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { PieceContext } from '@sapphire/pieces';
import { container, type PieceContext } from '@sapphire/pieces';
import { Identifiers } from '../lib/errors/Identifiers';
import { resolveFloat } from '../lib/resolvers/float';
import { Argument } from '../lib/structures/Argument';
Expand Down Expand Up @@ -26,3 +26,9 @@ export class CoreArgument extends Argument<number> {
);
}
}

void container.stores.loadPiece({
name: 'float',
piece: CoreArgument,
store: 'arguments'
});
8 changes: 7 additions & 1 deletion src/arguments/CoreGuild.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { PieceContext } from '@sapphire/pieces';
import { container, type PieceContext } from '@sapphire/pieces';
import type { Guild } from 'discord.js';
import { resolveGuild } from '../lib/resolvers/guild';
import { Argument } from '../lib/structures/Argument';
Expand All @@ -20,3 +20,9 @@ export class CoreArgument extends Argument<Guild> {
);
}
}

void container.stores.loadPiece({
name: 'guild',
piece: CoreArgument,
store: 'arguments'
});
8 changes: 7 additions & 1 deletion src/arguments/CoreGuildCategoryChannel.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { PieceContext } from '@sapphire/pieces';
import { container, type PieceContext } from '@sapphire/pieces';
import type { CategoryChannel } from 'discord.js';
import { Identifiers } from '../lib/errors/Identifiers';
import { resolveGuildCategoryChannel } from '../lib/resolvers/guildCategoryChannel';
Expand Down Expand Up @@ -31,3 +31,9 @@ export class CoreArgument extends Argument<CategoryChannel> {
);
}
}

void container.stores.loadPiece({
name: 'guildCategoryChannel',
piece: CoreArgument,
store: 'arguments'
});
8 changes: 7 additions & 1 deletion src/arguments/CoreGuildChannel.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { GuildBasedChannelTypes } from '@sapphire/discord.js-utilities';
import type { PieceContext } from '@sapphire/pieces';
import { container, type PieceContext } from '@sapphire/pieces';
import { Identifiers } from '../lib/errors/Identifiers';
import { resolveGuildChannel } from '../lib/resolvers/guildChannel';
import { Argument } from '../lib/structures/Argument';
Expand Down Expand Up @@ -31,3 +31,9 @@ export class CoreArgument extends Argument<GuildBasedChannelTypes> {
);
}
}

void container.stores.loadPiece({
name: 'guildChannel',
piece: CoreArgument,
store: 'arguments'
});
8 changes: 7 additions & 1 deletion src/arguments/CoreGuildNewsChannel.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { PieceContext } from '@sapphire/pieces';
import { container, type PieceContext } from '@sapphire/pieces';
import type { NewsChannel } from 'discord.js';
import { Identifiers } from '../lib/errors/Identifiers';
import { resolveGuildNewsChannel } from '../lib/resolvers/guildNewsChannel';
Expand Down Expand Up @@ -31,3 +31,9 @@ export class CoreArgument extends Argument<NewsChannel> {
);
}
}

void container.stores.loadPiece({
name: 'guildNewsChannel',
piece: CoreArgument,
store: 'arguments'
});
8 changes: 7 additions & 1 deletion src/arguments/CoreGuildNewsThreadChannel.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { PieceContext } from '@sapphire/pieces';
import { container, type PieceContext } from '@sapphire/pieces';
import type { ThreadChannel } from 'discord.js';
import { Identifiers } from '../lib/errors/Identifiers';
import { resolveGuildNewsThreadChannel } from '../lib/resolvers/guildNewsThreadChannel';
Expand Down Expand Up @@ -31,3 +31,9 @@ export class CoreArgument extends Argument<ThreadChannel> {
);
}
}

void container.stores.loadPiece({
name: 'guildNewsThreadChannel',
piece: CoreArgument,
store: 'arguments'
});
8 changes: 7 additions & 1 deletion src/arguments/CoreGuildPrivateThreadChannel.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { PieceContext } from '@sapphire/pieces';
import { container, type PieceContext } from '@sapphire/pieces';
import type { ThreadChannel } from 'discord.js';
import { Identifiers } from '../lib/errors/Identifiers';
import { resolveGuildPrivateThreadChannel } from '../lib/resolvers/guildPrivateThreadChannel';
Expand Down Expand Up @@ -31,3 +31,9 @@ export class CoreArgument extends Argument<ThreadChannel> {
);
}
}

void container.stores.loadPiece({
name: 'guildPrivateThreadChannel',
piece: CoreArgument,
store: 'arguments'
});
8 changes: 7 additions & 1 deletion src/arguments/CoreGuildPublicThreadChannel.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { PieceContext } from '@sapphire/pieces';
import { container, type PieceContext } from '@sapphire/pieces';
import type { ThreadChannel } from 'discord.js';
import { Identifiers } from '../lib/errors/Identifiers';
import { resolveGuildPublicThreadChannel } from '../lib/resolvers/guildPublicThreadChannel';
Expand Down Expand Up @@ -31,3 +31,9 @@ export class CoreArgument extends Argument<ThreadChannel> {
);
}
}

void container.stores.loadPiece({
name: 'guildPublicThreadChannel',
piece: CoreArgument,
store: 'arguments'
});
8 changes: 7 additions & 1 deletion src/arguments/CoreGuildStageVoiceChannel.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { PieceContext } from '@sapphire/pieces';
import { container, type PieceContext } from '@sapphire/pieces';
import type { StageChannel } from 'discord.js';
import { Identifiers } from '../lib/errors/Identifiers';
import { resolveGuildStageVoiceChannel } from '../lib/resolvers/guildStageVoiceChannel';
Expand Down Expand Up @@ -31,3 +31,9 @@ export class CoreArgument extends Argument<StageChannel> {
);
}
}

void container.stores.loadPiece({
name: 'guildStageVoiceChannel',
piece: CoreArgument,
store: 'arguments'
});
8 changes: 7 additions & 1 deletion src/arguments/CoreGuildTextChannel.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { PieceContext } from '@sapphire/pieces';
import { container, type PieceContext } from '@sapphire/pieces';
import type { TextChannel } from 'discord.js';
import { Identifiers } from '../lib/errors/Identifiers';
import { resolveGuildTextChannel } from '../lib/resolvers/guildTextChannel';
Expand Down Expand Up @@ -31,3 +31,9 @@ export class CoreArgument extends Argument<TextChannel> {
);
}
}

void container.stores.loadPiece({
name: 'guildTextChannel',
piece: CoreArgument,
store: 'arguments'
});
8 changes: 7 additions & 1 deletion src/arguments/CoreGuildThreadChannel.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { PieceContext } from '@sapphire/pieces';
import { container, type PieceContext } from '@sapphire/pieces';
import type { ThreadChannel } from 'discord.js';
import { Identifiers } from '../lib/errors/Identifiers';
import { resolveGuildThreadChannel } from '../lib/resolvers/guildThreadChannel';
Expand Down Expand Up @@ -31,3 +31,9 @@ export class CoreArgument extends Argument<ThreadChannel> {
);
}
}

void container.stores.loadPiece({
name: 'guildThreadChannel',
piece: CoreArgument,
store: 'arguments'
});
8 changes: 7 additions & 1 deletion src/arguments/CoreGuildVoiceChannel.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { PieceContext } from '@sapphire/pieces';
import { container, type PieceContext } from '@sapphire/pieces';
import type { VoiceChannel } from 'discord.js';
import { Identifiers } from '../lib/errors/Identifiers';
import { resolveGuildVoiceChannel } from '../lib/resolvers/guildVoiceChannel';
Expand Down Expand Up @@ -31,3 +31,9 @@ export class CoreArgument extends Argument<VoiceChannel> {
);
}
}

void container.stores.loadPiece({
name: 'guildVoiceChannel',
piece: CoreArgument,
store: 'arguments'
});
8 changes: 7 additions & 1 deletion src/arguments/CoreHyperlink.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { PieceContext } from '@sapphire/pieces';
import { container, type PieceContext } from '@sapphire/pieces';
import type { URL } from 'node:url';
import { resolveHyperlink } from '../lib/resolvers/hyperlink';
import { Argument } from '../lib/structures/Argument';
Expand All @@ -20,3 +20,9 @@ export class CoreArgument extends Argument<URL> {
);
}
}

void container.stores.loadPiece({
name: 'hyperlink',
piece: CoreArgument,
store: 'arguments'
});
8 changes: 7 additions & 1 deletion src/arguments/CoreInteger.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { PieceContext } from '@sapphire/pieces';
import { container, type PieceContext } from '@sapphire/pieces';
import { Identifiers } from '../lib/errors/Identifiers';
import { resolveInteger } from '../lib/resolvers/integer';
import { Argument } from '../lib/structures/Argument';
Expand Down Expand Up @@ -26,3 +26,9 @@ export class CoreArgument extends Argument<number> {
);
}
}

void container.stores.loadPiece({
name: 'integer',
piece: CoreArgument,
store: 'arguments'
});
8 changes: 7 additions & 1 deletion src/arguments/CoreMember.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { PieceContext } from '@sapphire/pieces';
import { container, type PieceContext } from '@sapphire/pieces';
import type { GuildMember } from 'discord.js';
import { Identifiers } from '../lib/errors/Identifiers';
import { resolveMember } from '../lib/resolvers/member';
Expand Down Expand Up @@ -33,3 +33,9 @@ export class CoreArgument extends Argument<GuildMember> {
);
}
}

void container.stores.loadPiece({
name: 'member',
piece: CoreArgument,
store: 'arguments'
});
8 changes: 7 additions & 1 deletion src/arguments/CoreMessage.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { PieceContext } from '@sapphire/pieces';
import { container, type PieceContext } from '@sapphire/pieces';
import type { Message } from 'discord.js';
import { resolveMessage } from '../lib/resolvers/message';
import { Argument } from '../lib/structures/Argument';
Expand Down Expand Up @@ -27,3 +27,9 @@ export class CoreArgument extends Argument<Message> {
);
}
}

void container.stores.loadPiece({
name: 'message',
piece: CoreArgument,
store: 'arguments'
});
8 changes: 7 additions & 1 deletion src/arguments/CoreNumber.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { PieceContext } from '@sapphire/pieces';
import { container, type PieceContext } from '@sapphire/pieces';
import { Identifiers } from '../lib/errors/Identifiers';
import { resolveNumber } from '../lib/resolvers/number';
import { Argument } from '../lib/structures/Argument';
Expand Down Expand Up @@ -26,3 +26,9 @@ export class CoreArgument extends Argument<number> {
);
}
}

void container.stores.loadPiece({
name: 'number',
piece: CoreArgument,
store: 'arguments'
});
8 changes: 7 additions & 1 deletion src/arguments/CorePartialDMChannel.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { PieceContext } from '@sapphire/pieces';
import { container, type PieceContext } from '@sapphire/pieces';
import type { DMChannel, PartialDMChannel } from 'discord.js';
import { resolvePartialDMChannel } from '../lib/resolvers/partialDMChannel';
import { Argument } from '../lib/structures/Argument';
Expand All @@ -20,3 +20,9 @@ export class CoreArgument extends Argument<DMChannel | PartialDMChannel> {
);
}
}

void container.stores.loadPiece({
name: 'partialDMChannel',
piece: CoreArgument,
store: 'arguments'
});
Loading

0 comments on commit 41bcc9b

Please sign in to comment.