Code Reformatting

pull/11/head
Trivernis 6 years ago
parent 2400429b72
commit 98b809ba66

@ -35,7 +35,7 @@ function main() {
}
})
});
client.login(authToken).then(()=> {
client.login(authToken).then(() => {
logger.debug("Logged in");
});
@ -44,19 +44,20 @@ function main() {
function registerCommands() {
cmd.createGlobalCommand(prefix + 'ping', () => {
return 'Pong!';
return 'Pong!';
}, [], "Try it yourself.");
cmd.createGlobalCommand(prefix + 'repeatafterme', (msg, argv, args) => {
return args.join(' ');
},[], "Repeats what you say");
}, [], "Repeats what you say");
cmd.createGlobalCommand(prefix + 'addpresence', (msg, argv, args) => {
let p = args.join(' ');
presences.push(p);
fs.writeFile('./data/presences.txt', presences.join('\n'), (err) => {});
fs.writeFile('./data/presences.txt', presences.join('\n'), (err) => {
});
return `Added Presence \`${p}\``;
},[], "Adds a presence to the rotation.", 'owner');
}, [], "Adds a presence to the rotation.", 'owner');
cmd.createGlobalCommand(prefix + 'shutdown', (msg) => {
msg.reply('Shutting down...').finally(() => {
@ -66,7 +67,7 @@ function registerCommands() {
process.exit(0);
});
});
},[], "Shuts the bot down.", 'owner');
}, [], "Shuts the bot down.", 'owner');
cmd.createGlobalCommand(prefix + 'rotate', () => {
try {

@ -50,7 +50,7 @@ const winston = require('winston'),
* A function to return the logger that has been created after appending an exception handler
* @returns {Object}
*/
exports.getLogger = function() {
exports.getLogger = function () {
logger.exceptions.handle(
new winston.transports.File({
filename: './.log/exceptions.log'

@ -11,7 +11,7 @@ let connections = {};
/* Function Definition */
exports.DJ = class{
exports.DJ = class {
constructor(voiceChannel) {
this.conn = null;
this.disp = null;
@ -80,7 +80,7 @@ exports.DJ = class{
setTimeout(() => {
if (this.voiceChannel && this.voiceChannel.members.size === 1)
logger.verbose(`Exiting ${this.voiceChannel.name}`);
this.stop();
this.stop();
}, 300000);
} else if (this.connected)
setTimeout(() => this.checkListeners(), 10000);
@ -226,7 +226,7 @@ exports.DJ = class{
this.voiceChannel.leave();
logger.debug("Left VoiceChannel");
}
} catch(error) {
} catch (error) {
logger.verbose(JSON.stringify(error));
}
}
@ -236,7 +236,7 @@ exports.DJ = class{
* end event of the dispatcher that automatically plays the next song. If no dispatcher is found
* It tries to play the next song with playYouTube
*/
skip () {
skip() {
logger.debug("Skipping song");
if (this.disp !== null) {
this.disp.end();
@ -298,7 +298,7 @@ exports.setLogger = function (newLogger) {
* Connects to a voicechannel
* @param voiceChannel
*/
exports.connect = function(voiceChannel) {
exports.connect = function (voiceChannel) {
let gid = voiceChannel.guild.id;
let voiceDJ = new this.DJ(voiceChannel);
djs[gid] = voiceDJ;
@ -310,7 +310,7 @@ exports.connect = function(voiceChannel) {
* @param filename
* @param guildId
*/
exports.playFile = function(guildId, filename) {
exports.playFile = function (guildId, filename) {
djs[guildId].playFile(filename);
};
@ -319,7 +319,7 @@ exports.playFile = function(guildId, filename) {
* @param voiceChannel
* @param url
*/
exports.play = function(voiceChannel, url) {
exports.play = function (voiceChannel, url) {
let guildId = voiceChannel.guild.id;
if (!djs[guildId]) {
this.connect(voiceChannel).then(() => {
@ -335,7 +335,7 @@ exports.play = function(voiceChannel, url) {
* @param voiceChannel
* @param url
*/
exports.playnext = function(voiceChannel, url) {
exports.playnext = function (voiceChannel, url) {
let guildId = voiceChannel.guild.id;
if (!djs[guildId]) {
this.connect(voiceChannel).then(() => {
@ -351,14 +351,14 @@ exports.playnext = function(voiceChannel, url) {
* @param percentage
* @param guildId
*/
exports.setVolume = function(guildId, percentage) {
exports.setVolume = function (guildId, percentage) {
djs[guildId].setVolume(percentage);
};
/**
* pauses the music
*/
exports.pause = function(guildId) {
exports.pause = function (guildId) {
djs[guildId].pause();
};
@ -366,7 +366,7 @@ exports.pause = function(guildId) {
* Resumes the music
* @param guildId
*/
exports.resume = function(guildId) {
exports.resume = function (guildId) {
djs[guildId].resume();
};
@ -374,7 +374,7 @@ exports.resume = function(guildId) {
* Stops the music
* @param guildId
*/
exports.stop = function(guildId) {
exports.stop = function (guildId) {
djs[guildId].stop();
delete djs[guildId];
};
@ -383,7 +383,7 @@ exports.stop = function(guildId) {
* Skips the song
* @param guildId
*/
exports.skip = function(guildId) {
exports.skip = function (guildId) {
djs[guildId].skip();
};
@ -391,7 +391,7 @@ exports.skip = function(guildId) {
* Clears the playlist
* @param guildId
*/
exports.clearQueue = function(guildId) {
exports.clearQueue = function (guildId) {
djs[guildId].clear();
};
@ -399,7 +399,7 @@ exports.clearQueue = function(guildId) {
* Returns the queue
* @param guildId
*/
exports.getQueue = function(guildId) {
exports.getQueue = function (guildId) {
return djs[guildId].playlist;
};
@ -407,7 +407,7 @@ exports.getQueue = function(guildId) {
* evokes the callback function with the title of the current song
* @param guildId
*/
exports.nowPlaying = function(guildId) {
exports.nowPlaying = function (guildId) {
return djs[guildId].song;
};
@ -415,7 +415,7 @@ exports.nowPlaying = function(guildId) {
* shuffles the queue
* @param guildId
*/
exports.shuffle = function(guildId) {
exports.shuffle = function (guildId) {
djs[guildId].shuffle();
};

@ -3,7 +3,9 @@
*/
const fs = require('fs');
function noOp() {}
function noOp() {
}
let sysdataPath = './res/data/sys.json';
let sysData = {};
@ -35,7 +37,7 @@ exports.Cleanup = function Cleanup(callback) {
// attach user callback to the process event emitter
// if no callback, it will still exit gracefully on Ctrl-C
callback = callback || noOp;
process.on('cleanup',callback);
process.on('cleanup', callback);
// do app specific cleaning before exiting
process.on('exit', function () {
@ -49,7 +51,7 @@ exports.Cleanup = function Cleanup(callback) {
});
//catch uncaught exceptions, trace, then exit normally
process.on('uncaughtException', function(e) {
process.on('uncaughtException', function (e) {
console.log('Uncaught Exception...');
console.log(e.stack);
process.exit(99);
@ -58,7 +60,7 @@ exports.Cleanup = function Cleanup(callback) {
/* FS */
exports.dirExistence = function(path, callback) {
exports.dirExistence = function (path, callback) {
fs.exists(path, (exist) => {
if (!exist) {
fs.mkdir(path, (err) => {

Loading…
Cancel
Save