You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
Luno/util/oncommand.js

25 lines
1.2 KiB

const Discord = require('discord.js');
const mongoose = require('mongoose');
const chalk = require('chalk');
const UserData = require('../models/user');
module.exports = async (message, msg, args, cmd, prefix, mention, client) => {
/*const config = client.config;
try {
await mongoose.connect(`mongodb+srv://${config.database.user}:${config.database.password}@${config.database.cluster}.uqyvv.mongodb.net`, {
useFindAndModify: false, useNewUrlParser: true, dbName: 'valk', useUnifiedTopology: true
});
} catch (e) {
let date = new Date; date = date.toString().slice(date.toString().search(":") - 2, date.toString().search(":") + 6);
console.error(`\n${chalk.red('[ERROR]')} >> ${chalk.yellow(`At [${date}] | Occurred while trying to connect to Mongo Cluster`)}`, e);
}*/
let botData = await require('../models/bot').findOne({finder: 'lel'});
botData.commands = botData.commands + 1;
botData.save();
let tu = await UserData.findOne({uid: message.author.id})
? await UserData.findOne({uid: message.author.id})
: new UserData({uid: message.author.id});
tu.commands = tu.commands + 1;
tu.save();
};