From 46707b091e0b0c899653f7eceb0fc6fa531312e7 Mon Sep 17 00:00:00 2001 From: Braeden Sowinski Date: Mon, 1 Aug 2022 13:07:27 -0700 Subject: [PATCH] redundancy check --- commands/work-roles.js | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/commands/work-roles.js b/commands/work-roles.js index 1300159..12d606c 100644 --- a/commands/work-roles.js +++ b/commands/work-roles.js @@ -22,20 +22,28 @@ module.exports = { if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) { return interaction.send(`You are not allowed to use the bot in this channel.`); } - - let listEmbed = new MessageEmbed() - .setColor(client.config.EmbedColor) - .setTitle('List of Work Roles') - - let data = `` - for (let i = 0; i < GuildDB.incomeRoles.length; i++) { - data += `<@&${GuildDB.incomeRoles[i].role}> - $${GuildDB.incomeRoles[i].income} per day\n` + if (GuildDB.incomeRoleStatus) { + let listEmbed = new MessageEmbed() + .setColor(client.config.EmbedColor) + .setTitle('List of Work Roles') + + let data = `` + + for (let i = 0; i < GuildDB.incomeRoles.length; i++) { + data += `<@&${GuildDB.incomeRoles[i].role}> - $${GuildDB.incomeRoles[i].income} per day\n` + } + + listEmbed.setDescription(data) + + return interaction.send({ embeds: [listEmbed] }) + } else { + let noRoles = new MessageEmbed() + .setColor(client.config.EmbedColor) + .setDescription('**QuarksBot Notice:** There are no income roles') + + return interaction.send({ embeds: [noRoles] }); } - - listEmbed.setDescription(data) - - return interaction.send({ embeds: [listEmbed] }) }, }, } \ No newline at end of file