Button Click
- https://github.com/aiko-chan-ai/discord.js-selfbot-v13/issues/2
This commit is contained in:
parent
7dfdef46a5
commit
a51d06c874
@ -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!
|
||||
</details>
|
||||
|
||||
## Interaction
|
||||
<details>
|
||||
<summary>Button Click (v1)</summary>
|
||||
|
||||
```js
|
||||
await Button.click(Message);
|
||||
```
|
||||
</details>
|
||||
|
||||
## More features
|
||||
|
||||
<details>
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"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]",
|
||||
"main": "./src/index.js",
|
||||
"types": "./typings/index.d.ts",
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
|
@ -142,14 +142,21 @@ 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: {},
|
||||
|
18
typings/index.d.ts
vendored
18
typings/index.d.ts
vendored
@ -633,8 +633,23 @@ export class ClientUser extends User {
|
||||
public setPresence(data: PresenceData): ClientPresence;
|
||||
public setStatus(status: PresenceStatusData, shardId?: number | number[]): ClientPresence;
|
||||
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 {
|
||||
private constructor();
|
||||
public static defaultMakeCacheSettings: CacheWithLimitsOptions;
|
||||
@ -1615,6 +1630,7 @@ export class MessageButton extends BaseMessageComponent {
|
||||
public setStyle(style: MessageButtonStyleResolvable): this;
|
||||
public setURL(url: string): this;
|
||||
public toJSON(): APIButtonComponent;
|
||||
public click(message): Promise<true>;
|
||||
private static resolveStyle(style: MessageButtonStyleResolvable): MessageButtonStyle;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user