diff --git a/commands/help.js b/commands/help.js index f811915..c3da72f 100644 --- a/commands/help.js +++ b/commands/help.js @@ -11,16 +11,16 @@ module.exports = () => { const prefix = config.prefix const header = config.system.ticket_channel ? "**Go to <#"+config.system.ticket_channel+"> to create a ticket!**\n\n" : "**Run the command `/new` or `/ticket` to create a ticket!**\n\n" - helpEmbed.setDescription(header+"`"+prefix+"msg ` ➜ _Spawn an embed with buttons. (admin only)_\n\n`"+prefix+"rename ` ➜ _Rename a ticket. (no spaces)_\n`"+prefix+"close` ➜ _Close a ticket._\n`"+prefix+"delete` ➜ _Delete a ticket._\n\n`"+prefix+"add ` ➜ _Add a user to the ticket._\n`"+prefix+"remove ` ➜ _Remove a user from the ticket._`") + helpEmbed.setDescription(header+"`"+prefix+"msg ` ➜ _Spawn an embed with buttons. (admin only)_\n\n`"+prefix+"rename ` ➜ _Rename a ticket. (no spaces)_\n`"+prefix+"close` ➜ _Close a ticket._\n`"+prefix+"delete` ➜ _Delete a ticket._\n`"+prefix+"reopen` ➜ _Re-Open a ticket after it was closed._\n\n`"+prefix+"add ` ➜ _Add a user to the ticket._\n`"+prefix+"remove ` ➜ _Remove a user from the ticket._`") - if (config.credits) helpEmbed.setFooter({text:"Open-Ticket by DJdj Development | view on github for source code"}) + if (config.credits) helpEmbed.setFooter({text:"Open-Ticket by DJdj Development | view on github for source code",iconURL:"https://raw.githubusercontent.com/DJj123dj/open-ticket/main/logo.png"}) client.on("messageCreate",msg => { if (!msg.content.startsWith(config.prefix)) return var args = msg.content.split(config.prefix) - if (!args[1].startsWith("close") && !args[1].startsWith("delete") && !args[1].startsWith("remove") && !args[1].startsWith("add") && !args[1].startsWith("msg") && !args[1].startsWith("remove") && !args[1].startsWith("rename")){ + if (!args[1].startsWith("close") && !args[1].startsWith("delete") && !args[1].startsWith("remove") && !args[1].startsWith("add") && !args[1].startsWith("msg") && !args[1].startsWith("remove") && !args[1].startsWith("rename") && !args[1].startsWith("reopen")){ msg.channel.send({embeds:[helpEmbed]}) log("command","someone used the 'help' command",[{key:"user",value:msg.author.tag}]) diff --git a/commands/reopen.js b/commands/reopen.js index 05b5fcf..07a8c12 100644 --- a/commands/reopen.js +++ b/commands/reopen.js @@ -32,27 +32,17 @@ module.exports = () => { client.on("interactionCreate",(interaction) => { if (!interaction.isCommand()) return - if (interaction.commandName != "add") return - const user = interaction.options.getUser("user") - - const permsmember = client.guilds.cache.find(g => g.id == interaction.guild.id).members.cache.find(m => m.id == interaction.member.id) - if (config.main_adminroles.some((item)=>{return interaction.guild.members.cache.find((m) => m.id == interaction.member.id).roles.cache.has(item)}) == false && permsmember.permissions.has("ADMINISTRATOR")){ - interaction.reply({embeds:[bot.errorLog.noPermsMessage]}) - return - } - + if (interaction.commandName != "reopen") return interaction.channel.messages.fetchPinned().then(msglist => { var firstmsg = msglist.last() - if (firstmsg == undefined || firstmsg.author.id != client.user.id) return interaction.reply({embeds:[bot.errorLog.notInATicket]}) + if (firstmsg == undefined || firstmsg.author.id != client.user.id) return msg.channel.send({embeds:[bot.errorLog.notInATicket]}) - interaction.channel.permissionOverwrites.create(user.id, { VIEW_CHANNEL:true, ADD_REACTIONS:true,ATTACH_FILES:true, EMBED_LINKS:true, SEND_MESSAGES:true}) - interaction.reply({embeds:[bot.errorLog.success("User Added!",user.tag+" is added to this ticket")]}) + interaction.reply({embeds:[bot.errorLog.success("Re-Open this ticket!","You can re-open this ticket by clicking on the button below!")],components:[reopenCommandBar]}) - var loguser = user - log("command","someone used the 'add' command",[{key:"user",value:interaction.user.tag}]) - log("system","user added to ticket",[{key:"user",value:interaction.user.tag},{key:"ticket",value:interaction.channel.name},{key:"added_user",value:loguser.tag}]) + + log("command","someone used the 'reopen' command",[{key:"user",value:interaction.user.tag}]) }) diff --git a/core/ticketOpener.js b/core/ticketOpener.js index 602ac8c..3b8bbd5 100644 --- a/core/ticketOpener.js +++ b/core/ticketOpener.js @@ -143,7 +143,7 @@ module.exports = () => { interaction.guild.channels.create(ticketName,{ type:"GUILD_TEXT", parent:newTicketCategory, - reason:"A new ticket was created", + reason:"A new ticket is created", permissionOverwrites:permissionsArray }).then((ticketChannel) => { diff --git a/language/english.json b/language/english.json new file mode 100644 index 0000000..8721945 --- /dev/null +++ b/language/english.json @@ -0,0 +1,71 @@ +{ + "errors":{ + "missingArgsTitle":"Invalid Arguments!", + "missingArgsDescription":"Missing Argument", + "noPermsTitle":"No Permissions!", + "noPermsDescription":"You don't have the correct roles to run this command!\nYou need the `ADMINISTRATOR` permission or be in the list of allowed roles!", + "chooseFromList":"Choose one of the id's below:", + "notInTicketTitle":"You are not in a ticket!", + "notInTicketDescription":"This command doesn't work outside tickets!", + "ticketDoesntExist":"This ticket doesn't exist anymore!", + "roleDoesntExist":"This role doesn't exist anymore!", + "anotherOption":"This option is not a ticket but another type!", + "maxAmountTitle":"Max amount reached!", + "maxAmountDescription":"You reached the maximum number of tickets allowed!\nSo you can't create a new one!", + "somethingWentWrong":"Something went wrong!**\nPlease try again another time!", + "somethingWentWrongTranscript":"Something went wrong while making the transcript!**\nPlease try again another time!" + }, + "commands":{ + "userAddedTitle":"User Added!", + "userAddedDescription":"{0} is added to this ticket!", + "userRemovedTitle":"User Removed!", + "userRemovedDescription":"{0} is removed from this ticket!", + + "renameTitle":"The name is changed!", + "renameWarning":"Warning: you can only change the channel name 2 times per minute!\n(this is due discord rate limits)", + + "closeTitle":"Close this ticket!", + "closeDescription":"You can close this ticket by clicking on the button below!", + "deleteTitle":"Delete this ticket!", + "deleteDescription":"You can delete this ticket by clicking on the button below!", + "reopenTitle":"Re-Open this ticket!", + "reopenDescription":"You can re-open this ticket by clicking on the button below!", + + "ticketWarning":"The embed is in the message below!", + "maxTicketWarning":"**Warning:** _You can only create {0} ticket(s) at a time!_" + }, + "helpMenu":{ + "title":"Help Menu:", + "header1":"**Go to {0} to create a ticket!**\n\n", + "header2":"**Run the command `/new` or `/ticket` to create a ticket!**\n\n", + + "msgCmd":"Spawn an embed with buttons. (admin only)", + "renameCmd":"Rename a ticket. (no spaces)", + "closeCmd":"Close a ticket.", + "deleteCmd":"Delete a ticket.", + "addCmd":"Add a user to the ticket.", + "removeCmd":"Remove a user from the ticket.", + "reopenCmd":"Re-Open a ticket after it was closed." + }, + "buttons":{ + "close":"Close Ticket", + "delete":"Delete Ticket", + "reopen":"Re-Open Ticket", + "sendTranscript":"Send Transcript File" + }, + "messages":{ + "reopenTitle":"Re-Opened this ticket!", + "reopenDescription":"Feel free to talk again!", + "closedTitle":"Closed this ticket!", + "closedDescription":"Only admins can talk in this ticket now!\n\n*Click on the button below to delete this ticket or to re-open it!*", + "createdTitle":"Ticket Created!", + "createdDescription":"Your ticket is created, you can detect it by a ping!", + + "newTicketDmTitle":"New Ticket!", + "newTranscriptTitle":"A new transcript is here!", + "newTranscriptDescription":"You can find the transcript in the text file above!", + "hereIsTheTranscript":"Here is the transcript:", + + "chooseCategory":"choose a category:" + } +} \ No newline at end of file diff --git a/storage/.DS_Store b/storage/.DS_Store index 2e0a334..8fa4022 100644 Binary files a/storage/.DS_Store and b/storage/.DS_Store differ