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

@@ -154,7 +154,7 @@ const Messages = {
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_LOCALE: 'Unable to select this location',
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;
// 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';
const BaseMessageComponent = require('./BaseMessageComponent');
const { Message } = require('./Message');
const { RangeError } = require('../errors');
const { MessageButtonStyles, MessageComponentTypes } = require('../util/Constants');
const Util = require('../util/Util');
@@ -160,6 +161,32 @@ class MessageButton extends BaseMessageComponent {
static resolveStyle(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;

View File

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