Skip to content

Commit

Permalink
Update error message and correct autoplay function imports
Browse files Browse the repository at this point in the history
- Improve error message for missing 'endpoint' in VOICE_SERVER_UPDATE
- Fix incorrect imports for autoplay functions:
  - Update import from 'soundcloud, spotify' to 'spAutoPlay, scAutoPlay'
- Adjust function calls to use correctly imported names
  • Loading branch information
UnschooledGamer committed Sep 20, 2024
1 parent 2513ffc commit 5ba0df7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion build/structures/Connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ class Connection {

setServerUpdate(data) {
const { endpoint, token } = data;
if (!endpoint) throw new Error("Session not found");
if (!endpoint) throw new Error(`Missing 'endpoint' property in VOICE_SERVER_UPDATE packet/payload, Wait for some time Or Disconnect the Bot from Voice Channel and Try Again.`);

const previousVoiceRegion = this.region;

this.voice.endpoint = endpoint;
Expand Down
6 changes: 3 additions & 3 deletions build/structures/Player.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const { EventEmitter } = require("events");
const { Connection } = require("./Connection");
const { Filters } = require("./Filters");
const { Queue } = require("./Queue");
const { soundcloud, spotify } = require('../functions/autoPlay');
const { spAutoPlay, scAutoPlay } = require('../functions/autoPlay');

class Player extends EventEmitter {
constructor(riffy, node, options) {
Expand Down Expand Up @@ -113,7 +113,7 @@ class Player extends EventEmitter {
}
} else if (player.previous.info.sourceName === "soundcloud") {
try {
soundcloud(player.previous.info.uri).then(async (data) => {
scAutoPlay(player.previous.info.uri).then(async (data) => {
let response = await this.riffy.resolve({ query: data, source: "scsearch", requester: player.previous.info.requester });

if (this.node.rest.version === "v4") {
Expand All @@ -134,7 +134,7 @@ class Player extends EventEmitter {
}
} else if (player.previous.info.sourceName === "spotify") {
try {
spotify(player.previous.info.identifier).then(async (data) => {
spAutoPlay(player.previous.info.identifier).then(async (data) => {
const response = await this.riffy.resolve({ query: `https://open.spotify.com/track/${data}`, requester: player.previous.info.requester });

if (this.node.rest.version === "v4") {
Expand Down

0 comments on commit 5ba0df7

Please sign in to comment.