Docs: Update

This commit is contained in:
March 7th 2022-11-18 19:23:12 +07:00
parent 21261de111
commit 3e23407ed0
5 changed files with 26 additions and 60 deletions

View File

@ -1,17 +0,0 @@
## HTTP options:
- Change API v9 to v10
```js
/* If you want to change the API version from v9 to v10, here are the instructions */
const { Client } = require('discord.js-selfbot-v13');
const client = new Client({
ws: {
version: 10
},
http: {
version: 10,
header: {
cookie: '', // If you want to use cookies, here is the place
}
}
});
```

View File

@ -1,10 +1,4 @@
# Slash command demo
- Support Autocomplete feature (half)
- Unused `guild.searchInteraction()` (Deleted)
# <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
# Slash Command (no options)
@ -12,38 +6,25 @@
![image](https://user-images.githubusercontent.com/71698422/173344527-86520c60-64cd-459c-ba3b-d35f14279f93.png)
`vietnamese .-.`
### Code test
### Code
```js
await message.channel.sendSlash('botid', 'aiko')
```
### Result
![image](https://user-images.githubusercontent.com/71698422/173346835-c747daa5-cd99-41df-9d28-fecf3b7e1ac9.png)
# Slash Command + Sub option (group)
### Demo (v2.5)
### Demo
![image](https://user-images.githubusercontent.com/71698422/173346438-678009a1-870c-49a2-97fe-8ceed4f1ab64.png)
### Code test
```diff
v2.5
- await message.channel.sendSlash('450323683840491530', 'animal', 'chat', 'bye')
v2.6+
+ await message.channel.sendSlash('450323683840491530', 'animal chat', 'bye')
```js
await message.channel.sendSlash('450323683840491530', 'animal chat', 'bye')
```
### Result
![image](https://user-images.githubusercontent.com/71698422/173346620-ba54f0d8-efc6-4f40-9093-34feda171a3c.png)
# Slash Command with Attachment (must use MessageAttachment)
# Slash Command with Attachment
### Demo

View File

@ -173,6 +173,7 @@ class GuildMemberManager extends CachedManager {
* guild.members.fetch({ query: 'hydra', limit: 1 })
* .then(console.log)
* .catch(console.error);
* @see {@link https://github.com/aiko-chan-ai/discord.js-selfbot-v13/blob/main/Document/FetchGuildMember.md}
*/
fetch(options) {
if (!options || !options?.query) {

View File

@ -375,6 +375,7 @@ class ClientUser extends User {
* @example
* // Set the client user's presence
* client.user.setPresence({ activities: [{ name: 'with discord.js' }], status: 'idle' });
* @see {@link https://github.com/aiko-chan-ai/discord.js-selfbot-v13/blob/main/Document/RichPresence.md}
*/
setPresence(data) {
return this.client.presence.set(data);
@ -419,6 +420,7 @@ class ClientUser extends User {
* @example
* // Set the client user's activity
* client.user.setActivity('discord.js', { type: 'WATCHING' });
* @see {@link https://github.com/aiko-chan-ai/discord.js-selfbot-v13/blob/main/Document/RichPresence.md}
*/
setActivity(name, options = {}) {
if (!name) {
@ -444,21 +446,21 @@ class ClientUser extends User {
/**
* Create an invite [Friend Invites]
* @param {CreateInviteOptions} [options={}] The options for creating the invite [maxAge and maxUses are available]
* maxAge: 86400 | maxUses: 0
* @returns {Promise<Invite>}
* @see https://github.com/13-05/hidden-disc-docs#js-snippet-for-creating-friend-invites
* @see {@link https://github.com/13-05/hidden-disc-docs#js-snippet-for-creating-friend-invites}
* @example
* // Options not working
* client.user.getInvite();
* .then(console.log)
* .catch(console.error);
*/
async getInvite({ maxAge = 86400, maxUses = 0 } = {}) {
async getInvite() {
const data = await this.client.api.users['@me'].invites.post({
data: {
validate: null,
max_age: maxAge,
max_uses: maxUses,
max_age: 86400,
max_uses: 0,
target_type: 2,
temporary: false,
},

View File

@ -437,21 +437,21 @@ class TextBasedChannel {
/**
* Send Slash to this channel
* @param {UserResolvable} bot Bot user
* @param {UserResolvable} bot Bot user (BotID, not applicationID)
* @param {string} commandString Command name (and sub / group formats)
* @param {...?any|any[]} args Command arguments
* @returns {Promise<InteractionResponse>}
* @example
* // Send Slash to this channel
* // Demo:
* // + BotID: "123456789012345678"
* // + CommandName: "embed"
* // + Args: "title", "description", "author", 'color' (Optional)
* channel.sendSlash('123456789012345678', 'embed', 'title', 'description', 'author', '#00ff00')
* // Send embed with Title and Color:
* channel.sendSlash('123456789012345678', 'embed', 'title', undefined, undefined, '#00ff00')
* // CommandName is Group Command / Sub Command
* channel.sendSlash('123456789012345678', 'embed title', 'description', 'author', '#00ff00')
* // Send a basic slash
* channel.sendSlash('botid', 'ping)
* .then(console.log)
* .catch(console.error);
* @example
* // Send a remote file
* channel.send('botid', 'emoji upload', 'https://cdn.discordapp.com/icons/222078108977594368/6e1019b3179d71046e463a75915e7244.png?size=2048', 'test')
* .then(console.log)
* .catch(console.error);
* @see {@link https://github.com/aiko-chan-ai/discord.js-selfbot-v13/blob/main/Document/SlashCommand.md}
*/
async sendSlash(bot, commandString, ...args) {
const perms =
@ -462,7 +462,7 @@ class TextBasedChannel {
throw new Error(
'INTERACTION_SEND_FAILURE',
`Cannot send Slash to ${this.toString()} ${
this.recipient ? 'because user has been blocked' : 'due to missing SEND_MESSAGES permission'
this.recipient ? 'because bot has been blocked' : 'due to missing SEND_MESSAGES permission'
}`,
);
}
@ -485,7 +485,6 @@ class TextBasedChannel {
}
if (!bot) throw new Error('MUST_SPECIFY_BOT');
const botId = this.client.users.resolveId(bot);
// ? maybe ...
const user = await this.client.users.fetch(botId).catch(() => {});
if (!user || !user.bot || !user.application) {
throw new Error('botId is not a bot or does not have an application slash command');