You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -153,24 +153,158 @@ Here's an example `content` command which replies with the content of the target
153
153
154
154
</Tabs>
155
155
156
+
## Autocomplete function
157
+
158
+
In addition to the `run` function, you can also export an `autocomplete` function from your command file so that you don't have to create a new `"interactionCreate"` event listener.
159
+
160
+
Here's an example of how to use the `autocomplete` function:
161
+
162
+
<Tabsitems={['CommonJS', 'ESM', 'TypeScript']}>
163
+
<Tabs.Tab>
164
+
```js filename="commands/Fun/pet.js" copy
165
+
constpets=require('../data/pets.json');
166
+
167
+
module.exports= {
168
+
data:newSlashCommandBuilder()
169
+
.setName('pet')
170
+
.setDescription('Find a pet from a list of pets.')
Copy file name to clipboardExpand all lines: apps/docs/pages/guide/commandkit-setup.mdx
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -165,4 +165,4 @@ This is used to disable CommandKit's built-in validation functions. Setting this
165
165
- Type: `boolean`
166
166
- Default: `false`
167
167
168
-
This is used to change the behaviour of how CommandKit loads application commands. By default it's one-by-one while comparing changes. Setting this option to `true` will load application commands all at once on every restart, and when [reloadCommands()](/typedef/CommandKit#reloadcommands) is called.
168
+
This is used to change the behaviour of how CommandKit loads application commands. By default it's one-by-one while comparing changes. Setting this option to `true` will load application commands all at once on every restart, and when [`reloadCommands()`](/docs/typedef/CommandKit#reloadcommands) is called.
0 commit comments