Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: correctly import extendable classes #4744

Merged
merged 7 commits into from
Aug 28, 2020
Merged
7 changes: 5 additions & 2 deletions src/structures/GuildMember.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
'use strict';

const Base = require('./Base');
const { Presence } = require('./Presence');
const Role = require('./Role');
const VoiceState = require('./VoiceState');
const TextBasedChannel = require('./interfaces/TextBasedChannel');
const { Error } = require('../errors');
const GuildMemberRoleManager = require('../managers/GuildMemberRoleManager');
const Permissions = require('../util/Permissions');
let Structures;

/**
* Represents a member of a guild on Discord.
Expand Down Expand Up @@ -126,6 +125,8 @@ class GuildMember extends Base {
* @readonly
*/
get voice() {
if (!Structures) Structures = require('../util/Structures');
const VoiceState = Structures.get('VoiceState');
return this.guild.voiceStates.cache.get(this.id) || new VoiceState(this.guild, { user_id: this.id });
}

Expand Down Expand Up @@ -153,6 +154,8 @@ class GuildMember extends Base {
* @readonly
*/
get presence() {
if (!Structures) Structures = require('../util/Structures');
const Presence = Structures.get('Presence');
return (
this.guild.presences.cache.get(this.id) ||
new Presence(this.client, {
Expand Down
5 changes: 4 additions & 1 deletion src/structures/User.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
'use strict';

const Base = require('./Base');
const { Presence } = require('./Presence');
const TextBasedChannel = require('./interfaces/TextBasedChannel');
const { Error } = require('../errors');
const Snowflake = require('../util/Snowflake');
const UserFlags = require('../util/UserFlags');

let Structures;

/**
* Represents a user on Discord.
* @implements {TextBasedChannel}
Expand Down Expand Up @@ -156,6 +157,8 @@ class User extends Base {
for (const guild of this.client.guilds.cache.values()) {
if (guild.presences.cache.has(this.id)) return guild.presences.cache.get(this.id);
}
if (!Structures) Structures = require('../util/Structures');
const Presence = Structures.get('Presence');
return new Presence(this.client, { user: { id: this.id } });
}

Expand Down