From 2964d1b9a6ee836299a8fedeea0d4525c1c5ea9f Mon Sep 17 00:00:00 2001 From: David Ralph Date: Mon, 3 Aug 2020 16:39:39 +0100 Subject: [PATCH 1/3] cleanup --- commands/add.js | 24 ++++++------- commands/close.js | 20 +++++------ commands/help.js | 59 ++++++++++++------------------- commands/new.js | 38 ++++++++------------ commands/ping.js | 11 ++---- commands/remove.js | 16 +++++---- index.js | 88 +++++++++++++++++++--------------------------- package.json | 5 ++- 8 files changed, 107 insertions(+), 154 deletions(-) diff --git a/commands/add.js b/commands/add.js index 48c73b0..56f54cd 100644 --- a/commands/add.js +++ b/commands/add.js @@ -1,6 +1,7 @@ const Discord = require('discord.js'); const config = require('../config.json'); const log = require(`leekslazylogger`); + module.exports = { name: 'add', description: 'Add a member to a ticket channel', @@ -14,23 +15,23 @@ module.exports = { const client = message.client; // command starts here message.delete(); - if(!message.channel.name.startsWith('ticket-')) { - if(config.useEmbeds) { + if (!message.channel.name.startsWith('ticket-')) { + if (config.useEmbeds) { const notTicket = new Discord.RichEmbed() .setColor("#E74C3C") - .setDescription(`:x: **This command can only be used within a ticket channel**`) + .setDescription(`:x: **This command can only be used within a ticket channel**`); return message.channel.send(notTicket); } else { - return message.channel.send(`:x: **This command can only be used within a ticket channel**`) + return message.channel.send(`:x: **This command can only be used within a ticket channel**`); } } let user = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0])); - if(!user) { - if(config.useEmbeds) { + if (!user) { + if (config.useEmbeds) { const err1 = new Discord.RichEmbed() .setColor("#E74C3C") - .setDescription(`:x: **Unknown user.** Please mention a valid user.`) + .setDescription(`:x: **Unknown user.** Please mention a valid user.`); return message.channel.send(err1); } else { return message.channel.send(`:x: **Unknown user.** Please mention a valid user.`); @@ -45,13 +46,13 @@ module.exports = { if(config.useEmbeds) { const added = new Discord.RichEmbed() .setColor(config.colour) - .setDescription(`${user} has been added.`) + .setDescription(`${user} has been added.`); message.channel.send(added); } else { message.channel.send(`${user} has been added.`); } // log - if(config.useEmbeds) { + if (config.useEmbeds) { const embed = new Discord.RichEmbed() .setAuthor(`${client.user.username} / Ticket Log`, client.user.avatarURL) .setTitle("User Added") @@ -61,15 +62,14 @@ module.exports = { .addField("Channel", message.channel, true) .setFooter(`DiscordTickets`) .setTimestamp(); - client.channels.get(config.logChannel).send({embed}) + client.channels.get(config.logChannel).send(embed); } else { client.channels.get(config.logChannel).send(`User added to a ticket by **${message.author.tag} (${message.author.id})**`); } log.info(`${message.author.tag} added a user to a ticket (#${message.channel})`) - } catch(error) { + } catch (error) { log.error(error); } - // command ends here }, }; diff --git a/commands/close.js b/commands/close.js index e6e0b2e..74d7093 100644 --- a/commands/close.js +++ b/commands/close.js @@ -1,6 +1,7 @@ const Discord = require('discord.js'); const config = require('../config.json'); const log = require(`leekslazylogger`); + module.exports = { name: 'close', description: 'Close a ticket', @@ -18,16 +19,16 @@ module.exports = { if(config.useEmbeds) { const notTicket = new Discord.RichEmbed() .setColor("#E74C3C") - .setDescription(`:x: **This command can only be used within a ticket channel**`) + .setDescription(`:x: **This command can only be used within a ticket channel**`); return message.channel.send(notTicket); } else { - return message.channel.send(`:x: **This command can only be used within a ticket channel**`) + return message.channel.send(`:x: **This command can only be used within a ticket channel**`); } } else { try { - message.channel.delete() + message.channel.delete(); // log - if(config.useEmbeds) { + if (config.useEmbeds) { const embed = new Discord.RichEmbed() .setAuthor(`${client.user.username} / Ticket Log`, client.user.avatarURL) .setTitle("Ticket Closed") @@ -36,20 +37,15 @@ module.exports = { .addField("Channel", message.channel.name, true) .setFooter(`DiscordTickets`) .setTimestamp(); - client.channels.get(config.logChannel).send({embed}) + client.channels.get(config.logChannel).send(embed); } else { client.channels.get(config.logChannel).send(`Ticket closed by **${message.author.tag} (${message.author.id})**`); } - log.info(`${message.author.tag} closed a ticket (#${message.channel.name})`) - - } catch(error) { + log.info(`${message.author.tag} closed a ticket (#${message.channel.name})`); + } catch (error) { log.error(log.colour.red(error)); } } - - - - // command ends here }, }; diff --git a/commands/help.js b/commands/help.js index 0c8c1d4..2873b95 100644 --- a/commands/help.js +++ b/commands/help.js @@ -7,22 +7,15 @@ module.exports = { description: 'Displays help menu', usage: '[command]', aliases: ['command', 'commands'], - example: 'help new', + example: 'help new', args: false, cooldown: config.cooldown, - guildOnly: true, + guildOnly: true, execute(message, args) { - const client = message.client; // command starts here message.delete(); - - const data = []; - const { commands } = message.client; - - - - - + const data = []; + const { commands } = message.client; if (config.useEmbeds) { if (!args.length) { @@ -31,16 +24,16 @@ module.exports = { data.push(`\nType \`${config.prefix}help [command]\` for more information about a specific command.`); const embed = new Discord.RichEmbed() - .setTitle("Commands") - .setColor(config.colour) - .setDescription(`\nType \`${config.prefix}help [command]\` for more information about a specific command.`) - // .addField("...", `...`, true) - // .addField("...", `...`, true) - .setFooter(`DiscordTickets by Eartharoid`); + .setTitle("Commands") + .setColor(config.colour) + .setDescription(`\nType \`${config.prefix}help [command]\` for more information about a specific command.`) + // .addField("...", `...`, true) + // .addField("...", `...`, true) + .setFooter(`DiscordTickets by Eartharoid`); - var cmds = []; - cmds.push(commands.map(command => embed.addField(`${config.prefix}${command.name}`, `\`${command.description}\``))); - message.channel.send(embed) + let cmds = []; + cmds.push(commands.map(command => embed.addField(`${config.prefix}${command.name}`, `\`${command.description}\``))); + message.channel.send(embed) .then(() => { if (message.channel.type === 'dm') return; // message.channel.send(`A list of commands has been sent to you.`); @@ -57,28 +50,25 @@ module.exports = { if (!command) { const notCmd = new Discord.RichEmbed() - .setColor("#E74C3C") - .setDescription(`:x: **Invalid command name** (\`${config.prefix}help\`)`) - return message.channel.send(notCmd) + .setColor("#E74C3C") + .setDescription(`:x: **Invalid command name** (\`${config.prefix}help\`)`); + return message.channel.send(notCmd); } const cmd = new Discord.RichEmbed() - .setColor(config.colour) - .addField(`Command`,`\`${command.name}\``, true) - .setFooter(`DiscordTickets by Eartharoid`); + .setColor(config.colour) + .addField(`Command`,`\`${command.name}\``, true) + .setFooter(`DiscordTickets by Eartharoid`); if (command.aliases) cmd.addField("Aliases", `\`${command.aliases.join(', ')}\``, true); if (command.description) cmd.addField("Description", `\`${command.description}\``, false); if (command.usage) cmd.addField("Usage", `\`${config.prefix}${command.name} ${command.usage}\``, false) if (command.example) cmd.addField("Example", `\`${config.prefix}${command.example}\``, false); - message.channel.send(cmd) - + message.channel.send(cmd); } - } else { // message.channel.send(`**Prefix =** \`${config.prefix}\`\n**Bot Version =** \`${version}\``) - if (!args.length) { data.push('__**Commands**__'); data.push(commands.map(command => `**${config.prefix}${command.name}** : \`${command.description}\``).join('\n')); @@ -100,9 +90,7 @@ module.exports = { const name = args[0].toLowerCase(); const command = commands.get(name) || commands.find(c => c.aliases && c.aliases.includes(name)); - if (!command) { - return message.reply(':x: **Invalid command**'); - } + if (!command) return message.reply(':x: **Invalid command**'); data.push(`**Command:** \`${command.name}\``); @@ -113,11 +101,8 @@ module.exports = { data.push(`**Cooldown:** \`${command.cooldown || 3} second(s)\``); - message.channel.send(data, { split: true }); + message.channel.send(data, { split: true }); } - - - // command ends here }, }; diff --git a/commands/new.js b/commands/new.js index 593ca24..78c8ade 100644 --- a/commands/new.js +++ b/commands/new.js @@ -2,6 +2,7 @@ const Discord = require('discord.js'); const config = require('../config.json'); const log = require(`leekslazylogger`); // const randomString = require('random-string'); + module.exports = { name: 'new', description: 'Create a new ticket', @@ -30,12 +31,11 @@ module.exports = { if (config.useEmbeds) { const err1 = new Discord.RichEmbed() .setColor("#E74C3C") - .setDescription(`:x: You already have an open ticket.`) - return message.channel.send(err1) + .setDescription(`:x: You already have an open ticket.`); + return message.channel.send(err1); } else { - message.channel.send(`:x: You already have an open ticket.`) + message.channel.send(`:x: You already have an open ticket.`); } - }; message.guild.createChannel(`ticket-${id}`, { @@ -46,7 +46,6 @@ module.exports = { let supportRole = message.guild.roles.get(config.supportRole) if (!supportRole) return message.channel.send(":x: No **Support Team** role found."); - c.overwritePermissions(message.guild.defaultRole, { VIEW_CHANNEL: false, SEND_MESSAGES: false @@ -80,20 +79,18 @@ module.exports = { .setTimestamp(); const welcome = new Discord.RichEmbed() .setColor(config.colour) - .setDescription(`**Ticket topic:** \`${topic}\`\n\n${config.ticketText}`) - + .setDescription(`**Ticket topic:** \`${topic}\`\n\n${config.ticketText}`); if (config.useEmbeds) { - message.channel.send(created) - let w = await c.send(welcome) + message.channel.send(created); + let w = await c.send(welcome); await w.pin(); // c.fetchMessage(c.lastMessageID).delete() } else { - message.channel.send(`Your ticket (${c}) has been created.\nPlease read the information sent and follow any instructions given.`) - let w = await c.send(`**Ticket topic:** \`${topic}\`\n\n${config.ticketText}`) - await w.pin() + message.channel.send(`Your ticket (${c}) has been created.\nPlease read the information sent and follow any instructions given.`); + let w = await c.send(`**Ticket topic:** \`${topic}\`\n\n${config.ticketText}`); + await w.pin(); // c.fetchMessage(c.lastMessageID).delete() - } // log if (config.useEmbeds) { @@ -106,19 +103,12 @@ module.exports = { .addField("Channel", c, true) .setFooter(`DiscordTickets`) .setTimestamp(); - client.channels.get(config.logChannel).send({ - embed - }) + client.channels.get(config.logChannel).send(embed); } else { client.channels.get(config.logChannel).send(`New ticket created by **${message.author.tag} (${message.author.id})**`); } - log.info(`${message.author.tag} created a new ticket (#ticket-${id})`) - }) - - - - - + log.info(`${message.author.tag} created a new ticket (#ticket-${id})`); + }); // command ends here }, -}; +}; \ No newline at end of file diff --git a/commands/ping.js b/commands/ping.js index 33b27f0..c01b557 100644 --- a/commands/ping.js +++ b/commands/ping.js @@ -1,6 +1,6 @@ const Discord = require('discord.js'); const config = require('../config.json'); -const log = require(`leekslazylogger`); + module.exports = { name: 'ping', description: 'Calculate latency', @@ -11,7 +11,6 @@ module.exports = { cooldown: config.cooldown, guildOnly: true, execute(message, args) { - const client = message.client; // command starts here message.delete(); const embed = new Discord.RichEmbed() @@ -19,11 +18,7 @@ module.exports = { .setColor(config.colour) .setTimestamp() .addField("API Latency", `${Math.round(message.client.ping)}ms`, true) - message.channel.send({embed}) - - - - + message.channel.send(embed); // command ends here }, -}; +}; \ No newline at end of file diff --git a/commands/remove.js b/commands/remove.js index 2cede68..98c72bf 100644 --- a/commands/remove.js +++ b/commands/remove.js @@ -1,6 +1,7 @@ const Discord = require('discord.js'); const config = require('../config.json'); const log = require(`leekslazylogger`); + module.exports = { name: 'remove', description: 'Remove a member from a ticket', @@ -14,8 +15,8 @@ module.exports = { const client = message.client; // command starts here message.delete(); - if(!message.channel.name.startsWith('ticket-')) { - if(config.useEmbeds) { + if (!message.channel.name.startsWith('ticket-')) { + if (config.useEmbeds) { const notTicket = new Discord.RichEmbed() .setColor("#E74C3C") .setDescription(`:x: **This command can only be used within a ticket channel**`) @@ -26,8 +27,8 @@ module.exports = { } let user = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0])); - if(!user) { - if(config.useEmbeds) { + if (!user) { + if (config.useEmbeds) { const err1 = new Discord.RichEmbed() .setColor("#E74C3C") .setDescription(`:x: **Unknown user.** Please mention a valid user.`) @@ -41,7 +42,7 @@ module.exports = { SEND_MESSAGES: false, READ_MESSAGES: false }); - if(config.useEmbeds) { + if (config.useEmbeds) { const removed = new Discord.RichEmbed() .setColor(config.colour) .setDescription(`${user} has been removed.`) @@ -50,7 +51,7 @@ module.exports = { message.channel.send(`${user} has been removed.`); } // log - if(config.useEmbeds) { + if (config.useEmbeds) { const embed = new Discord.RichEmbed() .setAuthor(`${client.user.username} / Ticket Log`, client.user.avatarURL) .setTitle("User Removed") @@ -60,7 +61,8 @@ module.exports = { .addField("Channel", message.channel, true) .setFooter(`DiscordTickets`) .setTimestamp(); - client.channels.get(config.logChannel).send({embed}) + + client.channels.get(config.logChannel).send(embed); } else { client.channels.get(config.logChannel).send(`User removed to a ticket by **${message.author.tag} (${message.author.id})**`); } diff --git a/index.js b/index.js index c940578..40ebedb 100644 --- a/index.js +++ b/index.js @@ -21,9 +21,9 @@ Quick Start --------------------- - > For detailed instructions, visit the github repository and read the documentation. + > For detailed instructions, visit the Github repository and read the documentation. - > Assuming you have created discord application, edit 'config.json' to allow the bot to + > Assuming you have created a Discord application, edit 'config.json' to allow the bot to function correctly. > You will need your bot token (keep it a secret) and channel & role IDs from your server @@ -34,10 +34,10 @@ =============================================================================================== > For support, visit https://github.com/eartharoid/DiscordTickets/#readme - > My website: https://eartharoid.ml + > My website: https://eartharoid.me @name DiscordTickets - @author Eartharoid + @author Eartharoid @license GNU-GPLv3 ############################################################################################### @@ -78,18 +78,19 @@ console.log(log.colour.yellow(leeks.styles.bold(homepage))); console.log('\n\n'); console.log(log.colour.bgGrey(log.colour.grey(`\n\n==========================================================================\n\n`))) console.log('\n\n'); -log.init('DiscordTickets (bot created by Eartharoid)') +log.init('DiscordTickets (bot created by Eartharoid)'); // all log.* functions are logged to ./log/file.log from here onwards -log.info(`Starting up...`) +log.info(`Starting up...`); client.once('ready', () => { // after bot has logged in - log.info(`Initialising bot...`) + log.info(`Initialising bot...`); for (const file of commands) { const command = require(`./commands/${file}`); client.commands.set(command.name, command); log.console(`> Loading '${config.prefix}${command.name}' command`); } + log.success(`Connected to Discord API`) log.success(`Logged in as ${client.user.tag}`) client.user.setPresence({game: {name: config.playing, type: config.activityType},status: config.status}) @@ -104,13 +105,12 @@ client.once('ready', () => { // after bot has logged in .setFooter(`DiscordTickets by Eartharoid`); client.channels.get(config.logChannel).send(embed) } else { - client.channels.get(config.logChannel).send(":white_check_mark: **Started succesfully**") + client.channels.get(config.logChannel).send(":white_check_mark: **Started succesfully**"); } + if (client.guilds.get(config.guildID).member(client.user).hasPermission("ADMINISTRATOR", false)) { log.info(`Checking permissions...`); - setTimeout(function() { - log.success(`Required permissions have been granted\n\n`) - }, 1250); + setTimeout(() => log.success(`Required permissions have been granted\n\n`), 1250); if (config.useEmbeds) { const embed = new Discord.RichEmbed() @@ -118,30 +118,30 @@ client.once('ready', () => { // after bot has logged in .setColor("#2ECC71") .setDescription(":white_check_mark: **Required permissions have been granted**") .setFooter(`DiscordTickets by Eartharoid`); - client.channels.get(config.logChannel).send(embed) + + client.channels.get(config.logChannel).send(embed); } else { client.channels.get(config.logChannel).send(":white_check_mark: **Started succesfully**") } + } else { - log.error(`Required permissions have not been granted`) - log.error(`Please give the bot the 'ADMINISTRATOR' permission\n\n`) + log.error(`Required permissions have not been granted`); + log.error(`Please give the bot the 'ADMINISTRATOR' permission\n\n`); if (config.useEmbeds) { const embed = new Discord.RichEmbed() .setAuthor(`${client.user.username} / Ticket Log`, client.user.avatarURL) .setColor("#E74C3C") .setDescription(":x: **Required permissions have not been granted**\nPlease give the bot the `ADMINISTRATOR` permission") .setFooter(`DiscordTickets by Eartharoid`); - client.channels.get(config.logChannel).send({ - embed - }) + + client.channels.get(config.logChannel).send(embed); } else { - client.channels.get(config.logChannel).send(":white_check_mark: **Started succesfully**") + client.channels.get(config.logChannel).send(":white_check_mark: **Started succesfully**"); } } - }); -client.on('message', async message => { +client.on('message', async (message) => { // if (!message.content.startsWith(config.prefix) || message.author.bot) return; if (message.author.bot) return; if (message.channel.type === "dm") { @@ -159,16 +159,10 @@ client.on('message', async message => { } else { client.channels.get(config.logChannel).send(`DM received from **${message.author.tag} (${message.author.id})** : \n\n\`\`\`${message.content}\`\`\``); } - } else { - return - }; - + } else return; } - if (message.channel.bot) return; - // const args = message.content.slice(config.prefix.length).split(/ +/); - const prefixRegex = new RegExp(`^(<@!?${client.user.id}>|\\${config.prefix})\\s*`); if (!prefixRegex.test(message.content)) return; const [, matchedPrefix] = message.content.match(prefixRegex); @@ -176,14 +170,9 @@ client.on('message', async message => { const commandName = args.shift().toLowerCase(); // if (!client.commands.has(commandName)) return; // const command = client.commands.get(commandName); - const command = client.commands.get(commandName) - || client.commands.find(cmd => cmd.aliases && cmd.aliases.includes(commandName)); - + const command = client.commands.get(commandName) || client.commands.find(cmd => cmd.aliases && cmd.aliases.includes(commandName)); if (!command) return; - - if (command.guildOnly && message.channel.type !== 'text') { - return message.channel.send(`Sorry, this command can only be used on the server.`) - } + if (command.guildOnly && message.channel.type !== 'text') return message.channel.send(`Sorry, this command can only be used on the server.`); if (command.args && !args.length) { // let reply = `:x: **Arguments were expected but none were provided.**`; @@ -196,18 +185,14 @@ client.on('message', async message => { if (config.useEmbeds) { const embed = new Discord.RichEmbed() .setColor("#E74C3C") - .setDescription(`\n**Usage:** \`${config.prefix}${command.name} ${command.usage}\`\nType \`${config.prefix}help ${command.name}\` for more information`) - return message.channel.send({embed}) - + .setDescription(`\n**Usage:** \`${config.prefix}${command.name} ${command.usage}\`\nType \`${config.prefix}help ${command.name}\` for more information`); + return message.channel.send(embed); } else { - return message.channel.send(`**Usage:** \`${config.prefix}${command.name} ${command.usage}\`\nType \`${config.prefix}help ${command.name}\` for more information`) + return message.channel.send(`**Usage:** \`${config.prefix}${command.name} ${command.usage}\`\nType \`${config.prefix}help ${command.name}\` for more information`); } }; - - if (!cooldowns.has(command.name)) { - cooldowns.set(command.name, new Discord.Collection()); - } + if (!cooldowns.has(command.name)) cooldowns.set(command.name, new Discord.Collection()); const timestamps = cooldowns.get(command.name); const cooldownAmount = (command.cooldown || 3) * 1000; @@ -221,11 +206,10 @@ client.on('message', async message => { const embed = new Discord.RichEmbed() .setColor("#E74C3C") .setDescription(`:x: **Please do not spam commands** (wait ${timeLeft.toFixed(1)}s)`) - return message.channel.send({embed}) + return message.channel.send(embed); } else { return message.reply(`please do not spam commands (wait ${timeLeft.toFixed(1)}s)`); } - } } timestamps.set(message.author.id, now); @@ -235,7 +219,7 @@ client.on('message', async message => { try { // client.commands.get(command).execute(message, args, config); command.execute(message, args); - if(config.useEmbeds) { + if (config.useEmbeds) { const embed = new Discord.RichEmbed() .setAuthor(`${client.user.username} / Command Log`, client.user.avatarURL) .setTitle("Command Used") @@ -243,7 +227,7 @@ client.on('message', async message => { .addField("Command", command.name, true) .setFooter(`DiscordTickets`) .setTimestamp(); - client.channels.get(config.logChannel).send({embed}) + client.channels.get(config.logChannel).send(embed); } else { client.channels.get(config.logChannel).send(`**${message.author.tag} (${message.author.id})** used the \`${command.name}\` command`); } @@ -253,23 +237,25 @@ client.on('message', async message => { message.channel.send(`:x: **Oof!** An error occured whilst executing that command.\nThe issue has been reported.`); log.error(`An unknown error occured whilst executing the '${command.name}' command`); } - }); -client.on('error', error => { + +client.on('error', (error) => { log.warn(`Potential error detected\n(likely Discord API connection issue)\n`); log.error(`Client error:\n${error}`); }); + client.on('warn', (e) => log.warn(`${e}`)); -if(config.debugLevel == 1){ client.on('debug', (e) => log.debug(`${e}`)) }; +if (config.debugLevel == 1) client.on('debug', (e) => log.debug(`${e}`)); -process.on('unhandledRejection', error => { +process.on('unhandledRejection', (error) => { log.warn(`An error was not caught`); log.error(`Uncaught error: \n${error.stack}`); }); + process.on('beforeExit', (code) => { log.basic(log.colour.yellowBright(`Disconected from Discord API`)); log.basic(`Exiting (${code})`); }); -client.login(config.token); +client.login(config.token); \ No newline at end of file diff --git a/package.json b/package.json index 5d836bc..a427d65 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,12 @@ { - "name": "DiscordTickets", + "name": "discordtickets", "version": "1.1.5", "description": "A Discord ticket/support - an open-source & self-hosted bot", "main": "index.js", "dependencies": { "discord.js": "11.x", - "leekslazylogger": "^1.1.7" + "leekslazylogger": "^1.1.9" }, - "devDependencies": {}, "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, From 8a2c9fa90cca0dfe1ddc86beb70496daee034de6 Mon Sep 17 00:00:00 2001 From: David Ralph Date: Mon, 3 Aug 2020 16:46:18 +0100 Subject: [PATCH 2/3] part 2 --- commands/help.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/commands/help.js b/commands/help.js index 2873b95..82a8ede 100644 --- a/commands/help.js +++ b/commands/help.js @@ -1,7 +1,7 @@ const Discord = require('discord.js'); -const { version } = require('../package.json'); const config = require('../config.json'); const log = require(`leekslazylogger`); + module.exports = { name: 'help', description: 'Displays help menu', @@ -38,11 +38,11 @@ module.exports = { if (message.channel.type === 'dm') return; // message.channel.send(`A list of commands has been sent to you.`); }) - .catch(error => { + .catch(() => { // console.error(`Could not send help DM to ${message.author.tag}.\n`, error); log.warn(`Could not DM help menu to ${message.author.tag}, sending to server channel instead`); - message.channel.send(`:x: **Sorry!** There was an error whilst sending the help menu via DMs.`) - message.channel.send(data, { split: true }) + message.channel.send(`:x: **Sorry!** There was an error whilst sending the help menu via DMs.`); + message.channel.send(data, { split: true }); }); } else { const name = args[0].toLowerCase(); @@ -105,4 +105,4 @@ module.exports = { } // command ends here }, -}; +}; \ No newline at end of file From 7fb279250bcde71ade54008b06dc32fe03978258 Mon Sep 17 00:00:00 2001 From: David Ralph Date: Mon, 3 Aug 2020 16:47:44 +0100 Subject: [PATCH 3/3] oops --- commands/new.js | 10 +++++----- commands/ping.js | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/commands/new.js b/commands/new.js index 78c8ade..83534d4 100644 --- a/commands/new.js +++ b/commands/new.js @@ -49,15 +49,15 @@ module.exports = { c.overwritePermissions(message.guild.defaultRole, { VIEW_CHANNEL: false, SEND_MESSAGES: false - }) + }); c.overwritePermissions(message.member, { VIEW_CHANNEL: true, SEND_MESSAGES: true - }) + }); c.overwritePermissions(supportRole, { VIEW_CHANNEL: true, SEND_MESSAGES: true - }) + }); c.setTopic(`${message.author} | ${topic}`); if (config.tagHereOnly) { await c.send(`@here, a user has created a new ticket.\n`); @@ -68,9 +68,9 @@ module.exports = { if (config.ticketImage) { await c.send(`__**Here's your ticket channel, ${message.author}**__`, { files: [`./image.png`] - }) + }); } else { - await c.send(`__**Here's your ticket channel, ${message.author}**__`) + await c.send(`__**Here's your ticket channel, ${message.author}**__`); } const created = new Discord.RichEmbed() diff --git a/commands/ping.js b/commands/ping.js index c01b557..2a83d2a 100644 --- a/commands/ping.js +++ b/commands/ping.js @@ -17,7 +17,7 @@ module.exports = { .setTitle("Pong!") .setColor(config.colour) .setTimestamp() - .addField("API Latency", `${Math.round(message.client.ping)}ms`, true) + .addField("API Latency", `${Math.round(message.client.ping)}ms`, true); message.channel.send(embed); // command ends here },