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;