Skip to content

Commit

Permalink
improve work efficiency
Browse files Browse the repository at this point in the history
  • Loading branch information
Maseshi committed May 28, 2022
1 parent a43ce4b commit 1bd14ad
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions source/handlers/music.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const { getVoiceConnection } = require("@discordjs/voice");
const catchError = require("../extras/catchError");

module.exports = (client) => {
Expand All @@ -20,11 +19,11 @@ module.exports = (client) => {

client.music.on("error", (channel, error) => {
const meChannel = channel.guild.me.voice.channel;
const connection = getVoiceConnection(meChannel.guild.id);
const connection = client.music.voices.get(meChannel.guild);

if ((error.toString()).includes("Unknown Playlist")) return channel.send(client.translate.handlers.music.error.playlist_not_found);

connection.destroy();
connection.leave(meChannel.guild);
catchError(client, channel, "music", error);
});

Expand Down

0 comments on commit 1bd14ad

Please sign in to comment.