mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2025-09-02 08:41:25 +03:00
update
This commit is contained in:
@@ -14,6 +14,38 @@ module.exports = {
|
||||
const client = message.client;
|
||||
// command starts here
|
||||
message.delete();
|
||||
if(!message.channel.name.startsWith('ticket-')) { // // !message.channel.name.length() == 15 &&
|
||||
if(config.useEmbeds) {
|
||||
const notTicket = new Discord.RichEmbed()
|
||||
.setColor("#E74C3C")
|
||||
.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**`)
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
message.channel.delete()
|
||||
// log
|
||||
if(config.useEmbeds) {
|
||||
const embed = new Discord.RichEmbed()
|
||||
.setAuthor(`${client.user.username} / Ticket Log`, client.user.avatarURL)
|
||||
.setTitle("Ticket Closed")
|
||||
.setColor(config.colour)
|
||||
.addField("Username", message.author, true)
|
||||
.addField("Channel", message.channel.name, true)
|
||||
.setFooter(`DiscordTickets`)
|
||||
.setTimestamp();
|
||||
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) {
|
||||
console.error(leeks.colours.red(error));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@@ -31,12 +31,12 @@ module.exports = {
|
||||
data.push(`\nType\`${config.prefix}help [command]\` for more information about a specific command.`);
|
||||
|
||||
const embed = new Discord.RichEmbed()
|
||||
.setAuthor(`${client.user.username} / Commands`, client.user.avatarURL)
|
||||
.setTitle("Commands")
|
||||
.setColor(config.colour)
|
||||
.setDescription(`\nType\`${config.prefix}help [command]\` for more information about a specific command.`)
|
||||
// .addField("...", `...`, true)
|
||||
// .addField("...", `...`, true)
|
||||
.setFooter(`${client.guilds.get(config.guildID).name} : DiscordTickets by Eartharoid`);
|
||||
.setFooter(`DiscordTickets by Eartharoid`);
|
||||
|
||||
var cmds = [];
|
||||
cmds.push(commands.map(command => embed.addField(`${config.prefix}${command.name}`, `\`${command.description}\``)));
|
||||
@@ -63,10 +63,10 @@ module.exports = {
|
||||
}
|
||||
|
||||
const cmd = new Discord.RichEmbed()
|
||||
.setAuthor(`${client.user.username} / Commands`, client.user.avatarURL)
|
||||
.setTitle("Commands")
|
||||
.setColor(config.colour)
|
||||
.addField(`Command`,`\`${command.name}\``, true)
|
||||
.setFooter(`${client.guilds.get(config.guildID).name} : DiscordTickets by Eartharoid`);
|
||||
.setFooter(`DiscordTickets by Eartharoid`);
|
||||
|
||||
if (command.aliases) cmd.addField("Aliases", `\`${command.aliases.join(', ')}\``, true);
|
||||
if (command.description) cmd.addField("Description", `\`${command.description}\``, true);
|
||||
@@ -118,6 +118,7 @@ module.exports = {
|
||||
}
|
||||
|
||||
|
||||
|
||||
// command ends here
|
||||
},
|
||||
};
|
||||
|
107
commands/new.js
107
commands/new.js
@@ -15,7 +15,6 @@ module.exports = {
|
||||
const client = message.client;
|
||||
// command starts here
|
||||
message.delete();
|
||||
const ticketChannel = "channel";
|
||||
let topic = args.join(" ");
|
||||
|
||||
// let num = randomString({
|
||||
@@ -41,50 +40,78 @@ module.exports = {
|
||||
|
||||
message.guild.createChannel(`ticket-${id}`).then(async c => {
|
||||
c.setParent(config.ticketsCat);
|
||||
// let supportrole = message.guild.roles.find(`id`, config.supportRole)
|
||||
let supportrole = message.guild.roles.get(config.supportRole)
|
||||
if(!supportrole) return message.channel.send(":x: No **Support Team** role found.");
|
||||
// let supportRole = message.guild.roles.find(`id`, config.supportRole)
|
||||
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
|
||||
// })
|
||||
// c.overwritePermissions(message.member, {
|
||||
// VIEW_CHANNEL: true,
|
||||
// SEND_MESSAGES: true
|
||||
// })
|
||||
// c.overwritePermissions(supportrole, {
|
||||
// VIEW_CHANNEL: true,
|
||||
// SEND_MESSAGES: true
|
||||
// })
|
||||
// c.setTopic(`${message.author} | ${topic}`);
|
||||
//
|
||||
// const embed2 = new Discord.RichEmbed()
|
||||
// .setColor(colour)
|
||||
// .setDescription(`Your ticket (${c}) has been created.`)
|
||||
// .setTimestamp()
|
||||
// .setFooter(`${config.footer}`, config.logo);
|
||||
//
|
||||
// message.channel.send(embed2)
|
||||
// c.send(`<@&${config.supportRole}>\n`)
|
||||
// c.send(embed3)
|
||||
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`);
|
||||
} else {
|
||||
await c.send(`<@&${config.supportRole}>, a user has created a new ticket.\n`);
|
||||
};
|
||||
|
||||
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}**__`)
|
||||
}
|
||||
|
||||
const created = new Discord.RichEmbed()
|
||||
.setColor(config.colour)
|
||||
.setDescription(`Your ticket (${c}) has been created.\nPlease read the information sent and follow any instructions given.`)
|
||||
.setTimestamp();
|
||||
const welcome = new Discord.RichEmbed()
|
||||
.setColor(config.colour)
|
||||
.setDescription(`**Ticket topic:** \`${topic}\`\n\n${config.ticketText}`)
|
||||
|
||||
|
||||
if(config.useEmbeds) {
|
||||
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()
|
||||
// c.fetchMessage(c.lastMessageID).delete()
|
||||
|
||||
}
|
||||
// log
|
||||
if(config.useEmbeds) {
|
||||
const embed = new Discord.RichEmbed()
|
||||
.setAuthor(`${client.user.username} / Ticket Log`, client.user.avatarURL)
|
||||
.setTitle("New Ticket")
|
||||
.setColor(config.colour)
|
||||
.setDescription(`\`${topic}\``)
|
||||
.addField("Username", message.author, true)
|
||||
.addField("Channel", c, true)
|
||||
.setFooter(`DiscordTickets`)
|
||||
.setTimestamp();
|
||||
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
|
||||
// if(config.useEmbeds) {
|
||||
// const embed = new Discord.RichEmbed()
|
||||
// .setAuthor(`${client.user.username} / Ticket Log`, client.user.avatarURL)
|
||||
// .setTitle("New Ticket")
|
||||
// .addField("Username", message.author.tag, true)
|
||||
// .addField("Channel", ticketChannel, true)
|
||||
// .setFooter(`${client.guilds.get(config.guildID).name} : DiscordTickets by Eartharoid`);
|
||||
// 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})`)
|
||||
|
||||
|
||||
|
||||
// command ends here
|
||||
},
|
||||
|
@@ -15,11 +15,11 @@ module.exports = {
|
||||
// command starts here
|
||||
message.delete();
|
||||
const embed = new Discord.RichEmbed()
|
||||
.setAuthor(`${client.user.username} / Pong!`, client.user.avatarURL)
|
||||
.setTitle("Pong!")
|
||||
.setColor(config.colour)
|
||||
.setTimestamp()
|
||||
.addField("API Latency", `${Math.round(message.client.ping)}ms`, true)
|
||||
.setFooter(`${client.guilds.get(config.guildID).name} : DiscordTickets by Eartharoid`);
|
||||
.setFooter(`DiscordTickets by Eartharoid`);
|
||||
message.channel.send({embed})
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user