Added cards to the leveling system, and fixed some bugs. Note that node-fetch has been bumped DOWN to v2 to avoid EMS format

This commit is contained in:
ION606
2022-12-26 14:40:50 -08:00
parent 5292bd8a09
commit ebb34c9f89
16 changed files with 240 additions and 96 deletions
+4 -2
View File
@@ -13,13 +13,15 @@ async function setCard(bot, interaction) {
function textToLevels(bot, message, xp_list) {
if (!bot.inDebugMode && message.guild.id == bot.home_server) { return; }
const author = message.author;
// doc.xp + (BASE.XP * doc.rank)
bot.mongoconnection.then((client) => {
const serverOpts = client.db(message.guild.id).collection('SETUP');
serverOpts.findOne({_id: "LEVELING"}).then((doc) => {
if (!doc) {
serverOpts.insertOne({_id: "LEVELING", enabled: false, card: undefined, text: undefined});
serverOpts.insertOne({_id: "LEVELING", enabled: false, card: undefined, text: undefined, col: "#FFFFFF"});
const server = bot.guilds.cache.get(message.guild.id);
server.members.fetch(message.guild.ownerId).then(function(owner) {
// Implement `setup leveling enable`
@@ -29,7 +31,7 @@ function textToLevels(bot, message, xp_list) {
const dbo = client.db(message.guild.id).collection(author.id);
dbo.findOne({"balance": {$exists: true}}).then((doc) => {
const newXp = doc.xp + Math.ceil((BASE.XP * doc.rank) / 4);
addxp(message, dbo, newXp, xp_list, true);
addxp(bot, message, dbo, newXp, xp_list, true);
});
}
});