Update Document and Ready

This commit is contained in:
March 7th 2022-03-22 17:09:50 +07:00
parent 35ae8f3e4b
commit 557236221c
8 changed files with 492 additions and 395 deletions

View File

@ -1,5 +1,18 @@
# Discord.js Selfbot v13 # Discord.js Selfbot v13
- Install: <strong>npm i discord.js-selfbot-v13@lasest</strong> - Install: <strong>npm i discord.js-selfbot-v13@lasest</strong>
## Client Settings
<details>
<summary><strong>Click to show</strong></summary>
```js
new Client({
checkUpdate: true, // Check Package Update (Ready) [Enable Deafult]
readyStatus: false, // Set status sync from Account (Ready) [Disable Default]
})
```
</details>
## User Settings ## User Settings
<details> <details>
<summary><strong>Click to show</strong></summary> <summary><strong>Click to show</strong></summary>
@ -162,10 +175,57 @@ const custom = new RichPresence.CustomStatus()
client.user.setActivity(custom); client.user.setActivity(custom);
``` ```
Rich Presence Rich Presence [Custom]
```js ```js
Come back soon ! const RPC = require('discord-rpc-contructor');
const r = new RPC.Rpc()
.setApplicationId('817229550684471297')
.setType(0)
.setState('State')
.setName('Name')
.setDetails('Details')
.setParty({
size: [1, 2],
id: RPC.uuid(),
})
.setStartTimestamp(Date.now())
.setAssetsLargeImage('929325841350000660')
.setAssetsLargeText('Youtube')
.setAssetsSmallImage('895316294222635008')
.setAssetsSmallText('Bot')
client.user.setActivity(r.toDiscord().game);
// Button not working
``` ```
<img src='https://cdn.discordapp.com/attachments/820557032016969751/955767445220646922/unknown.png'>
Rich Presence with Twitch / Spotify
```js
Update soon ~
```
<strong>How to get AssetID ?</strong>
Code
```js
// Bot ID
RPC.getRpcImages('817229550684471297').then(console.log);
```
Return
```js
// ID is AssetID
[
{ id: '838629816881381376', type: 1, name: 'honkai' },
{ id: '853533658250084352', type: 1, name: 'vscode' },
{ id: '895316294222635008', type: 1, name: 'botsagiri' },
{ id: '929324633063292929', type: 1, name: 'soundcloud' },
{ id: '929324634858479666', type: 1, name: 'spotify' },
{ id: '929325841350000660', type: 1, name: 'youtube' }
]
```
You can cache to use these files, do not run this function too much because it will be rate limit
And you can change the status 5 times every 20 seconds!
</details> </details>
## More features ## More features
@ -174,3 +234,8 @@ Come back soon !
<summary><strong>Click to show</strong></summary> <summary><strong>Click to show</strong></summary>
- I need requests from you! Ask questions, I will help you! - I need requests from you! Ask questions, I will help you!
</details> </details>
## Warning
- This is a beta version, so there are some bugs.
- If you use the `Client.destroy()` function, for an account that uses 2FA, it will cause a logout and the Token will no longer be usable.
- With bot account you can login using `Client.login('Bot Token', true)`, but there will be some missing constructor like MessageEmbed, MessageActionRow, MessageButton, ...

View File

@ -47,6 +47,7 @@ client.login('token');
- Discord Apps Setting [Theme, Language, ...] - Discord Apps Setting [Theme, Language, ...]
- Get Profile GuildMember [Nitro Time, Boost Time, Connected Account, Bio, ...] - Get Profile GuildMember [Nitro Time, Boost Time, Connected Account, Bio, ...]
- Setting Position Guild and Folder - Setting Position Guild and Folder
- Custom Status and RPC (without button, because it's not working)
- You can request more features for my module by placing an issue! - You can request more features for my module by placing an issue!
## Links [Discord.js] ## Links [Discord.js]

View File

@ -1,6 +1,6 @@
{ {
"name": "discord.js-selfbot-v13", "name": "discord.js-selfbot-v13",
"version": "0.2.1", "version": "0.2.2",
"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",
@ -47,7 +47,7 @@
"axios": "^0.26.1", "axios": "^0.26.1",
"chalk": "^4.1.2", "chalk": "^4.1.2",
"discord-api-types": "^0.27.3", "discord-api-types": "^0.27.3",
"discord-rpc-contructor": "^1.0.2", "discord-rpc-contructor": "^1.0.4",
"discord.js": "^13.6.0", "discord.js": "^13.6.0",
"form-data": "^4.0.0", "form-data": "^4.0.0",
"json-bigint": "^1.0.0", "json-bigint": "^1.0.0",

1
src/RPC/index.d.ts vendored
View File

@ -141,6 +141,7 @@ interface rpcManager {
CustomStatus: { CustomStatus: {
new (CustomStatusGame?: CustomStatusGame): CustomStatus; new (CustomStatusGame?: CustomStatusGame): CustomStatus;
}; };
uuid(): string;
} }
interface emojiLike { interface emojiLike {
id: string; id: string;

View File

@ -59,8 +59,15 @@ module.exports = (function (e) {
const r = s(1), const r = s(1),
i = s(9), i = s(9),
n = s(10); n = s(10);
var o = ["PLAYING", "STREAMING", "LISTENING", "WATCHING"], var o = [
a = [0, 1, 2, 3], 'PLAYING',
'STREAMING',
'LISTENING',
'WATCHING',
'CUSTOM',
'COMPETING',
],
a = [0, 1, 2, 3, 4, 5],
l = [].concat(a).concat(o); l = [].concat(a).concat(o);
async function u(e) { async function u(e) {
if (!e || "string" != typeof e) if (!e || "string" != typeof e)
@ -110,10 +117,23 @@ module.exports = (function (e) {
return this.game return this.game
? `${this.game.name}${ ? `${this.game.name}${
this.game.application_id this.game.application_id
? " (" + this.game.application_id + ")" ? ' (' + this.game.application_id + ')'
: "" : ''
} ` } `
: "No game"; : 'No game';
}
setButton(array) {
// Check value
if (!Array.isArray(array)) throw new c(`'${array}' not an array`);
if (array.length > 2) throw new c(`'${array}' length > 2`);
if (array.find((o) => !o?.label)) throw new c(`'${array}' has button with noname`);
return (
this.verifyNull(),
this.verifyNullButton(),
null === array
? (delete this.game.buttons, this)
: ((this.game.buttons = array), this)
);
} }
setName(e) { setName(e) {
return this.verifyNull(), (this.game.name = e), this; return this.verifyNull(), (this.game.name = e), this;
@ -128,12 +148,10 @@ module.exports = (function (e) {
} }
setType(e) { setType(e) {
let t = 0; let t = 0;
if ("string" == typeof e) { if ('string' == typeof e) {
if (!o.includes(e)) if (!o.includes(e))
throw new c( throw new c(
`'${e}' không phải là Presence hợp lệ: ${l.join( `'${e}' không phải là Presence hợp lệ: ${l.join(', ')}`,
", "
)}`
); );
t = o.indexOf(e); t = o.indexOf(e);
} else t = e; } else t = e;
@ -174,7 +192,9 @@ module.exports = (function (e) {
setId(e) { setId(e) {
return ( return (
this.verifyNull(), this.verifyNull(),
null === e ? (delete this.game.id, this) : ((this.game.id = e), this) null === e
? (delete this.game.id, this)
: ((this.game.id = e), this)
); );
} }
setSessionId(e) { setSessionId(e) {
@ -353,7 +373,7 @@ module.exports = (function (e) {
return ( return (
this.verifyNullAssets(), this.verifyNullAssets(),
(this.game.assets.large_image = (this.game.assets.large_image =
"twitch:" + e.replace(/twitch\:/g, "")), 'twitch:' + e.replace(/twitch\:/g, '')),
t t
); );
}.bind(this), }.bind(this),
@ -361,7 +381,7 @@ module.exports = (function (e) {
return ( return (
this.verifyNullAssets(), this.verifyNullAssets(),
(this.game.assets.small_image = (this.game.assets.small_image =
"twitch:" + e.replace(/twitch\:/g, "")), 'twitch:' + e.replace(/twitch\:/g, '')),
t t
); );
}.bind(this), }.bind(this),
@ -388,7 +408,7 @@ module.exports = (function (e) {
null === e null === e
? (delete this.game.assets.large_image, this) ? (delete this.game.assets.large_image, this)
: ((this.game.assets.large_image = : ((this.game.assets.large_image =
"twitch:" + e.replace(/twitch\:/g, "")), 'twitch:' + e.replace(/twitch\:/g, '')),
this) this)
); );
} }
@ -399,7 +419,7 @@ module.exports = (function (e) {
null === e null === e
? (delete this.game.assets.small_image, this) ? (delete this.game.assets.small_image, this)
: ((this.game.assets.small_image = : ((this.game.assets.small_image =
"twitch:" + e.replace(/twitch\:/g, "")), 'twitch:' + e.replace(/twitch\:/g, '')),
this) this)
); );
} }
@ -410,7 +430,7 @@ module.exports = (function (e) {
return ( return (
this.verifyNullAssets(), this.verifyNullAssets(),
(this.game.assets.large_image = (this.game.assets.large_image =
"spotify:" + e.replace(/spotify\:/g, "")), 'spotify:' + e.replace(/spotify\:/g, '')),
t t
); );
}.bind(this), }.bind(this),
@ -418,7 +438,7 @@ module.exports = (function (e) {
return ( return (
this.verifyNullAssets(), this.verifyNullAssets(),
(this.game.assets.small_image = (this.game.assets.small_image =
"spotify:" + e.replace(/spotify\:/g, "")), 'spotify:' + e.replace(/spotify\:/g, '')),
t t
); );
}.bind(this), }.bind(this),
@ -445,7 +465,7 @@ module.exports = (function (e) {
null === e null === e
? (delete this.game.assets.large_image, this) ? (delete this.game.assets.large_image, this)
: ((this.game.assets.large_image = : ((this.game.assets.large_image =
"spotify:" + e.replace(/spotify\:/g, "")), 'spotify:' + e.replace(/spotify\:/g, '')),
this) this)
); );
} }
@ -456,12 +476,12 @@ module.exports = (function (e) {
null === e null === e
? (delete this.game.assets.small_image, this) ? (delete this.game.assets.small_image, this)
: ((this.game.assets.small_image = : ((this.game.assets.small_image =
"spotify:" + e.replace(/spotify\:/g, "")), 'spotify:' + e.replace(/spotify\:/g, '')),
this) this)
); );
} }
verifyNull() { verifyNull() {
this.game || (this.game = { name: "", type: 0 }); this.game || (this.game = { name: '', type: 0 });
} }
verifyNullAssets() { verifyNullAssets() {
this.game.assets || (this.game.assets = {}); this.game.assets || (this.game.assets = {});
@ -470,11 +490,14 @@ module.exports = (function (e) {
this.game.timestamps || (this.game.timestamps = {}); this.game.timestamps || (this.game.timestamps = {});
} }
verifyNullParty() { verifyNullParty() {
this.game.party || (this.game.party = { id: "" }); this.game.party || (this.game.party = { id: '' });
} }
verifyNullSecrets() { verifyNullSecrets() {
this.game.secrets || (this.game.secrets = {}); this.game.secrets || (this.game.secrets = {});
} }
verifyNullButton() {
this.game.buttons || (this.game.buttons = []);
}
} }
var f = { var f = {
Rpc: h, Rpc: h,
@ -1846,4 +1869,8 @@ module.exports = (function (e) {
e.exports = require("../../package.json"); e.exports = require("../../package.json");
}, },
]); ]);
module.exports.uuid = () => {
return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, (a) =>
(a ^ ((Math.random() * 16) >> (a / 4))).toString(16),
);
};

View File

@ -6,6 +6,7 @@ let ClientUser;
const chalk = require('chalk'); const chalk = require('chalk');
const axios = require('axios'); const axios = require('axios');
const Discord = require('../../../index'); const Discord = require('../../../index');
const RichPresence = require('discord-rpc-contructor');
const checkUpdate = async () => { const checkUpdate = async () => {
const res_ = await axios.get( const res_ = await axios.get(
@ -48,12 +49,13 @@ module.exports = (client, { d: data }, shard) => {
client.user.setAFK(true); client.user.setAFK(true);
client.setting.fetch().then(async (res) => { client.setting.fetch().then(async (res) => {
if (!client.options.readyStatus) throw 'no';
let custom_status; let custom_status;
if ( if (
res.rawSetting.custom_status?.text || res.rawSetting.custom_status?.text ||
res.rawSetting.custom_status?.emoji_name res.rawSetting.custom_status?.emoji_name
) { ) {
custom_status = new Discord.RichPresence.CustomStatus(); custom_status = new RichPresence.CustomStatus();
if (res.rawSetting.custom_status.emoji_id) { if (res.rawSetting.custom_status.emoji_id) {
const emoji = await client.emojis.resolve( const emoji = await client.emojis.resolve(
res.rawSetting.custom_status.emoji_id, res.rawSetting.custom_status.emoji_id,
@ -68,7 +70,7 @@ module.exports = (client, { d: data }, shard) => {
status: res.rawSetting.status, status: res.rawSetting.status,
}); });
} }
}); }).catch(() => {});
for (const guild of data.guilds) { for (const guild of data.guilds) {
guild.shardId = shard.id; guild.shardId = shard.id;

View File

@ -71,8 +71,8 @@ exports.WebSocketManager = require('./client/websocket/WebSocketManager');
exports.WebSocketShard = require('./client/websocket/WebSocketShard'); exports.WebSocketShard = require('./client/websocket/WebSocketShard');
// Structures // Structures
// exports.RichPresence = require('./RPC/index'); exports.RichPresence = require('./RPC/index');
exports.RichPresence = require('discord-rpc-contructor'); // exports.RichPresence = require('discord-rpc-contructor');
exports.ActionRow = require('./structures/ActionRow'); exports.ActionRow = require('./structures/ActionRow');
exports.Activity = require('./structures/Presence').Activity; exports.Activity = require('./structures/Presence').Activity;
exports.AnonymousGuild = require('./structures/AnonymousGuild'); exports.AnonymousGuild = require('./structures/AnonymousGuild');

View File

@ -132,6 +132,7 @@ class Options extends null {
}, },
jsonTransformer: (object) => JSONBig.stringify(object), jsonTransformer: (object) => JSONBig.stringify(object),
checkUpdate: true, checkUpdate: true,
readyStatus: false,
}; };
} }