2022-04-12 12:46:08 +07:00
|
|
|
'use strict';
|
|
|
|
|
|
2022-06-11 20:13:52 +07:00
|
|
|
const { Events, RelationshipTypes } = require('../../../util/Constants');
|
2022-04-12 12:46:08 +07:00
|
|
|
|
|
|
|
|
module.exports = (client, { d: data }) => {
|
2022-04-16 19:01:05 +07:00
|
|
|
if (data.user) {
|
|
|
|
|
client.users._add(data.user);
|
|
|
|
|
}
|
2022-04-16 17:44:43 +07:00
|
|
|
client.relationships.cache.set(data.id, data.type);
|
|
|
|
|
/**
|
|
|
|
|
* Emitted whenever a relationship is updated.
|
2022-05-06 21:17:20 +07:00
|
|
|
* @event Client#relationshipAdd
|
2022-06-11 20:17:27 +07:00
|
|
|
* @param {Snowflake} user The userID that was updated
|
2022-06-12 19:13:12 +07:00
|
|
|
* @param {RelationshipTypes} type The new relationship type
|
2022-04-16 17:44:43 +07:00
|
|
|
*/
|
2022-06-11 20:13:52 +07:00
|
|
|
client.emit(Events.RELATIONSHIP_ADD, data.id, RelationshipTypes[data.type]);
|
2022-04-12 12:46:08 +07:00
|
|
|
};
|