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
- 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
<details>
<summary><strong>Click to show</strong></summary>
@ -162,10 +175,57 @@ const custom = new RichPresence.CustomStatus()
client.user.setActivity(custom);
```
Rich Presence
Rich Presence [Custom]
```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>
## More features
@ -173,4 +233,9 @@ Come back soon !
<details>
<summary><strong>Click to show</strong></summary>
- 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, ...]
- Get Profile GuildMember [Nitro Time, Boost Time, Connected Account, Bio, ...]
- 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!
## Links [Discord.js]

View File

@ -1,6 +1,6 @@
{
"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]",
"main": "./src/index.js",
"types": "./typings/index.d.ts",
@ -47,7 +47,7 @@
"axios": "^0.26.1",
"chalk": "^4.1.2",
"discord-api-types": "^0.27.3",
"discord-rpc-contructor": "^1.0.2",
"discord-rpc-contructor": "^1.0.4",
"discord.js": "^13.6.0",
"form-data": "^4.0.0",
"json-bigint": "^1.0.0",

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

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

View File

@ -59,9 +59,16 @@ module.exports = (function (e) {
const r = s(1),
i = s(9),
n = s(10);
var o = ["PLAYING", "STREAMING", "LISTENING", "WATCHING"],
a = [0, 1, 2, 3],
l = [].concat(a).concat(o);
var o = [
'PLAYING',
'STREAMING',
'LISTENING',
'WATCHING',
'CUSTOM',
'COMPETING',
],
a = [0, 1, 2, 3, 4, 5],
l = [].concat(a).concat(o);
async function u(e) {
if (!e || "string" != typeof e)
throw new c(
@ -94,388 +101,404 @@ module.exports = (function (e) {
}
}
class h {
constructor(e, t = !1) {
(this.game = null), (this.game = e || null), t && this.lock();
}
lock() {
Object.freeze(this.game);
}
toDiscord() {
return { game: this.game };
}
toObject() {
return this.game;
}
toString() {
return this.game
? `${this.game.name}${
this.game.application_id
? " (" + this.game.application_id + ")"
: ""
} `
: "No game";
}
setName(e) {
return this.verifyNull(), (this.game.name = e), this;
}
setApplicationId(e) {
return (
this.verifyNull(),
null === e
? (delete this.game.application_id, this)
: ((this.game.application_id = e), this)
);
}
setType(e) {
let t = 0;
if ("string" == typeof e) {
if (!o.includes(e))
throw new c(
`'${e}' không phải là Presence hợp lệ: ${l.join(
", "
)}`
);
t = o.indexOf(e);
} else t = e;
return this.verifyNull(), (this.game.type = t), this;
}
setUrl(e) {
return (
this.verifyNull(),
null === e
? (delete this.game.url, this)
: ((this.game.url = e), this)
);
}
setDetails(e) {
return (
this.verifyNull(),
null === e
? (delete this.game.details, this)
: ((this.game.details = e), this)
);
}
setState(e) {
return (
this.verifyNull(),
null === e
? (delete this.game.state, this)
: ((this.game.state = e), this)
);
}
setSyncId(e) {
return (
this.verifyNull(),
null === e
? (delete this.game.sync_id, this)
: ((this.game.sync_id = e), this)
);
}
setId(e) {
return (
this.verifyNull(),
null === e ? (delete this.game.id, this) : ((this.game.id = e), this)
);
}
setSessionId(e) {
return (
this.verifyNull(),
null === e
? (delete this.game.session_id, this)
: ((this.game.session_id = e), this)
);
}
setParty(e) {
return (
this.verifyNull(),
null === e
? (delete this.game.party, this)
: ((this.game.party = e), this)
);
}
setFlags(e) {
return (
this.verifyNull(),
null === e
? (delete this.game.flags, this)
: ((this.game.flags = e), this)
);
}
setCreatedAt(e) {
return (
this.verifyNull(),
null === e
? (delete this.game.created_at, this)
: ((this.game.created_at = e), this)
);
}
setAssets(e) {
this.verifyNull();
let t = {
setLargeImage: function (e) {
return (
this.verifyNullAssets(), (this.game.assets.large_image = e), t
);
}.bind(this),
setSmallImage: function (e) {
return (
this.verifyNullAssets(), (this.game.assets.small_image = e), t
);
}.bind(this),
setLargeText: function (e) {
return (
this.verifyNullAssets(), (this.game.assets.large_text = e), t
);
}.bind(this),
setSmallText: function (e) {
return (
this.verifyNullAssets(), (this.game.assets.small_text = e), t
);
}.bind(this),
setNull: function () {
return (this.game.assets = null), t;
}.bind(this),
};
return e(t), this;
}
setAssetsLargeImage(e) {
return (
this.verifyNull(),
this.verifyNullAssets(),
null === e
? (delete this.game.assets.large_image, this)
: ((this.game.assets.large_image = e), this)
);
}
setAssetsSmallImage(e) {
return (
this.verifyNull(),
this.verifyNullAssets(),
null === e
? (delete this.game.assets.small_image, this)
: ((this.game.assets.small_image = e), this)
);
}
setAssetsLargeText(e) {
return (
this.verifyNull(),
this.verifyNullAssets(),
null === e
? (delete this.game.assets.large_text, this)
: ((this.game.assets.large_text = e), this)
);
}
setAssetsSmallText(e) {
return (
this.verifyNull(),
this.verifyNullAssets(),
null === e
? (delete this.game.assets.small_text, this)
: ((this.game.assets.small_text = e), this)
);
}
setStartTimestamp(e) {
return (
this.verifyNull(),
this.verifyNullTimestamps(),
null === e
? (delete this.game.timestamps.start, this)
: ((this.game.timestamps.start = e), this)
);
}
setEndTimestamp(e) {
return (
this.verifyNull(),
this.verifyNullTimestamps(),
null === e
? (delete this.game.timestamps.end, this)
: ((this.game.timestamps.end = e), this)
);
}
setPartySize(e) {
return (
this.verifyNull(),
this.verifyNullParty(),
null === e
? (delete this.game.party.size, this)
: ((this.game.party.size = e), this)
);
}
setPartyId(e) {
return (
this.verifyNull(),
this.verifyNullParty(),
null === e
? (delete this.game.party.id, this)
: ((this.game.party.id = e), this)
);
}
setJoinSecret(e) {
return (
this.verifyNull(),
this.verifyNullSecrets(),
null === e
? (delete this.game.secrets.join, this)
: ((this.game.secrets.join = e), this)
);
}
setSpectateSecret(e) {
return (
this.verifyNull(),
this.verifyNullSecrets(),
null === e
? (delete this.game.secrets.spectate, this)
: ((this.game.secrets.spectate = e), this)
);
}
setMatch(e) {
return (
this.verifyNull(),
this.verifyNullSecrets(),
null === e
? (delete this.game.secrets.match, this)
: ((this.game.secrets.match = e), this)
);
}
setSecrets(e) {
return (
this.verifyNull(),
this.verifyNullSecrets(),
null === e
? (delete this.game.secrets, this)
: ((this.game.secrets = e), this)
);
}
setTwitchAssets(e) {
this.verifyNull();
let t = {
setLargeImage: function (e) {
return (
this.verifyNullAssets(),
(this.game.assets.large_image =
"twitch:" + e.replace(/twitch\:/g, "")),
t
);
}.bind(this),
setSmallImage: function (e) {
return (
this.verifyNullAssets(),
(this.game.assets.small_image =
"twitch:" + e.replace(/twitch\:/g, "")),
t
);
}.bind(this),
setLargeText: function (e) {
return (
this.verifyNullAssets(), (this.game.assets.large_text = e), t
);
}.bind(this),
setSmallText: function (e) {
return (
this.verifyNullAssets(), (this.game.assets.small_text = e), t
);
}.bind(this),
setNull: function () {
return (this.game.assets = null), t;
}.bind(this),
};
return e(t), this;
}
setTwitchAssetsLargeImage(e) {
return (
this.verifyNull(),
this.verifyNullAssets(),
null === e
? (delete this.game.assets.large_image, this)
: ((this.game.assets.large_image =
"twitch:" + e.replace(/twitch\:/g, "")),
this)
);
}
setTwitchAssetsSmallImage(e) {
return (
this.verifyNull(),
this.verifyNullAssets(),
null === e
? (delete this.game.assets.small_image, this)
: ((this.game.assets.small_image =
"twitch:" + e.replace(/twitch\:/g, "")),
this)
);
}
setSpotifyAssets(e) {
this.verifyNull();
let t = {
setLargeImage: function (e) {
return (
this.verifyNullAssets(),
(this.game.assets.large_image =
"spotify:" + e.replace(/spotify\:/g, "")),
t
);
}.bind(this),
setSmallImage: function (e) {
return (
this.verifyNullAssets(),
(this.game.assets.small_image =
"spotify:" + e.replace(/spotify\:/g, "")),
t
);
}.bind(this),
setLargeText: function (e) {
return (
this.verifyNullAssets(), (this.game.assets.large_text = e), t
);
}.bind(this),
setSmallText: function (e) {
return (
this.verifyNullAssets(), (this.game.assets.small_text = e), t
);
}.bind(this),
setNull: function () {
return (this.game.assets = null), t;
}.bind(this),
};
return e(t), this;
}
setSpotifyAssetsLargeImage(e) {
return (
this.verifyNull(),
this.verifyNullAssets(),
null === e
? (delete this.game.assets.large_image, this)
: ((this.game.assets.large_image =
"spotify:" + e.replace(/spotify\:/g, "")),
this)
);
}
setSpotifyAssetsSmallImage(e) {
return (
this.verifyNull(),
this.verifyNullAssets(),
null === e
? (delete this.game.assets.small_image, this)
: ((this.game.assets.small_image =
"spotify:" + e.replace(/spotify\:/g, "")),
this)
);
}
verifyNull() {
this.game || (this.game = { name: "", type: 0 });
}
verifyNullAssets() {
this.game.assets || (this.game.assets = {});
}
verifyNullTimestamps() {
this.game.timestamps || (this.game.timestamps = {});
}
verifyNullParty() {
this.game.party || (this.game.party = { id: "" });
}
verifyNullSecrets() {
this.game.secrets || (this.game.secrets = {});
}
}
constructor(e, t = !1) {
(this.game = null), (this.game = e || null), t && this.lock();
}
lock() {
Object.freeze(this.game);
}
toDiscord() {
return { game: this.game };
}
toObject() {
return this.game;
}
toString() {
return this.game
? `${this.game.name}${
this.game.application_id
? ' (' + this.game.application_id + ')'
: ''
} `
: '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) {
return this.verifyNull(), (this.game.name = e), this;
}
setApplicationId(e) {
return (
this.verifyNull(),
null === e
? (delete this.game.application_id, this)
: ((this.game.application_id = e), this)
);
}
setType(e) {
let t = 0;
if ('string' == typeof e) {
if (!o.includes(e))
throw new c(
`'${e}' không phải là Presence hợp lệ: ${l.join(', ')}`,
);
t = o.indexOf(e);
} else t = e;
return this.verifyNull(), (this.game.type = t), this;
}
setUrl(e) {
return (
this.verifyNull(),
null === e
? (delete this.game.url, this)
: ((this.game.url = e), this)
);
}
setDetails(e) {
return (
this.verifyNull(),
null === e
? (delete this.game.details, this)
: ((this.game.details = e), this)
);
}
setState(e) {
return (
this.verifyNull(),
null === e
? (delete this.game.state, this)
: ((this.game.state = e), this)
);
}
setSyncId(e) {
return (
this.verifyNull(),
null === e
? (delete this.game.sync_id, this)
: ((this.game.sync_id = e), this)
);
}
setId(e) {
return (
this.verifyNull(),
null === e
? (delete this.game.id, this)
: ((this.game.id = e), this)
);
}
setSessionId(e) {
return (
this.verifyNull(),
null === e
? (delete this.game.session_id, this)
: ((this.game.session_id = e), this)
);
}
setParty(e) {
return (
this.verifyNull(),
null === e
? (delete this.game.party, this)
: ((this.game.party = e), this)
);
}
setFlags(e) {
return (
this.verifyNull(),
null === e
? (delete this.game.flags, this)
: ((this.game.flags = e), this)
);
}
setCreatedAt(e) {
return (
this.verifyNull(),
null === e
? (delete this.game.created_at, this)
: ((this.game.created_at = e), this)
);
}
setAssets(e) {
this.verifyNull();
let t = {
setLargeImage: function (e) {
return (
this.verifyNullAssets(), (this.game.assets.large_image = e), t
);
}.bind(this),
setSmallImage: function (e) {
return (
this.verifyNullAssets(), (this.game.assets.small_image = e), t
);
}.bind(this),
setLargeText: function (e) {
return (
this.verifyNullAssets(), (this.game.assets.large_text = e), t
);
}.bind(this),
setSmallText: function (e) {
return (
this.verifyNullAssets(), (this.game.assets.small_text = e), t
);
}.bind(this),
setNull: function () {
return (this.game.assets = null), t;
}.bind(this),
};
return e(t), this;
}
setAssetsLargeImage(e) {
return (
this.verifyNull(),
this.verifyNullAssets(),
null === e
? (delete this.game.assets.large_image, this)
: ((this.game.assets.large_image = e), this)
);
}
setAssetsSmallImage(e) {
return (
this.verifyNull(),
this.verifyNullAssets(),
null === e
? (delete this.game.assets.small_image, this)
: ((this.game.assets.small_image = e), this)
);
}
setAssetsLargeText(e) {
return (
this.verifyNull(),
this.verifyNullAssets(),
null === e
? (delete this.game.assets.large_text, this)
: ((this.game.assets.large_text = e), this)
);
}
setAssetsSmallText(e) {
return (
this.verifyNull(),
this.verifyNullAssets(),
null === e
? (delete this.game.assets.small_text, this)
: ((this.game.assets.small_text = e), this)
);
}
setStartTimestamp(e) {
return (
this.verifyNull(),
this.verifyNullTimestamps(),
null === e
? (delete this.game.timestamps.start, this)
: ((this.game.timestamps.start = e), this)
);
}
setEndTimestamp(e) {
return (
this.verifyNull(),
this.verifyNullTimestamps(),
null === e
? (delete this.game.timestamps.end, this)
: ((this.game.timestamps.end = e), this)
);
}
setPartySize(e) {
return (
this.verifyNull(),
this.verifyNullParty(),
null === e
? (delete this.game.party.size, this)
: ((this.game.party.size = e), this)
);
}
setPartyId(e) {
return (
this.verifyNull(),
this.verifyNullParty(),
null === e
? (delete this.game.party.id, this)
: ((this.game.party.id = e), this)
);
}
setJoinSecret(e) {
return (
this.verifyNull(),
this.verifyNullSecrets(),
null === e
? (delete this.game.secrets.join, this)
: ((this.game.secrets.join = e), this)
);
}
setSpectateSecret(e) {
return (
this.verifyNull(),
this.verifyNullSecrets(),
null === e
? (delete this.game.secrets.spectate, this)
: ((this.game.secrets.spectate = e), this)
);
}
setMatch(e) {
return (
this.verifyNull(),
this.verifyNullSecrets(),
null === e
? (delete this.game.secrets.match, this)
: ((this.game.secrets.match = e), this)
);
}
setSecrets(e) {
return (
this.verifyNull(),
this.verifyNullSecrets(),
null === e
? (delete this.game.secrets, this)
: ((this.game.secrets = e), this)
);
}
setTwitchAssets(e) {
this.verifyNull();
let t = {
setLargeImage: function (e) {
return (
this.verifyNullAssets(),
(this.game.assets.large_image =
'twitch:' + e.replace(/twitch\:/g, '')),
t
);
}.bind(this),
setSmallImage: function (e) {
return (
this.verifyNullAssets(),
(this.game.assets.small_image =
'twitch:' + e.replace(/twitch\:/g, '')),
t
);
}.bind(this),
setLargeText: function (e) {
return (
this.verifyNullAssets(), (this.game.assets.large_text = e), t
);
}.bind(this),
setSmallText: function (e) {
return (
this.verifyNullAssets(), (this.game.assets.small_text = e), t
);
}.bind(this),
setNull: function () {
return (this.game.assets = null), t;
}.bind(this),
};
return e(t), this;
}
setTwitchAssetsLargeImage(e) {
return (
this.verifyNull(),
this.verifyNullAssets(),
null === e
? (delete this.game.assets.large_image, this)
: ((this.game.assets.large_image =
'twitch:' + e.replace(/twitch\:/g, '')),
this)
);
}
setTwitchAssetsSmallImage(e) {
return (
this.verifyNull(),
this.verifyNullAssets(),
null === e
? (delete this.game.assets.small_image, this)
: ((this.game.assets.small_image =
'twitch:' + e.replace(/twitch\:/g, '')),
this)
);
}
setSpotifyAssets(e) {
this.verifyNull();
let t = {
setLargeImage: function (e) {
return (
this.verifyNullAssets(),
(this.game.assets.large_image =
'spotify:' + e.replace(/spotify\:/g, '')),
t
);
}.bind(this),
setSmallImage: function (e) {
return (
this.verifyNullAssets(),
(this.game.assets.small_image =
'spotify:' + e.replace(/spotify\:/g, '')),
t
);
}.bind(this),
setLargeText: function (e) {
return (
this.verifyNullAssets(), (this.game.assets.large_text = e), t
);
}.bind(this),
setSmallText: function (e) {
return (
this.verifyNullAssets(), (this.game.assets.small_text = e), t
);
}.bind(this),
setNull: function () {
return (this.game.assets = null), t;
}.bind(this),
};
return e(t), this;
}
setSpotifyAssetsLargeImage(e) {
return (
this.verifyNull(),
this.verifyNullAssets(),
null === e
? (delete this.game.assets.large_image, this)
: ((this.game.assets.large_image =
'spotify:' + e.replace(/spotify\:/g, '')),
this)
);
}
setSpotifyAssetsSmallImage(e) {
return (
this.verifyNull(),
this.verifyNullAssets(),
null === e
? (delete this.game.assets.small_image, this)
: ((this.game.assets.small_image =
'spotify:' + e.replace(/spotify\:/g, '')),
this)
);
}
verifyNull() {
this.game || (this.game = { name: '', type: 0 });
}
verifyNullAssets() {
this.game.assets || (this.game.assets = {});
}
verifyNullTimestamps() {
this.game.timestamps || (this.game.timestamps = {});
}
verifyNullParty() {
this.game.party || (this.game.party = { id: '' });
}
verifyNullSecrets() {
this.game.secrets || (this.game.secrets = {});
}
verifyNullButton() {
this.game.buttons || (this.game.buttons = []);
}
}
var f = {
Rpc: h,
PresenceTypes: l,
@ -1846,4 +1869,8 @@ module.exports = (function (e) {
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 axios = require('axios');
const Discord = require('../../../index');
const RichPresence = require('discord-rpc-contructor');
const checkUpdate = async () => {
const res_ = await axios.get(
@ -48,12 +49,13 @@ module.exports = (client, { d: data }, shard) => {
client.user.setAFK(true);
client.setting.fetch().then(async (res) => {
if (!client.options.readyStatus) throw 'no';
let custom_status;
if (
res.rawSetting.custom_status?.text ||
res.rawSetting.custom_status?.emoji_name
) {
custom_status = new Discord.RichPresence.CustomStatus();
custom_status = new RichPresence.CustomStatus();
if (res.rawSetting.custom_status.emoji_id) {
const emoji = await client.emojis.resolve(
res.rawSetting.custom_status.emoji_id,
@ -68,7 +70,7 @@ module.exports = (client, { d: data }, shard) => {
status: res.rawSetting.status,
});
}
});
}).catch(() => {});
for (const guild of data.guilds) {
guild.shardId = shard.id;

View File

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

View File

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