Files
discord.js-selfbot/src/client/websocket/handlers/RELATIONSHIP_ADD.js
2024-01-08 20:41:56 +07:00

20 lines
724 B
JavaScript

'use strict';
const { Events } = require('../../../util/Constants');
module.exports = (client, { d: data }) => {
if (data.user) {
client.users._add(data.user);
}
client.relationships.cache.set(data.id, data.type);
client.relationships.friendNicknames.set(data.id, data.nickname);
client.relationships.sinceCache.set(data.id, new Date(data.since || 0));
/**
* Emitted when a relationship is created, relevant to the current user.
* @event Client#relationshipAdd
* @param {Snowflake} user Target userId
* @param {boolean} shouldNotify Whether the client should notify the user of this relationship's creation
*/
client.emit(Events.RELATIONSHIP_ADD, data.id, Boolean(data.should_notify));
};