Skip to content

Commit 41330f3

Browse files
committed
2 parents 4ba3d91 + 98fcc28 commit 41330f3

File tree

42 files changed

+303
-990
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+303
-990
lines changed

.github/workflows/dev-commandkit.yaml

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,40 @@
1-
name: (CommandKit) Publish Dev Build
1+
name: (CommandKit) Publish Dev Builds
22

33
on:
4+
workflow_dispatch:
45
push:
56
branches:
67
- main
78
paths:
89
- 'packages/commandkit/**'
10+
- 'packages/create-commandkit/**'
11+
- 'packages/legacy/**'
12+
- 'packages/redis/**'
913

1014
jobs:
1115
release:
1216
name: 🚀 Publish Dev Build
1317
runs-on: ubuntu-latest
18+
timeout-minutes: 7
19+
strategy:
20+
matrix:
21+
package:
22+
[
23+
commandkit,
24+
create-commandkit,
25+
'@commandkit/legacy',
26+
'@commandkit/redis',
27+
]
28+
include:
29+
- package: commandkit
30+
path: packages/commandkit
31+
- package: create-commandkit
32+
path: packages/create-commandkit
33+
- package: '@commandkit/legacy'
34+
path: packages/legacy
35+
- package: '@commandkit/redis'
36+
path: packages/redis
37+
fail-fast: false
1438
steps:
1539
- uses: pnpm/action-setup@v2
1640
with:
@@ -30,7 +54,7 @@ jobs:
3054

3155
- name: 🔢 Update Version
3256
run: |
33-
cd packages/commandkit
57+
cd ${{ matrix.path }}
3458
node -e "const pkg = require('./package.json'); \
3559
const newVersion = pkg.version + '-dev.' + new Date().toISOString().replace(/[:\-T]/g, '').substr(0,14); \
3660
pkg.version = newVersion; \
@@ -39,18 +63,16 @@ jobs:
3963
DEBIAN_FRONTEND: noninteractive
4064

4165
- name: 🧱 Build
42-
run: pnpm --filter './packages/commandkit' run build
66+
run: pnpm run build
4367

4468
- name: 🚚 Publish
45-
run: |
46-
cd packages/commandkit
47-
npm publish --access public --tag dev
69+
run: pnpm --filter=${{ matrix.package }} publish --no-git-checks --access public --tag dev
4870
env:
4971
NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}
5072

5173
- name: 🚫 Deprecate Previous Dev Version
5274
run: |
53-
PACKAGE_NAME=$(node -e "console.log(require('./packages/commandkit/package.json').name);")
75+
PACKAGE_NAME=${{ matrix.package }}
5476
ALL_VERSIONS=$(npm info $PACKAGE_NAME versions -json)
5577
VERSION_TO_DEPRECATE=$(echo $ALL_VERSIONS | node -e "
5678
const versions = JSON.parse(require('fs').readFileSync('/dev/stdin', 'utf-8'));
@@ -60,6 +82,5 @@ jobs:
6082
")
6183
echo Deprecating version $VERSION_TO_DEPRECATE
6284
npm deprecate $PACKAGE_NAME@$VERSION_TO_DEPRECATE "Deprecated dev version."
63-
6485
env:
6586
NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}

.github/workflows/dev-create-commandkit.yaml

Lines changed: 0 additions & 65 deletions
This file was deleted.

.github/workflows/dev-redis.yaml

Lines changed: 0 additions & 67 deletions
This file was deleted.

apps/test-bot/commandkit.config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,4 @@ import { legacy } from '@commandkit/legacy';
33

44
export default defineConfig({
55
plugins: [legacy({ skipBuiltInValidations: true })],
6-
typedLocales: true,
76
});

apps/test-bot/src/app/commands/(general)/avatar.ts

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,10 @@ export const command = {
2020
export async function userContextMenu(ctx: UserContextMenuCommandContext) {
2121
const target = ctx.interaction.targetUser;
2222

23-
const { t } = ctx.locale<'avatar'>();
24-
25-
const msg = await t('avatar', { user: target.username });
26-
2723
await ctx.interaction.reply({
2824
embeds: [
2925
{
30-
title: msg,
26+
title: `${target.username}'s Avatar`,
3127
image: {
3228
url: target.displayAvatarURL({ size: 2048 }),
3329
},
@@ -39,14 +35,11 @@ export async function userContextMenu(ctx: UserContextMenuCommandContext) {
3935

4036
export async function chatInput(ctx: SlashCommandContext) {
4137
const user = ctx.options.getUser('user') ?? ctx.interaction.user;
42-
const { t } = ctx.locale<'avatar'>();
43-
44-
const msg = await t('avatar', { user: user.username });
4538

4639
await ctx.interaction.reply({
4740
embeds: [
4841
{
49-
title: msg,
42+
title: `${user.username}'s Avatar`,
5043
image: {
5144
url: user.displayAvatarURL({ size: 2048 }),
5245
},
@@ -59,14 +52,10 @@ export async function chatInput(ctx: SlashCommandContext) {
5952
export async function message(ctx: MessageCommandContext) {
6053
const user = ctx.options.getUser('user') ?? ctx.message.author;
6154

62-
const { t } = ctx.locale<'avatar'>();
63-
64-
const msg = await t('avatar', { user: user.username });
65-
6655
await ctx.message.reply({
6756
embeds: [
6857
{
69-
title: msg,
58+
title: `${user.username}'s Avatar`,
7059
image: {
7160
url: user.displayAvatarURL({ size: 2048 }),
7261
},

apps/test-bot/src/app/commands/(general)/ping.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@ import {
44
ButtonStyle,
55
} from 'discord.js';
66
import {
7-
SlashCommandProps,
8-
CommandOptions,
97
CommandData,
108
ButtonKit,
11-
AutocompleteProps,
9+
SlashCommandContext,
10+
AutocompleteCommandContext,
1211
} from 'commandkit';
1312

1413
export const command: CommandData = {
@@ -30,7 +29,9 @@ const tests = Array.from({ length: 10 }, (_, i) => ({
3029
value: `${i}_test`,
3130
}));
3231

33-
export async function autocomplete({ interaction }: AutocompleteProps) {
32+
export async function autocomplete({
33+
interaction,
34+
}: AutocompleteCommandContext) {
3435
const arg = interaction.options.getString('test', false);
3536
console.log(arg);
3637
if (!arg) return interaction.respond(tests);
@@ -42,7 +43,7 @@ export async function autocomplete({ interaction }: AutocompleteProps) {
4243
interaction.respond(filtered);
4344
}
4445

45-
export async function chatInput({ interaction, client }: SlashCommandProps) {
46+
export async function chatInput({ interaction, client }: SlashCommandContext) {
4647
if (!interaction.channel) return;
4748

4849
const button = new ButtonKit()
@@ -77,7 +78,3 @@ export async function chatInput({ interaction, client }: SlashCommandProps) {
7778
message.edit({ components: [row] });
7879
});
7980
}
80-
81-
export const options: CommandOptions = {
82-
devOnly: true,
83-
};

apps/test-bot/src/app/commands/(interactions)/commandkit.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import CommandKit, {
22
Button,
33
ActionRow,
4-
SlashCommandProps,
54
CommandData,
65
OnButtonKitClick,
6+
SlashCommandContext,
77
} from 'commandkit';
88
import { MessageFlags } from 'discord.js';
99

@@ -40,7 +40,7 @@ function ButtonGrid() {
4040
);
4141
}
4242

43-
export async function chatInput({ interaction }: SlashCommandProps) {
43+
export async function chatInput({ interaction }: SlashCommandContext) {
4444
await interaction.deferReply();
4545

4646
await interaction.editReply({

apps/test-bot/src/app/commands/(interactions)/confirmation.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import CommandKit, {
22
Button,
33
ActionRow,
4-
SlashCommandProps,
4+
SlashCommandContext,
55
CommandData,
66
OnButtonKitClick,
77
} from 'commandkit';
@@ -30,7 +30,7 @@ const handleCancel: OnButtonKitClick = async (interaction, context) => {
3030
context.dispose();
3131
};
3232

33-
export async function chatInput({ interaction }: SlashCommandProps) {
33+
export async function chatInput({ interaction }: SlashCommandContext) {
3434
const buttons = (
3535
<ActionRow>
3636
<Button onClick={handleCancel} style={ButtonStyle.Primary}>

apps/test-bot/src/app/commands/(interactions)/prompt.tsx

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,13 @@ const handleSubmit: OnModalKitSubmit = async (interaction, context) => {
2727
};
2828

2929
export async function chatInput(ctx: SlashCommandContext) {
30-
const { t } = ctx.locale();
31-
32-
const title = await t('modal.title');
33-
const label = await t('input.label');
34-
const description = await t('input.placeholder');
35-
3630
const modal = (
37-
<Modal title={title} onSubmit={handleSubmit}>
31+
<Modal title={'Modal'} onSubmit={handleSubmit}>
3832
<ShortInput customId="name" label="Name" placeholder="John" required />
3933
<ParagraphInput
4034
customId="description"
41-
label={label}
42-
placeholder={description}
35+
label={'Description'}
36+
placeholder={'Enter a description here...'}
4337
/>
4438
</Modal>
4539
);

apps/test-bot/src/app/commands/(leveling)/xp.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { SlashCommandProps, CommandData, cacheTag } from 'commandkit';
1+
import { SlashCommandContext, CommandData, cacheTag } from 'commandkit';
22
import { database } from '../../../database/store.ts';
33

44
export const command: CommandData = {
@@ -17,7 +17,7 @@ async function getUserXP(guildId: string, userId: string) {
1717
return xp;
1818
}
1919

20-
export async function chatInput({ interaction }: SlashCommandProps) {
20+
export async function chatInput({ interaction }: SlashCommandContext) {
2121
await interaction.deferReply();
2222

2323
const dataRetrievalStart = Date.now();

0 commit comments

Comments
 (0)