Move config to a single variable and pass it.
This commit is contained in:
parent
88ac2d4ab0
commit
976ba50c38
18
start.js
18
start.js
|
@ -2,8 +2,8 @@
|
|||
|
||||
const fs = require('fs');
|
||||
const Discord = require('discord.js');
|
||||
const { statuses, build, release, prefix, token, footerTxt } = require('./config.json');
|
||||
|
||||
// const { statuses, build, release, prefix, token, footerTxt } = require('./config.json');
|
||||
const config = require('./config.json');
|
||||
console.log('Starting!')
|
||||
const client = new Discord.Client();
|
||||
client.commands = new Discord.Collection();
|
||||
|
@ -24,7 +24,7 @@ client.generateErrorMessage = (errorMsg, messageAuthorURL) => ({embed: {
|
|||
},
|
||||
"fields": [
|
||||
{
|
||||
"name": "Well that happened...",
|
||||
"name": "Something went wrong!",
|
||||
"value": errorMsg
|
||||
}
|
||||
]
|
||||
|
@ -39,14 +39,14 @@ client.once('ready', () => {
|
|||
console.log(' / /| | / __ \\/ / __/ ___/ __ \\| |/_/');
|
||||
console.log(' / ___ |/ / / / / /_/ / / /_/ /> < ');
|
||||
console.log('/_/ |_/_/ /_/_/\\__/_/ \\____/_/|_| ');
|
||||
console.log(`${release}, ${build}`);
|
||||
console.log("All Systems Go. | Anitrox by IDeletedSystem64 | ALL MY CODE KEEPS BLOWING UP!");
|
||||
console.log(`${config.release}, ${config.build}`);
|
||||
console.log("Bot online. | Anitrox by IDeletedSystem64 | ALL MY CODE KEEPS BLOWING UP!");
|
||||
});
|
||||
|
||||
|
||||
setInterval(async () => {
|
||||
// Picks a status from the config file
|
||||
const index = Math.floor(Math.random() * statuses.length);
|
||||
const index = Math.floor(Math.random() * config.statuses.length);
|
||||
await client.user.setActivity(statuses[index]);
|
||||
}, 20000);
|
||||
|
||||
|
@ -61,7 +61,7 @@ client.on('message', async (message) => {
|
|||
if (!client.commands.has(command)) return;
|
||||
|
||||
try {
|
||||
await client.commands.get(command).execute(client, message, args, footerTxt);
|
||||
await client.commands.get(command).execute(client, message, args, config);
|
||||
} catch (error) {
|
||||
console.stack;
|
||||
message.channel.send({embed: {
|
||||
|
@ -70,10 +70,10 @@ client.on('message', async (message) => {
|
|||
"color": 13632027,
|
||||
"footer": {
|
||||
"icon_url": message.author.displayAvatarURL(),
|
||||
"text": footerTxt
|
||||
"text": config.footerTxt
|
||||
},
|
||||
}});
|
||||
}
|
||||
});
|
||||
|
||||
client.login(token);
|
||||
client.login(config.token);
|
Reference in New Issue