71 lines
2.3 KiB
Markdown
71 lines
2.3 KiB
Markdown
# Slash command demo
|
|
- Support Autocomplete feature (half)
|
|
- Unused `guild.searchInteraction()` (Use only if not working properly)
|
|
|
|
# <strong>BREAKING CHANGE: Using Slash Command (Sub Command / Sub Group Command) will not accept subCommand argument in args. That means Command Name needs to be changed same as Discord Client</strong>
|
|
|
|
# All image demo : v2.3
|
|
|
|
# Slash Command (no options)
|
|
|
|
### Demo
|
|
|
|

|
|
|
|
`vietnamese .-.`
|
|
|
|
### Code test
|
|
|
|
```js
|
|
await message.channel.sendSlash('botid', 'aiko')
|
|
```
|
|
|
|
### Result
|
|
|
|

|
|
|
|
# Slash Command + Sub option (group)
|
|
|
|
### Demo (v2.5)
|
|
|
|

|
|
|
|
### Code test
|
|
|
|
```diff
|
|
v2.5
|
|
- await message.channel.sendSlash('450323683840491530', 'animal', 'chat', 'bye')
|
|
v2.6+
|
|
+ await message.channel.sendSlash('450323683840491530', 'animal chat', 'bye')
|
|
```
|
|
|
|
### Result
|
|
|
|

|
|
|
|
# Slash Command with Attachment (must use MessageAttachment)
|
|
|
|
### Demo
|
|
|
|

|
|
|
|
### Code test
|
|
|
|
```js
|
|
const { MessageAttachment } = require('discord.js-selfbot-v13')
|
|
const fs = require('fs')
|
|
const a = new MessageAttachment(fs.readFileSync('./wallpaper.jpg') , 'test.jpg')
|
|
await message.channel.sendSlash('718642000898818048', 'sauce', a)
|
|
```
|
|
|
|
### Result
|
|
|
|

|
|
|
|
# Events
|
|
|
|
- [interactionCreate](https://discordjs-self-v13.netlify.app/#/docs/docs/main/class/Client?scrollTo=e-interactionCreate)
|
|
- [interactionFailure](https://discordjs-self-v13.netlify.app/#/docs/docs/main/class/Client?scrollTo=e-interactionFailure)
|
|
- [interactionSuccess](https://discordjs-self-v13.netlify.app/#/docs/docs/main/class/Client?scrollTo=e-interactionSuccess)
|
|
- [interactionModalCreate](https://discordjs-self-v13.netlify.app/#/docs/docs/main/class/Client?scrollTo=e-interactionModalCreate)
|