diff --git a/commands/settings.js b/commands/settings.js index 8b75455..58070fc 100644 --- a/commands/settings.js +++ b/commands/settings.js @@ -1,4 +1,4 @@ -const { MessageEmbed } = require('discord.js'); +const { MessageEmbed, Guild } = require('discord.js'); module.exports = { name: "settings", @@ -135,6 +135,12 @@ module.exports = { required: true, }, ], + }, + { + name: "view", + description: "view current settings configuration", + value: "view", + type: 1, } ], /** @@ -478,6 +484,29 @@ module.exports = { .setColor('GREEN'); return interaction.send({ embeds: [successEmbed] }); + + } else if (args[0].name == 'view') { + const tweetChannel = client.exists(GuildDB.tweetChannel) ? `\n╚➤ <#${GuildDB.tweetChannel}>` : ''; + const tweetColor = client.exists(GuildDB.tweetChannel) ? '+ ' : '- '; + const actionChannel = client.exists(GuildDB.actionChannel) ? `\n╚➤ <#${GuildDB.actionChannel}>` : ''; + const actionColor = client.exists(GuildDB.actionChannel) ? '+ ' : '- '; + const channelsInfo = GuildDB.customChannelStatus ? '\n╚➤ \`/channels\` to view' : ''; + const channelColor = GuildDB.customChannelStatus ? '+ ' : '- '; + const incomeInfo = GuildDB.incomeRoleStatus ? '\n╚➤ \`/work-roles\` to view' : ''; + const incomeColor = GuildDB.incomeRoleStatus ? '+ ' : '- '; + const settingsEmbed = new MessageEmbed() + .setColor(client.config.EmbedColor) + .setTitle('Current Guild Configurations') + .addFields( + { name: 'Guild ID', value: `\`\`\`arm\n${GuildDB.serverID}\`\`\``, inline: true }, + { name: 'Has Income Roles?', value: `\`\`\`diff\n${incomeColor}${GuildDB.incomeRoleStatus}\`\`\`${incomeInfo}`, inline: true }, + { name: 'Has Allowed Channels?', value: `\`\`\`diff\n${channelColor}${GuildDB.customChannelStatus}\`\`\`${channelsInfo}`, inline: true }, + { name: 'Has Tweet Channel?', value: `\`\`\`diff\n${tweetColor}${client.exists(GuildDB.tweetChannel)}\`\`\`${tweetChannel}`, inline: true }, + { name: 'Has Action Channel?', value: `\`\`\`diff\n${actionColor}${client.exists(GuildDB.actionChannel)}\`\`\`${actionChannel}`, inline: true }, + { name: 'Starting Balance', value: `\`\`\`arm\n$${GuildDB.startingBalance}\`\`\``, inline: true }, + ); + + return interaction.send({ embeds: [settingsEmbed] }); } }, }, diff --git a/structures/QuarksBot.js b/structures/QuarksBot.js index 7d90451..ccd7f45 100644 --- a/structures/QuarksBot.js +++ b/structures/QuarksBot.js @@ -125,7 +125,7 @@ class QuarksBot extends Client { let serverID = GuildId; let customChannelStatus, allowedChannels; let actionChannel, tweetChannel; - let startingBalance, incomeRoles; + let startingBalance, incomeRoles, incomeRoleStatus; let guild = await this.dbo.collection("guilds").findOne({"server.serverID":GuildId}).then(guild => guild); // If guild not found, generate guild default @@ -138,24 +138,27 @@ class QuarksBot extends Client { actionChannel: null, tweetChannel: null, startingBalance: 1000.00, + hasIncomeRoles: false, incomeRoles: [], } } this.dbo.collection("guilds").insertOne(newGuild, function(err, res) { if (err) throw err; }); - customChannelStatus = newGuild.server.hasCustomChannels; + customChannelStatus = false; allowedChannels = newGuild.server.allowedChannels; actionChannel = newGuild.server.actionChannel; tweetChannel = newGuild.server.tweetChannel; startingBalance = newGuild.server.startingBalance; + incomeRoleStatus = newGuild.server.hasIncomeRoles incomeRoles = newGuild.server.incomeRoles; } else { - customChannelStatus = guild.server.hasCustomChannels; + customChannelStatus = guild.server.allowedChannels.length > 0 ? true : false; allowedChannels = guild.server.allowedChannels; actionChannel = guild.server.actionChannel; tweetChannel = guild.server.tweetChannel; startingBalance = guild.server.startingBalance; + incomeRoleStatus = guild.server.incomeRoles.length > 0 ? true : false; incomeRoles = guild.server.incomeRoles; } let guildData = { @@ -165,6 +168,7 @@ class QuarksBot extends Client { actionChannel: actionChannel, tweetChannel: tweetChannel, startingBalance: startingBalance, + incomeRoleStatus: incomeRoleStatus, incomeRoles: incomeRoles, } return guildData;