Skip to content

Commit

Permalink
Fix: Cannot read properties of undefined (reading 'rest') (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
1Lucas1apk authored Dec 6, 2024
2 parents 85dc8da + 617e506 commit 3aeb4dd
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 36 deletions.
2 changes: 1 addition & 1 deletion dist/src/entities/Player.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/src/entities/Player.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions src/entities/Player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ export class Player {
this.autoPlay = config.autoPlay || false;
this.autoLeave = config.autoLeave || false;
this.queue = new (Structure.get("Queue"))();
this.filters = new (Structure.get("Filters"))(this);
this.node = this.manager.nodes.get(config.node);
this.filters = new (Structure.get("Filters"))(this);
if (manager.options.NodeLinkFeatures || this.node.info.isNodeLink) {
this.listen = new (Structure.get("Listen"))(this);
this.lyrics = new (Structure.get("Lyrics"))(this);
Expand Down Expand Up @@ -104,7 +104,7 @@ export class Player {
return true;
}

public connect(options: { setMute?: boolean; setDeaf?: boolean }): boolean {
public connect(options: { setMute?: boolean; setDeaf?: boolean }): boolean {
this.manager.sendPayload(
this.guildId,
JSON.stringify({
Expand All @@ -117,7 +117,7 @@ export class Player {
},
})
);

this.connected = true;
this.manager.emit("playerConnected", this);
return true;
Expand Down Expand Up @@ -206,17 +206,17 @@ export class Player {
},
},
});

options?.destroy ? this.destroy()
: this.queue.clear();
: this.queue.clear();

this.playing = false;
this.manager.emit("playerTriggeredStop", this);
return true;
}

public async skip(position?: number): Promise<boolean> {
if(!this.queue.size && this.autoPlay) {
if (!this.queue.size && this.autoPlay) {
await this.node.rest.update({
guildId: this.guildId,
data: {
Expand All @@ -226,7 +226,7 @@ export class Player {
},
});
} else if (!this.queue.size) return false;

validateProperty(
position,
(value) =>
Expand Down Expand Up @@ -302,7 +302,7 @@ export class Player {
volume: this.volume,
},
});

this.manager.emit("playerChangedVolume", this, oldVolume, volume);
return true;
}
Expand Down
Loading

0 comments on commit 3aeb4dd

Please sign in to comment.