mirror of
https://github.com/danbulant/discord.js
synced 2026-05-31 05:11:51 +00:00
31 lines
630 B
JavaScript
31 lines
630 B
JavaScript
const Action = require('./Action');
|
|
const { Events } = require('../../util/Constants');
|
|
|
|
class UserUpdateAction extends Action {
|
|
handle(data) {
|
|
const client = this.client;
|
|
|
|
if (client.user) {
|
|
if (client.user.equals(data)) {
|
|
return {
|
|
old: client.user,
|
|
updated: client.user,
|
|
};
|
|
}
|
|
|
|
const oldUser = client.user._update(data);
|
|
client.emit(Events.USER_UPDATE, oldUser, client.user);
|
|
return {
|
|
old: oldUser,
|
|
updated: client.user,
|
|
};
|
|
}
|
|
|
|
return {
|
|
old: null,
|
|
updated: null,
|
|
};
|
|
}
|
|
}
|
|
|
|
module.exports = UserUpdateAction;
|