first update to dev branch

This commit is contained in:
Marcus Netz
2020-11-21 21:29:18 +01:00
parent f468c4f7d6
commit 0136d087f5
14 changed files with 13519 additions and 1110 deletions

View File

@ -3,7 +3,7 @@ const create = require('./create');
const add = require('./add');
const remove = require('./remove');
const show = require('./show');
const mysql = require('mysql');
const talent = require('./talent')
require('dotenv').config();
const prefix = '!';
@ -12,33 +12,23 @@ const commands = {
create,
add,
remove,
show
show,
talent
};
var Datastore = require('nedb'),
db = new Datastore({
filename: 'dsabot.db',
autoload: true
});
var db = mysql.createConnection({
host : 'localhost',
port : '3306',
user : 'root',
password : process.env.DB_PASSWORD,
database : 'DSA'
});
module.exports = async (message) => {
if (!message.content.startsWith(prefix) || message.author.bot) return;
db.connect((err) => {
if(err){
throw err;
}
console.log('MySql connected...');
});
module.exports = async (message) =>{
//command manager
if (!message.content.startsWith(prefix) || message.author.bot) return;
const args = message.content.slice(prefix.length).split(' ');
const command = args.shift().toLowerCase();
if(Object.keys(commands).includes(command)) {
if (Object.keys(commands).includes(command)) {
commands[command](message, args, db);
}
};
};