From 1f92a5bce3336e6de9ccf16248afa5c9dd738ab5 Mon Sep 17 00:00:00 2001 From: David Ralph Date: Wed, 14 Oct 2020 17:38:16 +0100 Subject: [PATCH] Error if Node is not v12 or higher, fix eslint error etc --- src/commands/rename.js | 5 ++--- src/index.js | 7 +++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/commands/rename.js b/src/commands/rename.js index 2a6d05d..a6160f6 100644 --- a/src/commands/rename.js +++ b/src/commands/rename.js @@ -43,14 +43,13 @@ module.exports = { .setColor(config.err_colour) .setAuthor(message.author.username, message.author.displayAvatarURL()) .setTitle(':x: **No permission**') - .setDescription(`You don't have permission to rename this channel as you are not staff.`) + .setDescription('You don\'t have permission to rename this channel as you are not staff.') .addField('Usage', `\`${config.prefix}${this.name} ${this.usage}\`\n`) .addField('Help', `Type \`${config.prefix}help ${this.name}\` for more information`) .setFooter(guild.name, guild.iconURL()) ); - let newname = args.join(' '); - message.channel.setName(newname); + message.channel.setName(args.join(' ')); // new channel name message.channel.send( new MessageEmbed() diff --git a/src/index.js b/src/index.js index 6c1e5fc..4cd9777 100644 --- a/src/index.js +++ b/src/index.js @@ -3,7 +3,7 @@ * @name DiscordTickets * @author eartharoid * @license GNU-GPLv3 - * + * * DiscordTickets Copyright (C) 2020 Isaac "eartharoid" Saunders * This program comes with ABSOLUTELY NO WARRANTY. * This is free software, and you are welcome to redistribute it @@ -11,12 +11,15 @@ * */ +const version = Number(process.version.split('.')[0].replace('v', '')); +if (!version === 12 || !version > 12) return console.log('Please upgrade to Node v12 or higher'); + const fs = require('fs'); const path = require('path'); let dev = fs.existsSync('user/dev.env') && fs.existsSync('user/dev.config.js'); -require('dotenv').config({path: path.join('user/', dev ? 'dev.env' : '.env')}); +require('dotenv').config({ path: path.join('user/', dev ? 'dev.env' : '.env') }); module.exports.config = dev ? 'dev.config.js' : 'config.js'; const config = require(path.join('../user/', module.exports.config));