Skip to content

Commit

Permalink
[Fix] various fixes and improvements to the help and bassboost commnads
Browse files Browse the repository at this point in the history
  • Loading branch information
naseif committed Oct 4, 2021
1 parent 5311fe0 commit 97bf3c1
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 25 deletions.
35 changes: 25 additions & 10 deletions commands/Misc/help.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ module.exports = {
return self.indexOf(value) === index;
}

const cmd = args.join(" ");
const searchCommand = args.join(" ");
const categories = listCategories(client.commands).filter(onlyUnique);

if (!cmd) {
if (!searchCommand) {
const embed = {
color: "#9dcc37",
title: `${client.user.username}'s Categories!`,
Expand All @@ -53,20 +53,26 @@ module.exports = {
return await message.channel.send({ embeds: [embed] });
}

if (cmd) {
if (searchCommand) {
const command =
client.commands.get(cmd) ||
client.commands.find((cmd) => cmd.aliases && cmd.aliases.includes(cmd));
client.commands.get(searchCommand) ||
client.commands.find(
(cmd) => cmd.aliases && cmd.aliases.includes(searchCommand)
);
console.log(command);

if (categories.includes("`" + cmd + "`")) {
const commandsperCategory = printHelpByCollection(client.commands, cmd);
if (categories.includes("`" + searchCommand + "`")) {
const commandsperCategory = printHelpByCollection(
client.commands,
searchCommand
);
if (!commandsperCategory)
return await message.channel.send(
`Category does not exist. Make sure to write the category name as it is`
);
const embed = {
color: "#9dcc37",
title: `${client.user.username}'s ${cmd} Commands!`,
title: `${client.user.username}'s ${searchCommand} Commands!`,
description: `${commandsperCategory.join("\n")}`,
timestamp: new Date(),
footer: {
Expand All @@ -77,34 +83,43 @@ module.exports = {
return await message.channel.send({ embeds: [embed] });
}

if (!command && !categories.includes("`" + cmd + "`")) {
if (!command && !categories.includes("`" + searchCommand + "`")) {
return await message.channel.send(
"What you provided is neither a command nor a category"
);
}

if (!categories.includes("`" + cmd + "`")) {
if (!categories.includes("`" + searchCommand + "`")) {
const embed = {
color: "#9dcc37",
fields: [
{
name: "Command",
value: "`" + `${command.name}` + "`",
inline: true,
},
{
name: "Aliases",
value:
"`" +
`${command.aliases ? command?.aliases.join(", ") : "None"}` +
"`",
inline: true,
},
{
name: "Requires arguments?",
value: `${command?.args ? "Yes" : "No"}`,
inline: true,
},
{
name: "Category",
value: `${command.category}`,
inline: true,
},
{
name: "Description",
value: `${command.description}`,
inline: true,
},
{
name: "Usage",
Expand Down
6 changes: 3 additions & 3 deletions commands/Music/8D.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = {
args: true,
description: "Sets 8D audio filter to your music",
usage: "8d <on> || <off>",
async run(message, args, client) {
async run(message, args, client, prefix) {
const queue = client.player.getQueue(message.guild);

if (!queue) {
Expand All @@ -25,7 +25,7 @@ module.exports = {
embeds: [
embedMessage(
"#9dcc37",
`Please provide whether you want to on/off the filter`
`Please provide whether you want to on/off the filter, see ${prefix}h bass for more info about this command`
),
],
});
Expand All @@ -48,7 +48,7 @@ module.exports = {
break;
case "off":
try {
await queue.setFilters({ "8D": false });
await queue.setFilters({});
await message.channel.send({
embeds: [embedMessage("#9dcc37", `✅ 8D Filter has been disabled`)],
});
Expand Down
25 changes: 13 additions & 12 deletions commands/Music/bassboost.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,10 @@ module.exports = {
aliases: ["bass"],
args: true,
description: "Sets bassboost audio filter to your music",
usage: "bass <low> || <medium> || high || off",
async run(message, args, client) {
usage: "bass <low> || <medium> || <high> || <off>, default <medium>",
async run(message, args, client, prefix) {
const queue = client.player.getQueue(message.guild);

if (!args[0])
return await message.channel.send({
embeds: [
embedMessage(
"9dcc37",
`Please provide whether you want to on/off the filter`
),
],
});

if (!queue) {
return await message.channel.send({
embeds: [
Expand Down Expand Up @@ -71,6 +61,17 @@ module.exports = {
],
});
break;
default:
await queue.setFilters({ bassboost: true });
await message.channel.send({
embeds: [
embedMessage(
"#9dcc37",
`✅ Bassboost Medium Filter has been enabled, see ${prefix}h bass for more info about this command`
),
],
});
break;
}
},
data: new SlashCommandBuilder()
Expand Down

0 comments on commit 97bf3c1

Please sign in to comment.