Code: const Discord = require(‘discord.js’);
const client = new Discord.Client({
partials: [‘MESSAGE’, ‘USER’, ‘REACTION’],
});
const enmap = require(‘enmap’);
const { token, prefix } = require(’./config.json’);
const settings = new enmap({
name: ‘settings’,
autoFetch: true,
cloneLevel: ‘deep’,
fetchAll: true,
});
client.on(‘ready’, () => {
console.log(‘Ticket System’);
client.user.setActivity(Community
, { type: ‘WATCHING’ });
});
client.on(‘message’, async (message) => {
if (message.author.bot) return;
if (message.content.indexOf(prefix) !== 0) return;
const args = message.content
.slice(prefix.length)
.trim()
.split(/ +/g);
const command = args.shift().toLowerCase();
if (command == ‘ticket-setup’) {
if (message.author == ‘409327435188928526’) {
let channel = message.mentions.channels.first();
if (!channel) return message.reply('Usage: !ticket-setup
');
let sent = await channel.send(
new Discord.MessageEmbed()
.setTitle(‘Ticket System’)
.setDescription(
‘If you want to buy something from us,\n react with to open a ticket’
)
.setFooter(
‘Community’,
‘’
)
.setColor(‘00f8ff’)
);
sent.react(‘’);
settings.set(${message.guild.id}-ticket
, sent.id);
message.channel.send(‘Ticket System Setup Done!’);
}
}
if (command == ‘close’) {
if (!message.channel.name.includes(‘ticket-’))
return message.channel.send(‘You cannot use that here!’);
message.channel.delete();
}
});
client.on(‘messageReactionAdd’, async (reaction, user) => {
if (user.partial) await user.fetch();
if (reaction.partial) await reaction.fetch();
if (reaction.message.partial) await reaction.message.fetch();
if (user.bot) return;
let ticketid = await settings.get(${reaction.message.guild.id}-ticket
);
if (!ticketid) return;
if (reaction.message.id == ticketid && reaction.emoji.name == ‘’) {
reaction.users.remove(user);
reaction.message.guild.channels
.create(ticket-${user.username}
, {
permissionOverwrites: [
{
id: user.id,
allow: [‘SEND_MESSAGES’, ‘VIEW_CHANNEL’],
},
{
id: reaction.message.guild.roles.everyone,
deny: [‘VIEW_CHANNEL’],
},
],
type: ‘text’,
})
.then(async (channel) => {
channel.send(
<@${user.id}> Welcome!
,
new Discord.MessageEmbed()
.setDescription(
‘Support will be with you shortly.\n \n !close to close the ticket.’
)
.setColor(‘00f8ff’)
.setFooter(
‘Community’,
‘’
)
.setTimestamp()
);
});
}
});
client.login(token);
Error: SyntaxError: Unexpected token ‘)’
at wrapSafe (internal/modules/cjs/loader.js:979:16)
at Module._compile (internal/modules/cjs/loader.js:1027:27)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47