Started database manager

This commit is contained in:
ahoZiorce
2018-07-02 00:40:55 +02:00
parent fa000a6c37
commit 6ecb727ff3
2 changed files with 28 additions and 4 deletions

View File

@@ -2,10 +2,10 @@ const commandH = require('../commandHandler');
const bot = require('../botClient').bot;
exports.loadModule = function loadModule () {
commandH.endpoint('^ping test$', (match, message) => {
bot.createMessage(message.channel.id, 'hey ho');
commandH.endpoint('^ping$', (match, message) => {
bot.createMessage(message.channel.id, 'Pong');
});
commandH.endpoint('^ping test (.*)$', (match, message) => {
bot.createMessage(message.channel.id, 'hey ho ' + match[1]);
commandH.endpoint('^ping (.*)$', (match, message) => {
bot.createMessage(message.channel.id, 'Pong : ' + match[1]);
});
}

24
src/dbManager.js Normal file
View File

@@ -0,0 +1,24 @@
const sequelize = require('sequelize');
const database = new sequelize('database', 'user', 'password', {
operatorsAliases: false,
dialect: 'sqlite',
logging: false,
storage: 'logoriDB.sqlite',
});
const server = database.define('server', {
discordId: {
type: sequelize.STRING,
unique: true,
},
logChannelId: sequelize.STRING,
}, {
timestamps: false,
});
module.exports.sync = function sync(opt) {
return database.sync(opt);
};
module.exports.server = server;