trying to fix undefined again
This commit is contained in:
parent
ab29cd51d1
commit
0a95dea1b6
1 changed files with 8 additions and 40 deletions
|
@ -1,48 +1,16 @@
|
||||||
const tmi = require('tmi.js');
|
const tmi = require('tmi.js');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|
||||||
var settings, reacts, commands, mod_commands;
|
|
||||||
|
|
||||||
// read settings and reactions json files
|
// read settings and reactions json files
|
||||||
fs.readFileSync('./settings.json', 'utf8', (err, data) => {
|
try {
|
||||||
if (err) {
|
const settings = fs.readFileSync('./settings.json', 'utf8');
|
||||||
console.log(`Error reading settings file from disk: ${err}`);
|
const reacts = fs.readFileSync('./reacts.json', 'utf8');
|
||||||
process.exit(1);
|
const commands = fs.readFileSync('./commands.json', 'utf8');
|
||||||
} else {
|
const mod_commands = fs.readFileSync('./mod_commands.json', 'utf8');
|
||||||
// parse JSON string to JSON object
|
} catch (err) {
|
||||||
settings = JSON.parse(data);
|
console.error("An error occured trying to read the files for the Twitch bot: " + err);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
fs.readFileSync('./reacts.json', 'utf8', (err, data) => {
|
|
||||||
if (err) {
|
|
||||||
console.log(`Error reading reacts file from disk: ${err}`);
|
|
||||||
process.exit(1);
|
|
||||||
} else {
|
|
||||||
// parse JSON string to JSON object
|
|
||||||
reacts = JSON.parse(data);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
fs.readFileSync('./commands.json', 'utf8', (err, data) => {
|
|
||||||
if (err) {
|
|
||||||
console.log(`Error reading commands file from disk: ${err}`);
|
|
||||||
process.exit(1);
|
|
||||||
} else {
|
|
||||||
// parse JSON string to JSON object
|
|
||||||
commands = JSON.parse(data);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
fs.readFileSync('./mod_commands.json', 'utf8', (err, data) => {
|
|
||||||
if (err) {
|
|
||||||
console.log(`Error reading mod commands file from disk: ${err}`);
|
|
||||||
process.exit(1);
|
|
||||||
} else {
|
|
||||||
// parse JSON string to JSON object
|
|
||||||
mod_commands = JSON.parse(data);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const opts = {
|
const opts = {
|
||||||
identity: {
|
identity: {
|
||||||
|
|
Reference in a new issue