add bal command

This commit is contained in:
SowinskiBraeden committed 2022-07-05 23:30:33 -07:00
1 parent 8aa71e5ffb
commit fe9bc52dec
3 files changed
+121 -11

No files matched your search

+14 -9
View File
@@ -119,8 +119,10 @@ class QuarksBot extends Client {
}
async GetGuild(GuildId) {
let serverID = GuildId;
let customChannelStatus, allowedChannels;
let actionChannel, tweetChannel;
let startingBalance;
let guild = await this.dbo.collection("guilds").findOne({"server.serverID":GuildId}).then(guild => guild);
// If guild not found, generate guild default
@@ -129,31 +131,34 @@ class QuarksBot extends Client {
server: {
serverID: GuildId,
hasCustomChannels: false,
allowedChannels: [],
actionChannel: null,
tweetChannel: null
tweetChannel: null,
startingBalance: 1000.00,
}
}
this.dbo.collection("guilds").insertOne(newGuild, function(err, res) {
if (err) throw err;
});
customChannelStatus = newGuild.server.hasCustomChannels;
allowedChannels = null;
actionChannel = null;
tweetChannel = null;
allowedChannels = newGuild.server.allowedChannels;
actionChannel = newGuild.server.actionChannel;
tweetChannel = newGuild.server.tweetChannel;
startingBalance = newGuild.server.startingBalance;
} else {
customChannelStatus = guild.server.hasCustomChannels;
allowedChannels = guild.server.allowedChannels;
actionChannel = guild.server.actionChannel;
tweetChannel = guild.server.tweetChannel;
if (this.exists(guild.server.allowedChannels) && guild.server.allowedChannels.length>0) {
allowedChannels = guild.server.allowedChannels;
} else allowedChannels = null;
startingBalance = guild.server.startingBalance;
}
let guildData = {
allowedChannels: allowedChannels,
serverID: serverID,
customChannelStatus: customChannelStatus,
allowedChannels: allowedChannels,
actionChannel: actionChannel,
tweetChannel: tweetChannel,
serverID: GuildId
startingBalance: startingBalance
}
return guildData;
}