13.2.0 configure work limiter && better default guild settings handler
This commit is contained in:
5 files changed
+60
-38
No files matched your search
+25
-15
@@ -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);
|
||||
});
|
||||
|
||||
+2
-1
@@ -64,7 +64,8 @@ module.exports = {
|
||||
diff /= (60 * 60);
|
||||
let hoursBetweenDates = Math.abs(Math.round(diff));
|
||||
|
||||
if (hoursBetweenDates >= 24) {
|
||||
// work limiter is # of hours to wait before next time a user can use /work
|
||||
if (hoursBetweenDates >= GuildDB.workLimiter) {
|
||||
let workRoles = []
|
||||
let workPays = []
|
||||
for (let i = 0; i < GuildDB.incomeRoles.length; i++) {
|
||||
|
||||
Reference in new issue
Block a user