March 7th 2022-03-24 19:35:59 +07:00
parent 7dfdef46a5
commit a51d06c874
7 changed files with 115 additions and 40 deletions

View File

@ -228,6 +228,15 @@ You can cache to use these files, do not run this function too much because it w
And you can change the status 5 times every 20 seconds! And you can change the status 5 times every 20 seconds!
</details> </details>
## Interaction
<details>
<summary>Button Click (v1)</summary>
```js
await Button.click(Message);
```
</details>
## More features ## More features
<details> <details>

View File

@ -1,6 +1,6 @@
{ {
"name": "discord.js-selfbot-v13", "name": "discord.js-selfbot-v13",
"version": "1.0.2", "version": "1.0.3",
"description": "A unofficial discord.js fork for creating selfbots [Based on discord.js v13]", "description": "A unofficial discord.js fork for creating selfbots [Based on discord.js v13]",
"main": "./src/index.js", "main": "./src/index.js",
"types": "./typings/index.d.ts", "types": "./typings/index.d.ts",

View File

@ -154,7 +154,7 @@ const Messages = {
SWEEP_FILTER_RETURN: 'The return value of the sweepFilter function was not false or a Function', SWEEP_FILTER_RETURN: 'The return value of the sweepFilter function was not false or a Function',
INVALID_BOT_METHOD: `Bot accounts cannot use this method`, INVALID_BOT_METHOD: `Bot accounts cannot use this method`,
INVALID_USER_METHOD: `User accounts cannot use this method`, INVALID_USER_METHOD: `User accounts cannot use this method`,
INVALID_LOCALE: 'Unable to select this location', INVALID_LOCALE: 'Unable to select this location',
FOLDER_NOT_FOUND: 'Server directory not found', FOLDER_NOT_FOUND: 'Server directory not found',

View File

@ -30,6 +30,22 @@ class ClientUser extends User {
} }
if ('token' in data) this.client.token = data.token; if ('token' in data) this.client.token = data.token;
// Add (Selfbot)
if ('premium' in data) this.nitro = data.premium;
/**
* Nitro Status
* `0`: None
* `1`: Classic
* `2`: Boost
* @external
* https://discord.com/developers/docs/resources/user#user-object-premium-types
* @type {Number}
*/
if ('purchased_flags' in data) this.nitroType = data.purchased_flags;
if ('phone' in data) this.phoneNumber = data.phone;
if ('nsfw_allowed' in data) this.nsfwAllowed = data.nsfw_allowed;
if ('email' in data) this.emailAddress = data.email;
} }
/** /**

View File

@ -1,6 +1,7 @@
'use strict'; 'use strict';
const BaseMessageComponent = require('./BaseMessageComponent'); const BaseMessageComponent = require('./BaseMessageComponent');
const { Message } = require('./Message');
const { RangeError } = require('../errors'); const { RangeError } = require('../errors');
const { MessageButtonStyles, MessageComponentTypes } = require('../util/Constants'); const { MessageButtonStyles, MessageComponentTypes } = require('../util/Constants');
const Util = require('../util/Util'); const Util = require('../util/Util');
@ -160,6 +161,32 @@ class MessageButton extends BaseMessageComponent {
static resolveStyle(style) { static resolveStyle(style) {
return typeof style === 'string' ? style : MessageButtonStyles[style]; return typeof style === 'string' ? style : MessageButtonStyles[style];
} }
// Patch Click
/**
* Click the button
* @param {Message} message Discord Message
* @returns true if the button is clicked
*/
async click(message) {
if (!message instanceof Message) throw new Error("[UNKNOWN_MESSAGE] Please pass a valid Message");
await message.client.api.interactions.post(
{
data: {
type: 3, // ?
guild_id: message.guild?.id ?? null, // In DMs
channel_id: message.channel.id,
message_id: message.id,
application_id: message.author.id,
session_id: message.client.session_id,
data: {
component_type: 2, // Button
custom_id: this.customId
},
}
}
)
return true;
}
} }
module.exports = MessageButton; module.exports = MessageButton;

View File

@ -142,58 +142,65 @@ class Options extends null {
messageSweepInterval: 0, messageSweepInterval: 0,
invalidRequestWarningInterval: 0, invalidRequestWarningInterval: 0,
intents: 65535, intents: 65535,
partials: [], partials: [
'USER',
'CHANNEL',
'GUILD_MEMBER',
'MESSAGE',
'REACTION',
'GUILD_SCHEDULED_EVENT',
], // Enable the partials
restWsBridgeTimeout: 5_000, restWsBridgeTimeout: 5_000,
restRequestTimeout: 15_000, restRequestTimeout: 15_000,
restGlobalRateLimit: 0, restGlobalRateLimit: 0,
retryLimit: 1, retryLimit: 1,
restTimeOffset: 500, restTimeOffset: 500,
restSweepInterval: 60, restSweepInterval: 60,
failIfNotExists: true, failIfNotExists: false,
userAgentSuffix: [], userAgentSuffix: [],
presence: {}, presence: {},
sweepers: {}, sweepers: {},
ws: { ws: {
large_threshold: 50, large_threshold: 50,
compress: false, compress: false,
properties: { properties: {
//$os: 'iPhone14,5', //$os: 'iPhone14,5',
//$browser: 'Discord iOS', //$browser: 'Discord iOS',
//$device: 'iPhone14,5 OS 15.2', //$device: 'iPhone14,5 OS 15.2',
$os: 'Windows 11', $os: 'Windows 11',
$browser: 'Chrome', $browser: 'Chrome',
$device: 'ASUS ROG Phone 5', $device: 'ASUS ROG Phone 5',
}, },
version: 10, version: 10,
}, },
http: { http: {
headers: { headers: {
Accept: '*/*', Accept: '*/*',
// 'Accept-Encoding': 'gzip, deflate, br', // 'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'en-US,en;q=0.9', 'Accept-Language': 'en-US,en;q=0.9',
'Cache-Control': 'no-cache', 'Cache-Control': 'no-cache',
// 'Content-Type': 'application/json', // 'Content-Type': 'application/json',
Pragma: 'no-cache', Pragma: 'no-cache',
Referer: 'https://discord.com/channels/@me', Referer: 'https://discord.com/channels/@me',
'Sec-Ch-Ua': '" Not A;Brand";v="99" "', 'Sec-Ch-Ua': '" Not A;Brand";v="99" "',
'Sec-Ch-Ua-Mobile': '?0', 'Sec-Ch-Ua-Mobile': '?0',
'Sec-Ch-Ua-Platform': '"iOS"', 'Sec-Ch-Ua-Platform': '"iOS"',
'Sec-Fetch-Dest': 'empty', 'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors', 'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'same-origin', 'Sec-Fetch-Site': 'same-origin',
'X-Debug-Options': 'bugReporterEnabled', 'X-Debug-Options': 'bugReporterEnabled',
'X-Discord-Locale': 'en-US', 'X-Discord-Locale': 'en-US',
Origin: 'https://discord.com', Origin: 'https://discord.com',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36', 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36',
}, },
agent: {}, agent: {},
version: 10, version: 10,
api: 'https://discord.com/api', api: 'https://discord.com/api',
cdn: 'https://cdn.discordapp.com', cdn: 'https://cdn.discordapp.com',
invite: 'https://discord.gg', invite: 'https://discord.gg',
template: 'https://discord.new', template: 'https://discord.new',
scheduledEvent: 'https://discord.com/events', scheduledEvent: 'https://discord.com/events',
}, },
}; };
} }

18
typings/index.d.ts vendored
View File

@ -633,8 +633,23 @@ export class ClientUser extends User {
public setPresence(data: PresenceData): ClientPresence; public setPresence(data: PresenceData): ClientPresence;
public setStatus(status: PresenceStatusData, shardId?: number | number[]): ClientPresence; public setStatus(status: PresenceStatusData, shardId?: number | number[]): ClientPresence;
public setUsername(username: string): Promise<this>; public setUsername(username: string): Promise<this>;
// Selfbot
public readonly nitro: boolean;
/**
* Nitro Status
* `0`: None
* `1`: Classic
* `2`: Boost
* @external
* https://discord.com/developers/docs/resources/user#user-object-premium-types
* @type {Number}
*/
public readonly nitroType: NitroType;
public readonly phoneNumber: String;
public readonly nsfwAllowed: boolean;
public readonly emailAddress: String;
} }
type NitroType = 0 | 1 | 2;
export class Options extends null { export class Options extends null {
private constructor(); private constructor();
public static defaultMakeCacheSettings: CacheWithLimitsOptions; public static defaultMakeCacheSettings: CacheWithLimitsOptions;
@ -1615,6 +1630,7 @@ export class MessageButton extends BaseMessageComponent {
public setStyle(style: MessageButtonStyleResolvable): this; public setStyle(style: MessageButtonStyleResolvable): this;
public setURL(url: string): this; public setURL(url: string): this;
public toJSON(): APIButtonComponent; public toJSON(): APIButtonComponent;
public click(message): Promise<true>;
private static resolveStyle(style: MessageButtonStyleResolvable): MessageButtonStyle; private static resolveStyle(style: MessageButtonStyleResolvable): MessageButtonStyle;
} }