Skip to content

Commit e6d2eb8

Browse files
authored
Merge pull request #489 from underctrl-io/ai-sdk-5
feat!: ai sdk 5
2 parents c601bfd + fa70928 commit e6d2eb8

Some content is hidden

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

43 files changed

+239
-523
lines changed

apps/test-bot/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"node": "node"
1111
},
1212
"dependencies": {
13-
"@ai-sdk/google": "^1.2.19",
13+
"@ai-sdk/google": "^2.0.8",
1414
"@commandkit/ai": "workspace:*",
1515
"@commandkit/cache": "workspace:*",
1616
"@commandkit/devtools": "workspace:*",

apps/website/docs/guide/01-getting-started/02-setup-commandkit.mdx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
---
22
title: Setup CommandKit
3-
description:
4-
Setup a new CommandKit project using the create-commandkit CLI
3+
description: Setup a new CommandKit project using the create-commandkit CLI
54
---
65

76
:::info

apps/website/docs/guide/02-commands/02-command-options-autocomplete.mdx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,7 @@ const pets = Array.from({ length: 20 }, (_, i) => ({
4747
value: `petId_${i}`,
4848
}));
4949

50-
export const autocomplete: AutocompleteCommand = async ({
51-
interaction,
52-
}) => {
50+
export const autocomplete: AutocompleteCommand = async ({ interaction }) => {
5351
try {
5452
// Get the input value of your autocomplete option
5553
const input = interaction.options.getString('name', false);
@@ -69,9 +67,7 @@ export const autocomplete: AutocompleteCommand = async ({
6967
}
7068
};
7169

72-
export const chatInput: ChatInputCommand = async ({
73-
interaction,
74-
}) => {
70+
export const chatInput: ChatInputCommand = async ({ interaction }) => {
7571
const chosenPetId = interaction.options.getString('name', true);
7672
const chosenPet = pets.find((pet) => pet.value === chosenPetId);
7773

apps/website/docs/guide/02-commands/03-context-menu-commands.mdx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@ understanding the nature of these context menu commands easier.
2020
## Message context menu command
2121

2222
```ts title="src/app/commands/report-message.ts"
23-
import type {
24-
CommandData,
25-
MessageContextMenuCommand,
26-
} from 'commandkit';
23+
import type { CommandData, MessageContextMenuCommand } from 'commandkit';
2724
import { MessageFlags } from 'discord.js';
2825

2926
export const command: CommandData = {

apps/website/docs/guide/02-commands/05-after-function.mdx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,7 @@ cleanup tasks.
1010
## Usage
1111

1212
```ts title="src/app/commands/ping.ts"
13-
import {
14-
type CommandData,
15-
type ChatInputCommand,
16-
after,
17-
} from 'commandkit';
13+
import { type CommandData, type ChatInputCommand, after } from 'commandkit';
1814

1915
export const command: CommandData = {};
2016

apps/website/docs/guide/02-commands/07-middlewares.mdx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ import { MiddlewareContext } from 'commandkit';
2121

2222
export function beforeExecute(ctx: MiddlewareContext) {
2323
// This function will be executed before the command is executed
24-
console.log(
25-
`User ${ctx.interaction.user.id} is about to execute a command`,
26-
);
24+
console.log(`User ${ctx.interaction.user.id} is about to execute a command`);
2725
}
2826

2927
export function afterExecute(ctx: MiddlewareContext) {
@@ -68,9 +66,7 @@ import type { MiddlewareContext } from 'commandkit';
6866
export function beforeExecute(ctx: MiddlewareContext) {
6967
// This middleware will run before any moderation command
7068
if (!ctx.interaction.member.permissions.has('KickMembers')) {
71-
throw new Error(
72-
'You need moderation permissions to use this command',
73-
);
69+
throw new Error('You need moderation permissions to use this command');
7470
}
7571
}
7672
```

apps/website/docs/guide/03-events/01-discordjs-events.mdx

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,7 @@ Some Discord.js events have multiple parameters, such as the
106106
```ts title="src/app/events/messageUpdate/log-message-update.ts"
107107
import type { EventHandler } from 'commandkit';
108108

109-
const handler: EventHandler<'messageUpdate'> = (
110-
oldMessage,
111-
newMessage,
112-
) => {
109+
const handler: EventHandler<'messageUpdate'> = (oldMessage, newMessage) => {
113110
console.log(
114111
`Message from ${oldMessage.author?.username} updated: ${oldMessage.content} -> ${newMessage.content}`,
115112
);
@@ -135,9 +132,7 @@ const handler: EventHandler<'messageCreate'> = (
135132
client,
136133
commandkit,
137134
) => {
138-
console.log(
139-
`Message from ${message.author.username}: ${message.content}`,
140-
);
135+
console.log(`Message from ${message.author.username}: ${message.content}`);
141136
};
142137

143138
export default handler;
@@ -171,9 +166,7 @@ export default handler;
171166
import type { EventHandler } from 'commandkit';
172167

173168
const handler: EventHandler<'messageCreate'> = (message) => {
174-
console.log(
175-
`Message from ${message.author.username}: ${message.content}`,
176-
);
169+
console.log(`Message from ${message.author.username}: ${message.content}`);
177170
};
178171

179172
export default handler;

apps/website/docs/guide/04-jsx-components/01-using-jsx.mdx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,7 @@ builders:
4040
## Example usage
4141

4242
```tsx
43-
import {
44-
Container,
45-
TextDisplay,
46-
ActionRow,
47-
Button,
48-
} from 'commandkit';
43+
import { Container, TextDisplay, ActionRow, Button } from 'commandkit';
4944
import { ButtonStyle } from 'discord.js';
5045

5146
const message = (

apps/website/docs/guide/04-jsx-components/02-discord-components-v1/01-action-row.mdx

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ components like buttons and select menus together in a single row.
1010
```tsx title="src/app/commands/example.tsx"
1111
import { type ChatInputCommand, ActionRow, Button } from 'commandkit';
1212

13-
export const chatInput: ChatInputCommand = async ({
14-
interaction,
15-
}) => {
13+
export const chatInput: ChatInputCommand = async ({ interaction }) => {
1614
const row = (
1715
<ActionRow>
1816
<Button customId="button-1">Click me!</Button>
@@ -37,9 +35,7 @@ import {
3735
StringSelectMenuOption,
3836
} from 'commandkit';
3937

40-
export const chatInput: ChatInputCommand = async ({
41-
interaction,
42-
}) => {
38+
export const chatInput: ChatInputCommand = async ({ interaction }) => {
4339
const row = (
4440
<ActionRow>
4541
<StringSelectMenu placeholder="Choose an option">
@@ -65,9 +61,7 @@ components:
6561
import { type ChatInputCommand, ActionRow, Button } from 'commandkit';
6662
import { ButtonStyle } from 'discord.js';
6763

68-
export const chatInput: ChatInputCommand = async ({
69-
interaction,
70-
}) => {
64+
export const chatInput: ChatInputCommand = async ({ interaction }) => {
7165
const firstRow = (
7266
<ActionRow>
7367
<Button style={ButtonStyle.Primary} customId="button-1">

apps/website/docs/guide/04-jsx-components/02-discord-components-v1/02-button.mdx

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ emojis.
1111
```tsx title="src/app/commands/button-example.tsx"
1212
import { type ChatInputCommand, ActionRow, Button } from 'commandkit';
1313

14-
export const chatInput: ChatInputCommand = async ({
15-
interaction,
16-
}) => {
14+
export const chatInput: ChatInputCommand = async ({ interaction }) => {
1715
const buttonRow = (
1816
<ActionRow>
1917
<Button customId="clickme-button">Click me!</Button>
@@ -36,9 +34,7 @@ Discord provides several button styles that you can import from the
3634
import { type ChatInputCommand, ActionRow, Button } from 'commandkit';
3735
import { ButtonStyle } from 'discord.js';
3836

39-
export const chatInput: ChatInputCommand = async ({
40-
interaction,
41-
}) => {
37+
export const chatInput: ChatInputCommand = async ({ interaction }) => {
4238
const buttons = (
4339
<ActionRow>
4440
<Button style={ButtonStyle.Primary} customId="primary">
@@ -71,9 +67,7 @@ Link buttons redirect users to external URLs:
7167
import { type ChatInputCommand, ActionRow, Button } from 'commandkit';
7268
import { ButtonStyle } from 'discord.js';
7369

74-
export const chatInput: ChatInputCommand = async ({
75-
interaction,
76-
}) => {
70+
export const chatInput: ChatInputCommand = async ({ interaction }) => {
7771
const linkButton = (
7872
<ActionRow>
7973
<Button style={ButtonStyle.Link} url="https://discord.com">
@@ -96,9 +90,7 @@ Add emojis to make your buttons more visually appealing:
9690
```tsx title="src/app/commands/emoji-button.tsx"
9791
import { type ChatInputCommand, ActionRow, Button } from 'commandkit';
9892

99-
export const chatInput: ChatInputCommand = async ({
100-
interaction,
101-
}) => {
93+
export const chatInput: ChatInputCommand = async ({ interaction }) => {
10294
const emojiButton = (
10395
<ActionRow>
10496
<Button emoji="🎮" customId="play-game">
@@ -124,9 +116,7 @@ Disable buttons to prevent interaction:
124116
```tsx title="src/app/commands/disabled-button.tsx"
125117
import { type ChatInputCommand, ActionRow, Button } from 'commandkit';
126118

127-
export const chatInput: ChatInputCommand = async ({
128-
interaction,
129-
}) => {
119+
export const chatInput: ChatInputCommand = async ({ interaction }) => {
130120
const disabledButton = (
131121
<ActionRow>
132122
<Button disabled customId="disabled">
@@ -156,10 +146,7 @@ import {
156146
} from 'commandkit';
157147
import { MessageFlags } from 'discord.js';
158148

159-
const handleClick: OnButtonKitClick = async (
160-
interaction,
161-
context,
162-
) => {
149+
const handleClick: OnButtonKitClick = async (interaction, context) => {
163150
await interaction.reply({
164151
content: 'Button clicked!',
165152
flags: MessageFlags.Ephemeral,
@@ -169,9 +156,7 @@ const handleClick: OnButtonKitClick = async (
169156
context.dispose();
170157
};
171158

172-
export const chatInput: ChatInputCommand = async ({
173-
interaction,
174-
}) => {
159+
export const chatInput: ChatInputCommand = async ({ interaction }) => {
175160
const interactiveButton = (
176161
<ActionRow>
177162
<Button onClick={handleClick} customId="clickme-button">

0 commit comments

Comments
 (0)