Files
discord.js-selfbot/src/client/websocket/handlers/RELATIONSHIP_ADD.js

20 lines
724 B
JavaScript
Raw Normal View History

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