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
+26
-21
@@ -191,31 +191,35 @@ class QuarksBot extends Client {
|
||||
this.guilds.cache.forEach((guild) => RegisterGuildCommands(this, guild.id));
|
||||
}
|
||||
|
||||
getDefaultSettings(GuildId) {
|
||||
return {
|
||||
serverID: GuildId,
|
||||
allowedChannels: [],
|
||||
actionChannel: null,
|
||||
tweetChannel: null,
|
||||
advertsChannel: null,
|
||||
dispatchChannel: null,
|
||||
startingBalance: 1000.00,
|
||||
incomeRoles: [],
|
||||
botAdmin: null,
|
||||
commercialRole: null,
|
||||
officerRole: null,
|
||||
dispatcherRole: null,
|
||||
onlyOfficersSearch: false,
|
||||
casinoMultiplier: 2,
|
||||
canIgnoreInvoices: true,
|
||||
workLimiter: 24,
|
||||
}
|
||||
}
|
||||
|
||||
async GetGuild(GuildId) {
|
||||
let guild = undefined;
|
||||
if (this.databaseConnected) guild = await this.dbo.collection("guilds").findOne({"server.serverID":GuildId}).then(guild => guild);
|
||||
|
||||
// If guild not found, generate guild default
|
||||
if (!guild) {
|
||||
guild = {
|
||||
server: {
|
||||
serverID: GuildId,
|
||||
allowedChannels: [],
|
||||
actionChannel: null,
|
||||
tweetChannel: null,
|
||||
advertsChannel: null,
|
||||
dispatchChannel: null,
|
||||
startingBalance: 1000.00,
|
||||
incomeRoles: [],
|
||||
botAdmin: null,
|
||||
commercialRole: null,
|
||||
officerRole: null,
|
||||
dispatcherRole: null,
|
||||
onlyOfficersSearch: false,
|
||||
casinoMultiplier: 2,
|
||||
canIgnoreInvoices: true,
|
||||
}
|
||||
}
|
||||
guild = {}
|
||||
guild.server = this.getDefaultSettings(GuildId);
|
||||
if (this.databaseConnected) {
|
||||
this.dbo.collection("guilds").insertOne(guild, function(err, res) {
|
||||
if (err) throw err;
|
||||
@@ -225,14 +229,14 @@ class QuarksBot extends Client {
|
||||
|
||||
let guildData = {
|
||||
serverID: GuildId,
|
||||
customChannelStatus: guild.server.allowedChannels.length > 0 ? true : false,
|
||||
customChannelStatus: guild.server.allowedChannels.length > 0 ? true : false, // not stored but calculated after
|
||||
allowedChannels: guild.server.allowedChannels,
|
||||
actionChannel: guild.server.actionChannel,
|
||||
tweetChannel: guild.server.tweetChannel,
|
||||
advertsChannel: guild.server.advertsChannel,
|
||||
dispatchChannel: guild.server.dispatchChannel,
|
||||
startingBalance: guild.server.startingBalance,
|
||||
incomeRoleStatus: guild.server.incomeRoles.length > 0 ? true : false,
|
||||
incomeRoleStatus: guild.server.incomeRoles.length > 0 ? true : false, // not stored but calculated after
|
||||
incomeRoles: guild.server.incomeRoles,
|
||||
commercialRole: guild.server.commercialRole,
|
||||
officerRole: guild.server.officerRole,
|
||||
@@ -241,6 +245,7 @@ class QuarksBot extends Client {
|
||||
botAdmin: guild.server.botAdmin,
|
||||
casinoMultiplier: guild.server.casinoMultiplier,
|
||||
canDismissInvoices: guild.server.canDismissInvoices,
|
||||
workLimiter: guild.server.workLimiter,
|
||||
}
|
||||
return guildData;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user