diff --git a/src/commands/new.js b/src/commands/new.js index 2e76bc2..0a81bb4 100644 --- a/src/commands/new.js +++ b/src/commands/new.js @@ -67,7 +67,7 @@ module.exports = { let topic = args.join(' '); - if (topic.length > 256) + if (topic.length > 256) { return message.channel.send( new MessageEmbed() .setColor(config.err_colour) @@ -76,7 +76,12 @@ module.exports = { .setDescription('Please limit your ticket topic to less than 256 characters. A short sentence will do.') .setFooter(guild.name, guild.iconURL()) ); - else if (topic.length < 1) topic = config.default_topic; + } else if (/^[a-zA-Z0-9]+$/.test(config.default_topic)) { + topic = config.default_topic; + } + else if (topic.length < 1) { + topic = 'No topic given'; + } let ticket = await Ticket.create({ channel: '', diff --git a/src/events/messageReactionAdd.js b/src/events/messageReactionAdd.js index 250006f..e43cf79 100644 --- a/src/events/messageReactionAdd.js +++ b/src/events/messageReactionAdd.js @@ -89,7 +89,13 @@ module.exports = { } } - let topic = config.default_topic; + + if (/^[a-zA-Z0-9]+$/.test(config.default_topic)) { + topic = config.default_topic; + } else { + topic = 'No topic given (created via panel)'; + } + let ticket = await Ticket.create({ channel: '', diff --git a/user/config.js b/user/config.js index f5fff1e..f0cf424 100644 --- a/user/config.js +++ b/user/config.js @@ -47,7 +47,7 @@ module.exports = { colour: '#009999', err_colour: 'RED', cooldown: 3, - default_topic: 'Support Needed', + default_topic: '', guild: '', // ID of your guild (REQUIRED) staff_role: '', // ID of your Support Team role (REQUIRED)