discord.js-selfbot-v13/Document/API.md
March 7th d78a10ed76 1.3.4
Get interaction commands using gateway
2022-04-12 20:46:25 +07:00

1.8 KiB

Extending Discord.js-selfbot-v13

credit: Discum

How to add extra API wraps to Discord.js-selfbot-v13?

Table of Contents

HTTP APIs:

URL example:
'https://discord.com/api/v9/users/@me'
const url = client.api.users['@me'];
/* Method: GET | POST | PUT | PATCH | DELETE */
GET:
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:
await client.api.channels[channel.id].messages.post({ versioned: true, data: {}, files: [] });
/* Request: https://discord.com/api/v9/channels/{channel.id}/messages */
PUT:
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:
await client.api.users['@me'].patch({ versioned: true, data: {} });
/* Request: https://discord.com/api/v9/users/@me */
DELETE:
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:
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: {},
});