From 2b60f0ec12e7295282f407a0d848eb919b00dd0d Mon Sep 17 00:00:00 2001 From: MatteZ02 <47610069+MatteZ02@users.noreply.github.com> Date: Thu, 4 Jun 2020 17:46:43 +0300 Subject: [PATCH] some fixes and updates --- src/commands/lyrics.js | 11 ++++------- src/commands/restart.js | 3 +++ src/events/clientEvents/msg.js | 2 +- src/events/clientEvents/voiceStateUpdate.js | 3 --- src/struct/config/messages.js | 3 +-- src/struct/funcs/handleVideo.js | 1 + src/struct/funcs/play.js | 5 +++-- 7 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/commands/lyrics.js b/src/commands/lyrics.js index a0561475..105e6ca7 100644 --- a/src/commands/lyrics.js +++ b/src/commands/lyrics.js @@ -1,6 +1,4 @@ -const { - getLyrics -} = require("genius-lyrics-api"); +const { getLyrics } = require("genius-lyrics-api"); module.exports = { name: "lyrics", @@ -26,9 +24,8 @@ module.exports = { if (lyrics === null) return msg.channel.send(client.messages.noResultsLyrics); for (let i = 0; i < lyrics.length; i += 2000) { - let toi = "" - toi = - lyrics.substring(i, Math.min(lyrics.length, i + 2000)); + let toi = ""; + toi = lyrics.substring(i, Math.min(lyrics.length, i + 2000)); const embed = new Discord.MessageEmbed() .setTitle(client.messages.lyricsTitle) .setDescription(toi) @@ -37,4 +34,4 @@ module.exports = { } }); }, -}; \ No newline at end of file +}; diff --git a/src/commands/restart.js b/src/commands/restart.js index 22b6daf6..d9d9afda 100644 --- a/src/commands/restart.js +++ b/src/commands/restart.js @@ -7,6 +7,9 @@ module.exports = { permission: 'dev', category: 'util', async execute(msg, args, client, Discord, command) { + lient.funcs.saveDB(client); + msg.channel.send(client.messages.dbSaved); + msg.channel.send(client.messages.restart); client.shard.respawnAll(client.config.shardDelay, client.config.respawnDelay, client.config.spawnTimeout); } }; \ No newline at end of file diff --git a/src/events/clientEvents/msg.js b/src/events/clientEvents/msg.js index c2a07e2e..d7790c90 100644 --- a/src/events/clientEvents/msg.js +++ b/src/events/clientEvents/msg.js @@ -36,7 +36,7 @@ function getCommand(client, args, msg, Discord) { ); if (!command) return; if (command.onlyDev && msg.author.id !== client.config.devId) return; - if (client.config.devMode && msg.member.id !== client.config.devId) + if (client.config.devMode && msg.member.id !== client.config.devId && msg.guild.id !== "718081535240306738") return msg.channel.send(client.messages.devMode); client.funcs.exe(msg, args, client, Discord, command); } \ No newline at end of file diff --git a/src/events/clientEvents/voiceStateUpdate.js b/src/events/clientEvents/voiceStateUpdate.js index 1e515831..8826a6d1 100644 --- a/src/events/clientEvents/voiceStateUpdate.js +++ b/src/events/clientEvents/voiceStateUpdate.js @@ -19,9 +19,6 @@ module.exports = { } } if (oldState.channel.members.size === 1 && oldState.channel === queue.voiceChannel || change) { - queue.textChannel.send(client.messages.leftAlonePaused); - queue.paused = true; - queue.connection.dispatcher.pause(true); setTimeout(() => { if (!queue || !queue.connection.dispatcher || queue.connection.dispatcher === null) return; if (queue.voiceChannel.members.size === 1) { diff --git a/src/struct/config/messages.js b/src/struct/config/messages.js index fb3f4b06..8f511b39 100644 --- a/src/struct/config/messages.js +++ b/src/struct/config/messages.js @@ -63,8 +63,7 @@ module.exports = { joined: emojis.green_check_mark + "Joined", joinSupport: "Join the musix support server: ", keySet: emojis.green_check_mark + "Key set!", - leftAlone: "Music has been stopped since i was left alone for too long.", - leftAlonePaused: emojis.pause + "Paused the music as i have been left alone!", + leftAlone: "I have left the channel as i was left alone.", loadingSongs: emojis.loading + "Loading song(s)", looping: emojis.repeat + "Looping the queue now!", loopingSong: emojis.repeatSong + "Looping **%TITLE%** now!", diff --git a/src/struct/funcs/handleVideo.js b/src/struct/funcs/handleVideo.js index 2fdac3f7..52f28b30 100644 --- a/src/struct/funcs/handleVideo.js +++ b/src/struct/funcs/handleVideo.js @@ -48,6 +48,7 @@ module.exports = async function ( votesNeeded: null, time: 0, endReason: null, + exists: true }; construct.songs.push(song); diff --git a/src/struct/funcs/play.js b/src/struct/funcs/play.js index 3ae6ea91..4be3eb07 100644 --- a/src/struct/funcs/play.js +++ b/src/struct/funcs/play.js @@ -9,17 +9,18 @@ module.exports = async function (guild, song, client, seek, play) { const queue = client.queue.get(guild.id); if (!song) { queue.voiceChannel.leave(); + queue.exists = false; client.queue.delete(guild.id); return; } setTimeout(() => { - if (!queue.playing && queue) { + if (!queue.playing && queue.exists) { queue.textChannel.send(client.messages.tookTooLong); queue.voiceChannel.leave(); client.queue.delete(guild.id); return; } - }, 45000); + }, 10000); streamConfig.options.seek = seek;