Fixed faulty mysql login data for linux

changed USER to USERNAME in .env
This commit is contained in:
steev
2022-12-21 10:29:43 +01:00
parent c81c9b5e52
commit f002da6439
3 changed files with 11 additions and 9 deletions

View File

@ -1,16 +1,18 @@
const sql = require('mysql');
const Database = async (db) => {
const server = sql.createConnection({
host : db.HOST,
user : db.USER,
password : db.PASSWORD,
user : db.USERNAME,
password : db.PASSWORD
,
database : db.DATABASE
});
server.connect(function(err) {
if (err) {
console.error('error connecting: ' + err.stack);
console.error('error connecting Database in Data.Database: ' + err.stack);
process.exit(1)
}
});

View File

@ -5,7 +5,7 @@ const discord = require("discord.js")
@param {string} roleName name of role to assign a user
@param {discord.Client} bot the bots instance
*/
const AddRole = async (userVal, roleName, bot, reason) => {
const AddRole = async (userVal, roleName, bot) => {
// error handling
if (userVal == undefined) { throw "error user was undefined" }

View File

@ -13,12 +13,12 @@ const commands = [];
const { HandleReaction } = require("./Commons/Services/Reaction");
// const Database = require("./Commons/Data/Database");
// const server = Database(process.env)
const Database = require("./Commons/Data/Database");
const server = Database(process.env)
/* ===============
* File Import *
=============== */
* File Import *
=============== */
const commandFiles = fs.readdirSync("./Commands/").filter((file) => file.endsWith(".js"));
for (const file of commandFiles) {
const command = require(`./Commands/${file}`);
@ -55,7 +55,7 @@ bot.on(Events.MessageReactionAdd, async (reaction, user) => {
})
bot.on(Events.MessageReactionRemove, async (reaction, user) => {
HandleReaction(reaction, user, Database, "remove")
HandleReaction(reaction, user, server, "remove")
})
bot.login(process.env.TOKEN)