forked from ornfelt/azerothcore_lua_scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabasesql.js
More file actions
36 lines (29 loc) · 985 Bytes
/
databasesql.js
File metadata and controls
36 lines (29 loc) · 985 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
let active = new Map();
module.exports = (client) => {
const config = require("./config.js");
const Discord = require("discord.js");
const MySQLEvents = require('@rodrigogs/mysql-events');
var mysql = require('mysql2');
const connection = mysql.createConnection({
host : config.databaseHost,
user : config.databaseUser,
password : config.databasePassword,
database: "acore_auth"
});
module.exports = connection
connection.connect(function(err) {
if (err) {
console.error(`Error connecting: ${err.stack}`);
return;
}
console.log('Connected as id ' + connection.threadId);
});
const instance = new MySQLEvents(connection, {
startAtEnd: true,
excludedSchemas: {
mysql: true,
},
});
instance.on(MySQLEvents.EVENTS.CONNECTION_ERROR, console.error);
instance.on(MySQLEvents.EVENTS.ZONGJI_ERROR, console.error);
};