v3.1.0 push 1
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
# Open Ticket
|
# Open Ticket
|
||||||
[](https://discord.com/invite/26vT9wt3n3) [](https://github.com/DJj123dj/open-ticket/releases/tag/v3.0.1) []() [](https://github.com/DJj123dj/open-ticket/blob/main/LICENSE) [](https://docs.openticket.dj-dj.be)
|
[](https://discord.com/invite/26vT9wt3n3) [](https://github.com/DJj123dj/open-ticket/releases/tag/v3.1.0) []() [](https://github.com/DJj123dj/open-ticket/blob/main/LICENSE) [](https://docs.openticket.dj-dj.be)
|
||||||
|
|
||||||
Open ticket is the most configurable open-source ticket bot for discord! Made with the newest technologies. Like: Slash commands, transcripts, multiple ticket types, buttons & dropdowns!
|
Open ticket is the most configurable open-source ticket bot for discord! Made with the newest technologies. Like: Slash commands, transcripts, multiple ticket types, buttons & dropdowns!
|
||||||
Start using it now, you can do anything!
|
Start using it now, you can do anything!
|
||||||
@@ -52,7 +52,7 @@ Start using it now, you can do anything!
|
|||||||
|
|
||||||
## information
|
## information
|
||||||
|
|
||||||
_v3.0.1_
|
_v3.1.0_
|
||||||
|
|
||||||
changelog: [click here](https://docs.openticket.dj-dj.be/other/changelog)
|
changelog: [click here](https://docs.openticket.dj-dj.be/other/changelog)
|
||||||
|
|
||||||
|
|||||||
+17
-2
@@ -92,7 +92,7 @@
|
|||||||
"dropdown":false,
|
"dropdown":false,
|
||||||
|
|
||||||
"enableFooter":false,
|
"enableFooter":false,
|
||||||
"footer":"Open Ticket v3.0.1 - I'm a footer!",
|
"footer":"Open Ticket v3.1.0 - I'm a footer!",
|
||||||
|
|
||||||
"enableThumbnail":false,
|
"enableThumbnail":false,
|
||||||
"thumbnail":"https://www.example.com/catmemes/cat.png",
|
"thumbnail":"https://www.example.com/catmemes/cat.png",
|
||||||
@@ -101,8 +101,23 @@
|
|||||||
"color":"#ffffff",
|
"color":"#ffffff",
|
||||||
|
|
||||||
"options":["general","apply"],
|
"options":["general","apply"],
|
||||||
|
|
||||||
|
"other":{
|
||||||
"enableTicketExplaination":true,
|
"enableTicketExplaination":true,
|
||||||
"enableMaxTicketsWarning":true
|
"enableMaxTicketsWarning":true,
|
||||||
|
"customDropdownPlaceholder":{
|
||||||
|
"enable":false,
|
||||||
|
"text":"Choose a ticket"
|
||||||
|
},
|
||||||
|
"customCategoryText":{
|
||||||
|
"enable":false,
|
||||||
|
"text":"choose a category:"
|
||||||
|
},
|
||||||
|
"embedTitleURL":{
|
||||||
|
"enable":false,
|
||||||
|
"url":"https://www.dj-dj.be/projects/open-ticket"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
+2
-2
@@ -312,8 +312,8 @@ exports.checker = async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//ticket explaination & max tickets warning
|
//ticket explaination & max tickets warning
|
||||||
checkType(input.enableTicketExplaination,"boolean",path+"/enableTicketExplaination")
|
checkType(input.other.enableTicketExplaination,"boolean",path+"/other/enableTicketExplaination")
|
||||||
checkType(input.enableMaxTicketsWarning,"boolean",path+"/enableMaxTicketsWarning")
|
checkType(input.other.enableMaxTicketsWarning,"boolean",path+"/other/enableMaxTicketsWarning")
|
||||||
|
|
||||||
//OPTIONS!!!
|
//OPTIONS!!!
|
||||||
var counter = 0
|
var counter = 0
|
||||||
|
|||||||
@@ -12,13 +12,15 @@ module.exports = async () => {
|
|||||||
const chalk = await (await import("chalk")).default
|
const chalk = await (await import("chalk")).default
|
||||||
|
|
||||||
client.on("interactionCreate",(interaction) => {
|
client.on("interactionCreate",(interaction) => {
|
||||||
if (!interaction.isButton()) return
|
if (!interaction.isButton() && !interaction.isStringSelectMenu()) return
|
||||||
if (!interaction.customId.startsWith("newR")) return
|
if (interaction.isButton() && !interaction.customId.startsWith("newR")) return
|
||||||
|
if (interaction.isStringSelectMenu() && !(interaction.customId == "OTdropdownMenu")) return
|
||||||
|
|
||||||
interaction.deferUpdate()
|
interaction.deferUpdate()
|
||||||
|
|
||||||
if (interaction.customId.startsWith("newR")){
|
|
||||||
const optionid = interaction.customId.split("newR")[1]
|
const optionidRaw = interaction.isStringSelectMenu() ? interaction.values[0] : interaction.customId
|
||||||
|
const optionid = optionidRaw.split("newR")[1]
|
||||||
if (!optionid){
|
if (!optionid){
|
||||||
interaction.reply({embeds:[bot.errorLog.serverError(l.errors.roleDoesntExist)]})
|
interaction.reply({embeds:[bot.errorLog.serverError(l.errors.roleDoesntExist)]})
|
||||||
return
|
return
|
||||||
@@ -70,6 +72,5 @@ module.exports = async () => {
|
|||||||
}catch{
|
}catch{
|
||||||
interaction.channel.send({embeds:[bot.errorLog.serverError(l.errors.somethingWentWrong)]})
|
interaction.channel.send({embeds:[bot.errorLog.serverError(l.errors.somethingWentWrong)]})
|
||||||
}
|
}
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -16,7 +16,7 @@ const l = bot.language
|
|||||||
|
|
||||||
|
|
||||||
//OTConfigMessage
|
//OTConfigMessage
|
||||||
/**@typedef {{id: string, name: string, description: string, dropdown: boolean, enableFooter: boolean, footer: string, enableThumbnail: boolean, thumbnail: string, enableCustomColor: boolean, color: string, options: string[], enableTicketExplaination: boolean, enableMaxTicketsWarning: boolean}} OTConfigMessage*/
|
/**@typedef {{id: string, name: string, description: string, dropdown: boolean, enableFooter: boolean, footer: string, enableThumbnail: boolean, thumbnail: string, enableCustomColor: boolean, color: string, options: string[], other:{enableTicketExplaination: boolean, enableMaxTicketsWarning: boolean, customDropdownPlaceholder:{enable:Boolean,text:String}, customCategoryText:{enable:Boolean,text:String}, embedTitleURL:{enable:Boolean,url:String} } }} OTConfigMessage*/
|
||||||
|
|
||||||
//StringOptions
|
//StringOptions
|
||||||
/**@typedef {"id"|"name"|"description"|"icon"|"label"|"type"|"color"|"adminroles"|"channelprefix"|"category"|"message"|"enableDmOnOpen"|"ticketmessage"|"thumbnail"|"closedCategory"} OTTicketStringOptions */
|
/**@typedef {"id"|"name"|"description"|"icon"|"label"|"type"|"color"|"adminroles"|"channelprefix"|"category"|"message"|"enableDmOnOpen"|"ticketmessage"|"thumbnail"|"closedCategory"} OTTicketStringOptions */
|
||||||
|
|||||||
@@ -7,24 +7,26 @@ const configParser = require("./configParser")
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {String[]} ids
|
* @param {String[]} ids
|
||||||
|
* @param {String|undefined|false} placeholder
|
||||||
* @returns {discord.StringSelectMenuBuilder|false}
|
* @returns {discord.StringSelectMenuBuilder|false}
|
||||||
*/
|
*/
|
||||||
exports.getDropdown = (ids) => {
|
exports.getDropdown = (ids,placeholder) => {
|
||||||
const dropdown = new discord.StringSelectMenuBuilder()
|
const dropdown = new discord.StringSelectMenuBuilder()
|
||||||
.setCustomId("OTdropdownMenu")
|
.setCustomId("OTdropdownMenu")
|
||||||
.setDisabled(false)
|
.setDisabled(false)
|
||||||
.setMaxValues(1)
|
.setMaxValues(1)
|
||||||
.setMinValues(1)
|
.setMinValues(1)
|
||||||
.setPlaceholder(l.messages.chooseATicket)
|
.setPlaceholder(placeholder || l.messages.chooseATicket)
|
||||||
.addOptions(
|
.addOptions(
|
||||||
new discord.SelectMenuOptionBuilder()
|
new discord.SelectMenuOptionBuilder()
|
||||||
.setDefault(true)
|
.setDefault(true)
|
||||||
.setLabel(l.messages.chooseATicket)
|
.setLabel(placeholder || l.messages.chooseATicket)
|
||||||
.setValue("OTChooseTicket")
|
.setValue("OTChooseTicket")
|
||||||
)
|
)
|
||||||
|
|
||||||
ids.forEach((id) => {
|
ids.forEach((id) => {
|
||||||
const option = configParser.getTicketById(id,true)
|
const option = configParser.getTicketById(id,true)
|
||||||
|
const roleoption = configParser.getRoleById(id,true)
|
||||||
if (option){
|
if (option){
|
||||||
const selectComponent = new discord.SelectMenuOptionBuilder()
|
const selectComponent = new discord.SelectMenuOptionBuilder()
|
||||||
.setDefault(false)
|
.setDefault(false)
|
||||||
@@ -38,7 +40,22 @@ exports.getDropdown = (ids) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dropdown.addOptions(selectComponent)
|
dropdown.addOptions(selectComponent)
|
||||||
|
|
||||||
|
}else if (roleoption){
|
||||||
|
const selectComponent = new discord.SelectMenuOptionBuilder()
|
||||||
|
.setDefault(false)
|
||||||
|
.setValue("OTnewR"+roleoption.id)
|
||||||
|
|
||||||
|
if (!roleoption.label && !roleoption.icon){
|
||||||
|
selectComponent.setLabel("OT ERROR: no description/emoji")
|
||||||
|
}else{
|
||||||
|
if (roleoption.label) selectComponent.setLabel(roleoption.label)
|
||||||
|
if (roleoption.icon) selectComponent.setEmoji(roleoption.icon)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dropdown.addOptions(selectComponent)
|
||||||
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -43,9 +43,12 @@ exports.createEmbed = (id) => {
|
|||||||
embed.setColor(config.main_color)
|
embed.setColor(config.main_color)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (data.other.embedTitleURL.enable) embed.setURL(data.other.embedTitleURL)
|
||||||
|
|
||||||
var description = data.description
|
var description = data.description
|
||||||
if (data.enableTicketExplaination){
|
if (data.other.enableTicketExplaination){
|
||||||
description = description+"\n\n__"+l.messages.chooseCategory+"__\n"
|
const chooseCategoryMSG = data.other.customCategoryText.enable ? data.other.customCategoryText.text : l.messages.chooseCategory
|
||||||
|
description = description+"\n\n__"+chooseCategoryMSG+"__\n"
|
||||||
|
|
||||||
var ticketExplainations = []
|
var ticketExplainations = []
|
||||||
buttonData.forEach((button) => {
|
buttonData.forEach((button) => {
|
||||||
@@ -56,7 +59,7 @@ exports.createEmbed = (id) => {
|
|||||||
description = description+ticketExplainations.join("\n\n")
|
description = description+ticketExplainations.join("\n\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.enableMaxTicketsWarning){
|
if (data.other.enableMaxTicketsWarning){
|
||||||
description = description+"\n\n"+l.commands.maxTicketWarning.replace("{0}",config.system.max_allowed_tickets)
|
description = description+"\n\n"+l.commands.maxTicketWarning.replace("{0}",config.system.max_allowed_tickets)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,7 +95,8 @@ exports.createEmbed = (id) => {
|
|||||||
//create the component IF DROPDOWN is true
|
//create the component IF DROPDOWN is true
|
||||||
}else{
|
}else{
|
||||||
const ids = data.options
|
const ids = data.options
|
||||||
const dropdown = require("./getDropdown").getDropdown(ids)
|
const customPlaceholder = data.other.customDropdownPlaceholder.enable ? data.other.customDropdownPlaceholder.text : false
|
||||||
|
const dropdown = require("./getDropdown").getDropdown(ids,customPlaceholder)
|
||||||
var componentRows = [
|
var componentRows = [
|
||||||
new discord.ActionRowBuilder()
|
new discord.ActionRowBuilder()
|
||||||
.setComponents(dropdown)
|
.setComponents(dropdown)
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "open-ticket",
|
"name": "open-ticket",
|
||||||
"version": "3.0.1",
|
"version": "3.1.0",
|
||||||
"description": "This is an open-source discord ticket bot, you can configure it and it comes with cool features like a transcript.",
|
"description": "This is an open-source discord ticket bot, you can configure it and it comes with cool features like a transcript.",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user