Skip to content

Commit b378355

Browse files
committed
Improvements and fixes to ticket channel name per category
1 parent 7b3dc98 commit b378355

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

config.yml.example

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ TicketCategories:
111111
embedTitle: "Report Ticket" # The title of the embed
112112
color: "#FFD700" # The color of embed in the opened ticket
113113
description: "Welcome {user} ({user.tag}) to your report ticket! Please be patient while a staff member responds to your report." # The description of the embed in the created ticket, right above the questions fields, use {user} for the user such as @User and {user.tag} for the name of the user without it being mentioned such as User
114-
ticketName: "CATEGORY-TICKETCOUNT" Options are: CATEGORY-USERNAME (will be called category-USERNAME such as general-ralphkb), CATEGORY-TICKETCOUNT (will be called category-TICKETCOUNT such as general-12348), USERNAME-TICKETCOUNT (will be called USERNAME-TICKETCOUNT such as ralphkb-12348), USERNAME-CATEGORY (will be called USERNAME-category such as ralphkb-general), USERNAME-CATEGORY-TICKETCOUNT (will be called USERNAME-category-TICKETCOUNT such as ralphkb-general-12348), or CATEGORY-USERNAME-TICKETCOUNT (will be called category-USERNAME-TICKETCOUNT such as general-ralphkb-12348)
114+
ticketName: "category-ticketcount" # Options are: category-username (will be called category-username such as general-ralphkb), category-ticketcount (will be called category-ticketcount such as general-12348), username-ticketcount (will be called username-ticketcount such as ralphkb-12348), username-category (will be called username-category such as ralphkb-general), username-category-ticketcount (will be called username-category-ticketcount such as ralphkb-general-12348), or category-username-ticketcount (will be called category-username-ticketcount such as general-ralphkb-12348)
115115
ticketTopic: "Ticket Creator: {user} | Ticket Type: {type}" # The topic of the ticket channel
116116
slowmode: "0" # The slowmode of the ticket channel in seconds, keep it 0 if you don't want a slowmode and do not use negative values
117117
useCodeBlocks: false # Set this to true if you want to use code blocks to display the answers of the ticket category questions
@@ -182,7 +182,7 @@ TicketCategories:
182182
embedTitle: "Other Ticket" # The title of the embed
183183
color: "#ADD8E6" # The color of embed in the opened ticket
184184
description: "Welcome {user} ({user.tag}) to your other ticket! Please be patient while a staff member responds to your questions." # The description of the embed in the created ticket, right above the questions fields, use {user} for the user such as @User and {user.tag} for the name of the user without it being mentioned such as User
185-
ticketName: "CATEGORY-TICKETCOUNT" Options are: CATEGORY-USERNAME (will be called category-USERNAME such as general-ralphkb), CATEGORY-TICKETCOUNT (will be called category-TICKETCOUNT such as general-12348), USERNAME-TICKETCOUNT (will be called USERNAME-TICKETCOUNT such as ralphkb-12348), USERNAME-CATEGORY (will be called USERNAME-category such as ralphkb-general), USERNAME-CATEGORY-TICKETCOUNT (will be called USERNAME-category-TICKETCOUNT such as ralphkb-general-12348), or CATEGORY-USERNAME-TICKETCOUNT (will be called category-USERNAME-TICKETCOUNT such as general-ralphkb-12348)
185+
ticketName: "category-username" # Options are: category-username (will be called category-username such as general-ralphkb), category-ticketcount (will be called category-ticketcount such as general-12348), username-ticketcount (will be called username-ticketcount such as ralphkb-12348), username-category (will be called username-category such as ralphkb-general), username-category-ticketcount (will be called username-category-ticketcount such as ralphkb-general-12348), or category-username-ticketcount (will be called category-username-ticketcount such as general-ralphkb-12348)
186186
ticketTopic: "Ticket Creator: {user} | Ticket Type: {type}" # The topic of the ticket channel
187187
slowmode: "0" # The slowmode of the ticket channel in seconds, keep it 0 if you don't want a slowmode and do not use negative values
188188
useCodeBlocks: false # Set this to true if you want to use code blocks to display the answers of the ticket category questions

events/interactionCreate.js

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1635,28 +1635,29 @@ module.exports = {
16351635
);
16361636

16371637
let channelName;
1638-
switch (configValue) {
1639-
case "CATEGORY-USERNAME":
1640-
channelName = `${category.name}-${USERNAME}`;
1638+
switch (configValue.toLowerCase()) {
1639+
case "category-username":
1640+
channelName = `${category.name}-${USERNAME}`;
16411641
break;
1642-
case "CATEGORY-TICKETCOUNT":
1643-
channelName = `${category.name}-${TICKETCOUNT}`;
1642+
case "category-ticketcount":
1643+
channelName = `${category.name}-${TICKETCOUNT}`;
16441644
break;
1645-
case "USERNAME-TICKETCOUNT":
1646-
channelName = `${USERNAME}-${TICKETCOUNT}`;
1645+
case "username-ticketcount":
1646+
channelName = `${USERNAME}-${TICKETCOUNT}`;
16471647
break;
1648-
case "USERNAME-CATEGORY":
1649-
channelName = `${USERNAME}-${category.name}`;
1648+
case "username-category":
1649+
channelName = `${USERNAME}-${category.name}`;
16501650
break;
1651-
case "USERNAME-CATEGORY-TICKETCOUNT":
1652-
channelName = `${USERNAME}-${category.name}-${TICKETCOUNT}`;
1651+
case "username-category-ticketcount":
1652+
channelName = `${USERNAME}-${category.name}-${TICKETCOUNT}`;
16531653
break;
1654-
case "CATEGORY-USERNAME-TICKETCOUNT":
1655-
channelName = `${category.name}-${USERNAME}-${TICKETCOUNT}`;
1654+
case "category-username-ticketcount":
1655+
channelName = `${category.name}-${USERNAME}-${TICKETCOUNT}`;
16561656
break;
16571657
default:
1658-
throw new Error(
1659-
`Invalid category ticketName configuration value: ${configValue}`,
1658+
channelName = `${category.name}-${TICKETCOUNT}`;
1659+
console.log(
1660+
`WARNING: Invalid category ticketName configuration value: ${configValue}, falling back to category-ticketcount as the value.`,
16601661
);
16611662
}
16621663
const nameEmoji = category.nameEmoji ?? "";

0 commit comments

Comments
 (0)