13.2.0 configure work limiter && better default guild settings handler

This commit is contained in:
SowinskiBraeden committed 2022-11-01 10:36:21 -07:00
1 parent c64f1362c4
commit 79f89fe2dd
5 files changed
+60 -38

No files matched your search

+25 -15
View File
@@ -365,6 +365,19 @@ module.exports = {
required: true,
}]
},
{
name: "work_limiter",
description: "Configure the number of hours users have to wait to work again",
value: "work_limiter",
type: 1,
options: [{
name: "hours",
description: "Set the hours to wait till a user can work again",
value: 24,
type: 4,
min_value: 1,
}]
},
{
name: "reset",
description: "Restore all settings to default configurations",
@@ -847,6 +860,17 @@ module.exports = {
return interaction.send({ embeds: [successEmbed] });
} else if (arg[0].name == 'work_limiter') {
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$set: {"server.workLimiter": args[0].options[0].value}}, function(err, res) {
if (err) return client.sendInternalError(interaction, err);
});
const successEmbed = new EmbedBuilder()
.setColor(client.config.Colors.Green)
.setDescription(`**Success:** Set work limiter to **${args[0].options[0].value}** hours. Users need to wait this set amount of time to use the \`/work\` command again.`);
return interaction.send({ embeds: [successEmbed] });
} else if (args[0].name == 'reset') {
const prompt = new EmbedBuilder()
.setTitle(`Woah!? Hold on.`)
@@ -1180,21 +1204,7 @@ module.exports = {
let action = '';
if (interaction.customId.split('-')[1]=='yes') {
action = 'reset';
const defaultGuildConfig = {
serverID: GuildDB.serverID,
allowedChannels: [],
actionChannel: null,
tweetChannel: null,
advertsChannel: null,
dispatchChannel: null,
startingBalance: 1000.00,
incomeRoles: [],
botAdmin: null,
commercialRole: null,
officerRole: null,
dispatcherRole: null,
onlyOfficersSearch: false,
}
const defaultGuildConfig = client.getDefaultSettings(GuildDB.serverID);
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$set: {"server": defaultGuildConfig}}, function(err, res) {
if (err) return client.sendInternalError(interaction, err);
});