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