Skip to content

Commit

Permalink
[5.4.3] More commands now remove their reply (#197)
Browse files Browse the repository at this point in the history
`/247`, `/autoleave`, `/autopause`, `/autoqueue` and `/stop` now remove
their message after time

## Status and versioning classification:

- Code changes have been tested against the Discord API, or there are no
code changes
- I know how to update typings and have done so, or typings don't need
updating
  • Loading branch information
brianferri authored Jan 12, 2024
2 parents 66a4987 + e9e1bbe commit dd185a2
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 12 deletions.
6 changes: 4 additions & 2 deletions djs-bot/commands/music/247.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
6 changes: 4 additions & 2 deletions djs-bot/commands/music/autoleave.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
6 changes: 4 additions & 2 deletions djs-bot/commands/music/autopause.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
6 changes: 4 additions & 2 deletions djs-bot/commands/music/autoqueue.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
6 changes: 5 additions & 1 deletion djs-bot/commands/music/stop.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
4 changes: 2 additions & 2 deletions djs-bot/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion djs-bot/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"description": "",
"main": "index.js",
"version": "5.4.2",
"version": "5.4.3",
"name": "discord-musicbot",
"scripts": {
"guild": "npm run api-build && node scripts/guild",
Expand Down

0 comments on commit dd185a2

Please sign in to comment.