From 60959bb868469086023cfadc5d6ed65c806130c8 Mon Sep 17 00:00:00 2001 From: Timofei Galkin Date: Fri, 12 Jan 2024 13:26:11 +0300 Subject: [PATCH 1/2] feat(commands): reply message is auto removed --- djs-bot/commands/music/247.js | 6 ++++-- djs-bot/commands/music/autoleave.js | 6 ++++-- djs-bot/commands/music/autopause.js | 6 ++++-- djs-bot/commands/music/autoqueue.js | 6 ++++-- djs-bot/commands/music/stop.js | 6 +++++- 5 files changed, 21 insertions(+), 9 deletions(-) diff --git a/djs-bot/commands/music/247.js b/djs-bot/commands/music/247.js index 2f10b4afa..152602a0c 100644 --- a/djs-bot/commands/music/247.js +++ b/djs-bot/commands/music/247.js @@ -40,7 +40,7 @@ const command = new SlashCommand() ); const twentyFourSeven = player.get("twentyFourSeven"); - if (!twentyFourSeven || twentyFourSeven === false) { + if (!twentyFourSeven) { player.set("twentyFourSeven", true); } else { player.set("twentyFourSeven", false); @@ -66,7 +66,9 @@ const command = new SlashCommand() player.destroy(); } - return interaction.reply({ embeds: [twentyFourSevenEmbed] }); + const ret = await interaction.reply({ embeds: [twentyFourSevenEmbed], fetchReply: true }); + if (ret) setTimeout(() => ret.delete().catch(client.warn), 20000); + return ret; }); module.exports = command; diff --git a/djs-bot/commands/music/autoleave.js b/djs-bot/commands/music/autoleave.js index da1627089..334fc71b3 100644 --- a/djs-bot/commands/music/autoleave.js +++ b/djs-bot/commands/music/autoleave.js @@ -36,7 +36,7 @@ const command = new SlashCommand() const autoLeave = player.get("autoLeave"); player.set("requester", interaction.guild.members.me); - if (!autoLeave || autoLeave === false) { + if (!autoLeave) { player.set("autoLeave", true); } else { player.set("autoLeave", false); @@ -56,7 +56,9 @@ const command = new SlashCommand() }` ); - return interaction.reply({ embeds: [autoLeaveEmbed] }); + const ret = await interaction.reply({ embeds: [autoLeaveEmbed], fetchReply: true }); + if (ret) setTimeout(() => ret.delete().catch(client.warn), 20000); + return ret; }); module.exports = command; diff --git a/djs-bot/commands/music/autopause.js b/djs-bot/commands/music/autopause.js index adafaa14c..7937e38a5 100644 --- a/djs-bot/commands/music/autopause.js +++ b/djs-bot/commands/music/autopause.js @@ -36,7 +36,7 @@ const command = new SlashCommand() const autoPause = player.get("autoPause"); player.set("requester", interaction.guild.members.me); - if (!autoPause || autoPause === false) { + if (!autoPause) { player.set("autoPause", true); } else { player.set("autoPause", false); @@ -56,7 +56,9 @@ const command = new SlashCommand() }` ); - return interaction.reply({ embeds: [autoPauseEmbed] }); + const ret = await interaction.reply({ embeds: [autoPauseEmbed], fetchReply: true }); + if (ret) setTimeout(() => ret.delete().catch(client.warn), 20000); + return ret; }); module.exports = command; diff --git a/djs-bot/commands/music/autoqueue.js b/djs-bot/commands/music/autoqueue.js index f7ff8bbcc..097e0aa76 100644 --- a/djs-bot/commands/music/autoqueue.js +++ b/djs-bot/commands/music/autoqueue.js @@ -39,7 +39,7 @@ const command = new SlashCommand() const autoQueue = player.get("autoQueue"); player.set("requester", interaction.guild.members.me); - if (!autoQueue || autoQueue === false) { + if (!autoQueue) { player.set("autoQueue", true); } else { player.set("autoQueue", false); @@ -55,7 +55,9 @@ const command = new SlashCommand() }`, ); - return interaction.reply({ embeds: [autoQueueEmbed({autoQueue})] }); + const ret = await interaction.reply({ embeds: [autoQueueEmbed({autoQueue})], fetchReply: true }); + if (ret) setTimeout(() => ret.delete().catch(client.warn), 20000); + return ret; }); module.exports = command; diff --git a/djs-bot/commands/music/stop.js b/djs-bot/commands/music/stop.js index 441c2f4fe..41c94ecce 100644 --- a/djs-bot/commands/music/stop.js +++ b/djs-bot/commands/music/stop.js @@ -38,13 +38,17 @@ const command = new SlashCommand() const status = playerUtil.stop(player); - interaction.reply({ + const ret = await interaction.reply({ embeds: [ new EmbedBuilder() .setColor(client.config.embedColor) .setDescription(`:wave: | **Bye Bye!**`), ], + fetchReply: true }); + + if (ret) setTimeout(() => ret.delete().catch(client.warn), 20000); + return ret; }); module.exports = command; From 5304d889b45bd81beadba3ac788b81cab4b0544c Mon Sep 17 00:00:00 2001 From: Timofei Galkin Date: Fri, 12 Jan 2024 13:26:24 +0300 Subject: [PATCH 2/2] chore: bumped version --- djs-bot/package-lock.json | 4 ++-- djs-bot/package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/djs-bot/package-lock.json b/djs-bot/package-lock.json index d01314506..51955002c 100644 --- a/djs-bot/package-lock.json +++ b/djs-bot/package-lock.json @@ -1,12 +1,12 @@ { "name": "discord-musicbot", - "version": "5.3.2", + "version": "5.4.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "discord-musicbot", - "version": "5.3.2", + "version": "5.4.3", "license": "CUSTOM", "dependencies": { "@fastify/cors": "^8.3.0", diff --git a/djs-bot/package.json b/djs-bot/package.json index 291525fb6..b92da68e3 100644 --- a/djs-bot/package.json +++ b/djs-bot/package.json @@ -1,7 +1,7 @@ { "description": "", "main": "index.js", - "version": "5.4.1", + "version": "5.4.3", "name": "discord-musicbot", "scripts": { "guild": "npm run api-build && node scripts/guild",