MCPcopy
hub / github.com/eritislami/evobot / processQueue

Method processQueue

structs/MusicQueue.ts:178–204  ·  view source on GitHub ↗

* Processes the song queue for playback. This method checks if the queue is locked or if the player * is busy. If not, it proceeds to play the next song in the queue. This method is also responsible * for handling playback errors and retrying song playback when necessary. It ensures that the q

()

Source from the content-addressed store, hash-verified

176 * continues to play smoothly, handling transitions between songs, including loop and stop behaviors.
177 */
178 public async processQueue(): Promise<void> {
179 if (this.queueLock || this.player.state.status !== AudioPlayerStatus.Idle) {
180 return;
181 }
182
183 if (!this.songs.length) {
184 return this.stop();
185 }
186
187 this.queueLock = true;
188
189 const next = this.songs[0];
190
191 try {
192 const resource = await next.makeResource();
193
194 this.resource = resource!;
195 this.player.play(this.resource);
196 this.resource.volume?.setVolumeLogarithmic(this.volume / 100);
197 } catch (error) {
198 console.error(error);
199
200 return this.processQueue();
201 } finally {
202 this.queueLock = false;
203 }
204 }
205
206 private async handleSkip(interaction: ButtonInteraction): Promise<void> {
207 await this.bot.slashCommandsMap.get("skip")!.execute(interaction);

Callers 2

constructorMethod · 0.95
enqueueMethod · 0.95

Calls 2

stopMethod · 0.95
makeResourceMethod · 0.80

Tested by

no test coverage detected