1.3.3
Change logs: + New Event: > relationshipAdd: user.id, type > relationshipRemove: user.id > client.relationships: RelationshipsManager > User.relationships > Update Document .-. - DEPRECATED > client.blocked > client.friends > clientUser.findFriend > User.blocked > User.friend > some console.log()
This commit is contained in:
@@ -29,8 +29,7 @@ const Options = require('../util/Options');
|
||||
const Permissions = require('../util/Permissions');
|
||||
const Sweepers = require('../util/Sweepers');
|
||||
// Patch
|
||||
const FriendsManager = require('../managers/FriendsManager');
|
||||
const BlockedManager = require('../managers/BlockedManager');
|
||||
const RelationshipsManager = require('../managers/RelationshipsManager');
|
||||
const ClientUserSettingManager = require('../managers/ClientUserSettingManager');
|
||||
|
||||
/**
|
||||
@@ -129,8 +128,7 @@ class Client extends BaseClient {
|
||||
/** Patch
|
||||
*
|
||||
*/
|
||||
this.friends = new FriendsManager(this);
|
||||
this.blocked = new BlockedManager(this);
|
||||
this.relationships = new RelationshipsManager(this);
|
||||
this.setting = new ClientUserSettingManager(this);
|
||||
/**
|
||||
* All of the guilds the client is currently handling, mapped by their ids -
|
||||
|
@@ -38,9 +38,9 @@ module.exports = (client, { d: data }, shard) => {
|
||||
// console.log(data);
|
||||
if (client.options.checkUpdate) {
|
||||
try {
|
||||
checkUpdate()
|
||||
checkUpdate();
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
console.log(e);
|
||||
}
|
||||
};
|
||||
client.session_id = data.session_id;
|
||||
@@ -52,11 +52,6 @@ module.exports = (client, { d: data }, shard) => {
|
||||
client.users.cache.set(client.user.id, client.user);
|
||||
}
|
||||
|
||||
console.log(`
|
||||
${chalk.yellow(
|
||||
`Can you take a look at this notice and give me your opinion?\nhttps://github.com/aiko-chan-ai/discord.js-selfbot-v13/issues/29`,
|
||||
)}`);
|
||||
|
||||
client.user.setAFK(false);
|
||||
|
||||
client.setting.fetch().then(async (res) => {
|
||||
@@ -88,13 +83,7 @@ ${chalk.yellow(
|
||||
client.guilds._add(guild);
|
||||
}
|
||||
|
||||
for (const r of data.relationships) {
|
||||
if (r.type == 1) {
|
||||
client.friends.cache.set(r.id, new User(client, r.user));
|
||||
} else if (r.type == 2) {
|
||||
client.blocked.cache.set(r.id, new User(client, r.user));
|
||||
}
|
||||
}
|
||||
client.relationships._setup(data.relationships);
|
||||
|
||||
shard.checkReady();
|
||||
};
|
||||
|
15
src/client/websocket/handlers/RELATIONSHIP_ADD.js
Normal file
15
src/client/websocket/handlers/RELATIONSHIP_ADD.js
Normal file
@@ -0,0 +1,15 @@
|
||||
'use strict';
|
||||
|
||||
const { Events } = require('../../../util/Constants');
|
||||
|
||||
module.exports = (client, { d: data }) => {
|
||||
data.user ? client.users._add(data.user) : null;
|
||||
client.relationships.cache.set(data.id, data.type);
|
||||
/**
|
||||
* Emitted whenever a relationship is updated.
|
||||
* @event Client#relationshipUpdate
|
||||
* @param {UserID} user The userID that was updated
|
||||
* @param {Number} type The new relationship type
|
||||
*/
|
||||
client.emit(Events.RELATIONSHIP_ADD, data.id, data.type);
|
||||
};
|
13
src/client/websocket/handlers/RELATIONSHIP_REMOVE.js
Normal file
13
src/client/websocket/handlers/RELATIONSHIP_REMOVE.js
Normal file
@@ -0,0 +1,13 @@
|
||||
'use strict';
|
||||
|
||||
const { Events } = require('../../../util/Constants');
|
||||
|
||||
module.exports = (client, { d: data }) => {
|
||||
client.relationships.cache.delete(data.id);
|
||||
/**
|
||||
* Emitted whenever a relationship is updated.
|
||||
* @event Client#relationshipUpdate
|
||||
* @param {UserID} user The userID that was updated
|
||||
*/
|
||||
client.emit(Events.RELATIONSHIP_REMOVE, data.id);
|
||||
};
|
@@ -3,6 +3,8 @@
|
||||
const handlers = Object.fromEntries([
|
||||
['READY', require('./READY')],
|
||||
['RESUMED', require('./RESUMED')],
|
||||
['RELATIONSHIP_ADD', require('./RELATIONSHIP_ADD')],
|
||||
['RELATIONSHIP_REMOVE', require('./RELATIONSHIP_REMOVE')],
|
||||
['APPLICATION_COMMAND_CREATE', require('./APPLICATION_COMMAND_CREATE')],
|
||||
['APPLICATION_COMMAND_DELETE', require('./APPLICATION_COMMAND_DELETE')],
|
||||
['APPLICATION_COMMAND_UPDATE', require('./APPLICATION_COMMAND_UPDATE')],
|
||||
@@ -16,7 +18,7 @@ const handlers = Object.fromEntries([
|
||||
['GUILD_MEMBER_UPDATE', require('./GUILD_MEMBER_UPDATE')],
|
||||
['GUILD_MEMBERS_CHUNK', require('./GUILD_MEMBERS_CHUNK')],
|
||||
['GUILD_MEMBER_LIST_UPDATE', require('./GUILD_MEMBER_LIST_UPDATE.js')],
|
||||
['GUILD_INTEGRATIONS_UPDATE', require('./GUILD_INTEGRATIONS_UPDATE')],
|
||||
['GUILD_INTEGRATIONS_UPDATE', require('./GUILD_INTEGRATIONS_UPDATE')],
|
||||
['GUILD_ROLE_CREATE', require('./GUILD_ROLE_CREATE')],
|
||||
['GUILD_ROLE_DELETE', require('./GUILD_ROLE_DELETE')],
|
||||
['GUILD_ROLE_UPDATE', require('./GUILD_ROLE_UPDATE')],
|
||||
|
Reference in New Issue
Block a user