1.3.4
Get interaction commands using gateway
This commit is contained in:
68
Document/API.md
Normal file
68
Document/API.md
Normal file
@@ -0,0 +1,68 @@
|
||||
# Extending Discord.js-selfbot-v13
|
||||
> `credit: Discum`
|
||||
|
||||
How to add extra API wraps to Discord.js-selfbot-v13?
|
||||
# Table of Contents
|
||||
- [HTTP APIs](#HTTP-APIs)
|
||||
- [Gateway APIs](#Gateway-APIs)
|
||||
|
||||
### HTTP APIs:
|
||||
|
||||
```js
|
||||
URL example:
|
||||
'https://discord.com/api/v9/users/@me'
|
||||
const url = client.api.users['@me'];
|
||||
/* Method: GET | POST | PUT | PATCH | DELETE */
|
||||
```
|
||||
|
||||
|
||||
###### GET:
|
||||
```js
|
||||
await client.api.users['@me'].get({ versioned: true });
|
||||
/* Request: https://discord.com/api/v9/users/@me */
|
||||
await client.api.users['@me'].get({ versioned: false });
|
||||
/* Request: https://discord.com/api/users/@me */
|
||||
```
|
||||
###### POST:
|
||||
```js
|
||||
await client.api.channels[channel.id].messages.post({ versioned: true, data: {}, files: [] });
|
||||
/* Request: https://discord.com/api/v9/channels/{channel.id}/messages */
|
||||
```
|
||||
###### PUT:
|
||||
```js
|
||||
await client.api
|
||||
.guilds(guild.id)
|
||||
.bans(user.id)
|
||||
.put({
|
||||
versioned: true,
|
||||
data: {},
|
||||
});
|
||||
/* Request: https://discord.com/api/guilds/{guild.id}/bans/{user.id} */
|
||||
```
|
||||
###### PATCH:
|
||||
```js
|
||||
await client.api.users['@me'].patch({ versioned: true, data: {} });
|
||||
/* Request: https://discord.com/api/v9/users/@me */
|
||||
```
|
||||
###### DELETE:
|
||||
```js
|
||||
await client.api.hypesquad.online.delete({ versioned: true });
|
||||
/* Request: https://discord.com/api/v9/hypesquad/online */
|
||||
```
|
||||
### Gateway APIs
|
||||
You need to send data to the port and listen for an event. This is quite complicated but if you want to use an existing event, here are the instructions
|
||||
|
||||
###### SEND:
|
||||
```js
|
||||
const { Constants } = require('discord.js-selfbot-v13');
|
||||
// Global gateway (example update presence)
|
||||
client.ws.broadcast({
|
||||
op: Constants.Opcodes.STATUS_UPDATE,
|
||||
d: {},
|
||||
});
|
||||
// Guild gateway (example get all members)
|
||||
guild.shard.send({
|
||||
op: Constants.Opcodes.REQUEST_GUILD_MEMBERS,
|
||||
d: {},
|
||||
});
|
||||
```
|
@@ -4,6 +4,30 @@
|
||||
|
||||
## Interaction
|
||||
<details>
|
||||
<summary>Fetch Commands data</summary>
|
||||
|
||||
```js
|
||||
/* Save to cache */
|
||||
// In guild (Opcode 24)
|
||||
await guild.searchInteraction(
|
||||
{
|
||||
limit: 100, // default: 1
|
||||
query: 'ping', // optional
|
||||
type: 'CHAT_INPUT', // default: 'CHAT_INPUT'
|
||||
offset: 0, // default: 0
|
||||
botID: ['botid1', 'botid2'], // optional
|
||||
}
|
||||
);
|
||||
// Fetch all commands (1 bot) Shouldn't be used
|
||||
await bot.applications.fetch(
|
||||
{
|
||||
guildId: 'guild id to search', // optional
|
||||
force: false, // Using cache or createDMs to bot
|
||||
}
|
||||
);
|
||||
```
|
||||
</details>
|
||||
<details>
|
||||
<summary>Button Click</summary>
|
||||
|
||||
```js
|
||||
@@ -57,6 +81,7 @@ await message.contextMenu(botID, commandName);
|
||||
> In this way, all Slash commands can be obtained
|
||||
- I will try to find another way to not need to create DMs with Bot anymore
|
||||
- Credit: [Here](https://www.reddit.com/r/Discord_selfbots/comments/tczprx/discum_help_creating_a_selfbot_that_can_do_ping/)
|
||||
- <strong>Update: Now to get more secure interaction commands you need to use guild.searchInteraction() (using gateway)</strong>
|
||||
</details>
|
||||
|
||||
## MessageEmbed ?
|
||||
|
Reference in New Issue
Block a user