mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-19 04:53:30 +01:00
Fix ClientUser not extending custom User
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
const AbstractHandler = require('./AbstractHandler');
|
const AbstractHandler = require('./AbstractHandler');
|
||||||
const { Events } = require('../../../../util/Constants');
|
const { Events } = require('../../../../util/Constants');
|
||||||
const ClientUser = require('../../../../structures/ClientUser');
|
let ClientUser;
|
||||||
|
|
||||||
class ReadyHandler extends AbstractHandler {
|
class ReadyHandler extends AbstractHandler {
|
||||||
handle(packet) {
|
handle(packet) {
|
||||||
@@ -12,6 +12,7 @@ class ReadyHandler extends AbstractHandler {
|
|||||||
data.user.user_settings = data.user_settings;
|
data.user.user_settings = data.user_settings;
|
||||||
data.user.user_guild_settings = data.user_guild_settings;
|
data.user.user_guild_settings = data.user_guild_settings;
|
||||||
|
|
||||||
|
if (!ClientUser) ClientUser = require('../../../../structures/ClientUser');
|
||||||
const clientUser = new ClientUser(client, data.user);
|
const clientUser = new ClientUser(client, data.user);
|
||||||
client.user = clientUser;
|
client.user = clientUser;
|
||||||
client.readyAt = new Date();
|
client.readyAt = new Date();
|
||||||
|
|||||||
@@ -47,7 +47,10 @@ module.exports = {
|
|||||||
CategoryChannel: require('./structures/CategoryChannel'),
|
CategoryChannel: require('./structures/CategoryChannel'),
|
||||||
Channel: require('./structures/Channel'),
|
Channel: require('./structures/Channel'),
|
||||||
ClientApplication: require('./structures/ClientApplication'),
|
ClientApplication: require('./structures/ClientApplication'),
|
||||||
ClientUser: require('./structures/ClientUser'),
|
get ClientUser() {
|
||||||
|
// This is a getter so that it properly extends any custom User class
|
||||||
|
return require('./structures/ClientUser');
|
||||||
|
},
|
||||||
ClientUserChannelOverride: require('./structures/ClientUserChannelOverride'),
|
ClientUserChannelOverride: require('./structures/ClientUserChannelOverride'),
|
||||||
ClientUserGuildSettings: require('./structures/ClientUserGuildSettings'),
|
ClientUserGuildSettings: require('./structures/ClientUserGuildSettings'),
|
||||||
ClientUserSettings: require('./structures/ClientUserSettings'),
|
ClientUserSettings: require('./structures/ClientUserSettings'),
|
||||||
@@ -81,3 +84,5 @@ module.exports = {
|
|||||||
|
|
||||||
WebSocket: require('./WebSocket'),
|
WebSocket: require('./WebSocket'),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Object.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
const User = require('./User');
|
const Structures = require('../util/Structures');
|
||||||
const Collection = require('../util/Collection');
|
const Collection = require('../util/Collection');
|
||||||
const ClientUserSettings = require('./ClientUserSettings');
|
const ClientUserSettings = require('./ClientUserSettings');
|
||||||
const ClientUserGuildSettings = require('./ClientUserGuildSettings');
|
const ClientUserGuildSettings = require('./ClientUserGuildSettings');
|
||||||
@@ -11,7 +11,7 @@ const Guild = require('./Guild');
|
|||||||
* Represents the logged in client's Discord user.
|
* Represents the logged in client's Discord user.
|
||||||
* @extends {User}
|
* @extends {User}
|
||||||
*/
|
*/
|
||||||
class ClientUser extends User {
|
class ClientUser extends Structures.get('User') {
|
||||||
_patch(data) {
|
_patch(data) {
|
||||||
super._patch(data);
|
super._patch(data);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user