mirror of
https://github.com/ION606/selmerBot.git
synced 2026-06-05 23:06:14 +00:00
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:
@@ -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);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user