Adding comments, removing old crud

This commit is contained in:
= 2021-07-13 22:38:25 -04:00
parent b4f93cd43a
commit bfb06113b3
1 changed files with 12 additions and 16 deletions

View File

@ -1,45 +1,41 @@
/* eslint-disable brace-style */
// Variable Assignment // Variable Assignment
// Environment Variable Setup
const dotenv = require('dotenv'); const dotenv = require('dotenv');
dotenv.config(); dotenv.config();
// Discord.js library
const Discord = require('discord.js'); const Discord = require('discord.js');
// Create the client
const client = new Discord.Client(); const client = new Discord.Client();
// External Functions File
// const config = require('./config.json');
// const { prefix, logChannel, bootMessage, shutdownMessage } = require('./config.json');
// const owner = process.env.ownerID;
const giphy = require('giphy-api')(process.env.giphyAPIKey);
const functions = require('./functions.js'); const functions = require('./functions.js');
// Once the client is logged in and ready
client.once('ready', () => { client.once('ready', () => {
console.log('Ready'); console.log('Ready');
// This sets the activity that shows below the bot's name in the member/friend list
client.user.setActivity('Nod Simulator 2021', { type: 'PLAYING' }).then().catch(console.error); client.user.setActivity('Nod Simulator 2021', { type: 'PLAYING' }).then().catch(console.error);
// Import the Command, GIF, and Pasta files into collections
functions.getCommandFiles(client); functions.getCommandFiles(client);
functions.getGifFiles(client); functions.getGifFiles(client);
functions.getPastaFiles(client); functions.getPastaFiles(client);
// client.channels.fetch(logChannel) // Get the owner and DM them a message that the bot is ready, useful for remote deployment
// .then(channel => {
// channel.send(bootMessage)
// .then()
// .catch(err => console.error(err));
// })
// .catch(err => console.error(err));
client.users.fetch(process.env.ownerID).then(user => { client.users.fetch(process.env.ownerID).then(user => {
user.createDM().then(channel => { user.createDM().then(channel => {
channel.send('I\'m awake.'); channel.send('Ready');
}); });
}); });
}); });
// Log into discord using the TOKEN provided by environment variables (.env)
client.login(process.env.TOKEN) client.login(process.env.TOKEN)
.then() .then()
.catch(err => { .catch(err => {
console.error(err); console.error(err);
// Dump the TOKEN into the console as the TOKEN is likely the cause of any error logging in, unless Discord servers are down.
console.log('Token: ' + process.env.TOKEN) console.log('Token: ' + process.env.TOKEN)
}); });
// This runs on each message the bot sees
client.on('message', message => { client.on('message', message => {
// Get the filename and extension as an array // Get the filename and extension as an array
const file = functions.getFileInfo(message.content); const file = functions.getFileInfo(message.content);