RPC patch
This commit is contained in:
parent
536298d750
commit
b0e9e7dd71
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "discord.js-selfbot-v13",
|
"name": "discord.js-selfbot-v13",
|
||||||
"version": "0.2.0",
|
"version": "0.2.1",
|
||||||
"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,6 +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.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",
|
||||||
|
@ -9,44 +9,47 @@ const Discord = require('../../../index');
|
|||||||
|
|
||||||
const checkUpdate = async () => {
|
const checkUpdate = async () => {
|
||||||
const res_ = await axios.get(
|
const res_ = await axios.get(
|
||||||
`https://registry.npmjs.com/${encodeURIComponent('discord.js-selfbot-v13')}`,
|
`https://registry.npmjs.com/${encodeURIComponent(
|
||||||
|
'discord.js-selfbot-v13',
|
||||||
|
)}`,
|
||||||
);
|
);
|
||||||
const lastest_tag = res_.data['dist-tags'].latest;
|
const lastest_tag = res_.data['dist-tags'].latest;
|
||||||
// Checking if the package is outdated
|
// Checking if the package is outdated
|
||||||
// Stable version
|
// Stable version
|
||||||
if (lastest_tag !== Discord.version) {
|
if (lastest_tag !== Discord.version) {
|
||||||
return console.log(`${chalk.yellowBright(
|
return console.log(`${chalk.yellowBright(
|
||||||
'[WARNING]',
|
'[WARNING]',
|
||||||
)} New Discord.js-selfbot-v13 version.
|
)} New Discord.js-selfbot-v13 version.
|
||||||
Old Version: ${chalk.redBright(Discord.version)} => New Version: ${chalk.greenBright(lastest_tag)}`);
|
Old Version: ${chalk.redBright(
|
||||||
}
|
Discord.version,
|
||||||
return console.log(
|
)} => New Version: ${chalk.greenBright(lastest_tag)}`);
|
||||||
`${chalk.greenBright(
|
}
|
||||||
'[OK]',
|
return console.log(
|
||||||
)} Discord.js-selfbot-v13 is up to date. Version: ${chalk.blueBright(
|
`${chalk.greenBright(
|
||||||
Discord.version,
|
'[OK]',
|
||||||
)}`,
|
)} Discord.js-selfbot-v13 is up to date. Version: ${chalk.blueBright(
|
||||||
);
|
Discord.version,
|
||||||
|
)}`,
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = (client, { d: data }, shard) => {
|
module.exports = (client, { d: data }, shard) => {
|
||||||
// console.log(data);
|
// console.log(data);
|
||||||
if (client.options.checkUpdate) checkUpdate();
|
if (client.options.checkUpdate) checkUpdate();
|
||||||
client.session_id = data.session_id;
|
client.session_id = data.session_id;
|
||||||
if (client.user) {
|
if (client.user) {
|
||||||
client.user._patch(data.user);
|
client.user._patch(data.user);
|
||||||
} else {
|
} else {
|
||||||
ClientUser ??= require('../../../structures/ClientUser');
|
ClientUser ??= require('../../../structures/ClientUser');
|
||||||
client.user = new ClientUser(client, data.user);
|
client.user = new ClientUser(client, data.user);
|
||||||
client.users.cache.set(client.user.id, client.user);
|
client.users.cache.set(client.user.id, client.user);
|
||||||
}
|
}
|
||||||
|
|
||||||
client.user.setAFK(true);
|
client.user.setAFK(true);
|
||||||
|
|
||||||
client.setting.fetch()
|
client.setting.fetch().then(async (res) => {
|
||||||
.then(async res => {
|
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
|
||||||
) {
|
) {
|
||||||
@ -59,32 +62,32 @@ module.exports = (client, { d: data }, shard) => {
|
|||||||
} else {
|
} else {
|
||||||
custom_status.setUnicodeEmoji(res.rawSetting.custom_status.emoji_name);
|
custom_status.setUnicodeEmoji(res.rawSetting.custom_status.emoji_name);
|
||||||
}
|
}
|
||||||
custom_status.setState(res.rawSetting.custom_status?.text);
|
custom_status.setState(res.rawSetting.custom_status?.text);
|
||||||
|
client.user.setPresence({
|
||||||
|
activities: custom_status ? [custom_status.toDiscord()] : [],
|
||||||
|
status: res.rawSetting.status,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
client.user.setPresence({
|
});
|
||||||
activities: custom_status ? [custom_status.toDiscord()] : [],
|
|
||||||
status: res.rawSetting.status,
|
|
||||||
});
|
|
||||||
})
|
|
||||||
|
|
||||||
for (const guild of data.guilds) {
|
for (const guild of data.guilds) {
|
||||||
guild.shardId = shard.id;
|
guild.shardId = shard.id;
|
||||||
client.guilds._add(guild);
|
client.guilds._add(guild);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const r of data.relationships) {
|
for (const r of data.relationships) {
|
||||||
if(r.type == 1) {
|
if (r.type == 1) {
|
||||||
client.friends.cache.set(r.id, new User(client, r.user));
|
client.friends.cache.set(r.id, new User(client, r.user));
|
||||||
} else if(r.type == 2) {
|
} else if (r.type == 2) {
|
||||||
client.blocked.cache.set(r.id, new User(client, r.user));
|
client.blocked.cache.set(r.id, new User(client, r.user));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (client.application) {
|
if (client.application) {
|
||||||
client.application._patch(data.application);
|
client.application._patch(data.application);
|
||||||
} else {
|
} else {
|
||||||
client.application = new ClientApplication(client, data.application);
|
client.application = new ClientApplication(client, data.application);
|
||||||
}
|
}
|
||||||
|
|
||||||
shard.checkReady();
|
shard.checkReady();
|
||||||
};
|
};
|
||||||
|
@ -9,7 +9,6 @@ exports.ShardingManager = require('./sharding/ShardingManager');
|
|||||||
exports.WebhookClient = require('./client/WebhookClient');
|
exports.WebhookClient = require('./client/WebhookClient');
|
||||||
|
|
||||||
// Utilities
|
// Utilities
|
||||||
exports.RichPresence = require('./RPC/index');
|
|
||||||
exports.ActivityFlagsBitField = require('./util/ActivityFlagsBitField');
|
exports.ActivityFlagsBitField = require('./util/ActivityFlagsBitField');
|
||||||
exports.ApplicationFlagsBitField = require('./util/ApplicationFlagsBitField');
|
exports.ApplicationFlagsBitField = require('./util/ApplicationFlagsBitField');
|
||||||
exports.BaseManager = require('./managers/BaseManager');
|
exports.BaseManager = require('./managers/BaseManager');
|
||||||
@ -72,6 +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('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');
|
||||||
|
1
typings/index.d.ts
vendored
1
typings/index.d.ts
vendored
@ -144,7 +144,6 @@ import {
|
|||||||
} from './rawDataTypes';
|
} from './rawDataTypes';
|
||||||
|
|
||||||
//#region Classes
|
//#region Classes
|
||||||
|
|
||||||
export class Activity {
|
export class Activity {
|
||||||
private constructor(presence: Presence, data?: RawActivityData);
|
private constructor(presence: Presence, data?: RawActivityData);
|
||||||
public applicationId: Snowflake | null;
|
public applicationId: Snowflake | null;
|
||||||
|
Loading…
Reference in New Issue
Block a user