Skip to content

Commit

Permalink
fix: correctly import extendable classes (#4744)
Browse files Browse the repository at this point in the history
  • Loading branch information
NotSugden committed Aug 28, 2020
1 parent 2dc70af commit 6aab9c3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
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

0 comments on commit 6aab9c3

Please sign in to comment.