@@ -17,7 +17,7 @@ class Setup extends Command {
1717 super ( client , {
1818 name : 'setup' ,
1919 description : 'Setup the different systems of the bot' ,
20- usage : 'setup <logs | tickets | warns>' ,
20+ usage : 'setup <logging | tickets | warns>' ,
2121 category : 'Administrator' ,
2222 permLevel : 'Administrator' ,
2323 aliases : [ 'setlogchannel' , 'setupticket' , 'logsetup' , 'ticketsetup' , 'setupwarns' ] ,
@@ -58,8 +58,9 @@ class Setup extends Command {
5858 The ticket system is already set up in this server. Would you like to:
5959 1️⃣ Reuse existing ticket channels and just update the menu.
6060 2️⃣ Select new ticket creation and log channels.
61- 3️⃣ Disable the ticket system.
62- (Reply with 1, 2, 3, or cancel)
61+ 3️⃣ Disable and delete the tickets data.
62+ 4️⃣ Update the max number of tickets a user can open.
63+ (Reply a number or cancel)
6364 ` ) ;
6465
6566 const collected = await msg . channel . awaitMessages ( { filter, max : 1 , time : 60000 , errors : [ 'time' ] } ) ;
@@ -68,6 +69,41 @@ class Setup extends Command {
6869 const choice = collected . first ( ) . content . toLowerCase ( ) ;
6970 if ( choice === 'cancel' ) return msg . channel . send ( 'Got it! Setup cancelled.' ) ;
7071
72+ // Update the max number of tickets
73+ if ( choice === '4' ) {
74+ // code goes here
75+ await msg . channel . send (
76+ 'How many tickets should a user be able to open? Please respond in number form, the default is 3.' ,
77+ ) ;
78+
79+ const collectedMaxTicketsQuestion = await msg . channel . awaitMessages ( {
80+ filter2,
81+ max : 1 ,
82+ time : 60000 ,
83+ errors : [ 'time' ] ,
84+ } ) ;
85+ if ( ! collectedMaxTicketsQuestion ) {
86+ errorEmbed . setDescription ( 'You did not reply in time, the command has been cancelled.' ) ;
87+ return msg . channel . send ( { embeds : [ errorEmbed ] } ) ;
88+ }
89+ let ticketLimit = parseInt ( collectedMaxTicketsQuestion . first ( ) . content . toLowerCase ( ) ) ;
90+
91+ while ( isNaN ( ticketLimit ) ) {
92+ ticketLimit = await this . client . util . awaitReply (
93+ msg ,
94+ 'How many tickets should a user be able to open? Please respond in number form, the default is 3.' ,
95+ ) ;
96+ if ( ! ticketLimit ) {
97+ errorEmbed . setDescription ( 'You did not reply in time, the command has been cancelled.' ) ;
98+ return msg . channel . send ( { embeds : [ errorEmbed ] } ) ;
99+ }
100+ ticketLimit = parseInt ( ticketLimit ) ;
101+ }
102+ await db . set ( `servers.${ msg . guild . id } .tickets.limit` , ticketLimit ) ;
103+ return msg . channel . send ( `The ticket limit has been updated to ${ ticketLimit } .` ) ;
104+ }
105+ // End of updating max number of tickets
106+
71107 // Disable the ticket system
72108 if ( choice === '3' ) {
73109 await db . delete ( `servers.${ msg . guild . id } .tickets` ) ;
@@ -399,7 +435,7 @@ class Setup extends Command {
399435 errorEmbed . setDescription ( 'You did not reply in time, the command has been cancelled.' ) ;
400436 return msg . channel . send ( { embeds : [ errorEmbed ] } ) ;
401437 }
402- const response = collected . first ( ) . content . toLowerCase ( ) ;
438+ const response = collected . first ( ) . content ;
403439 let role = this . client . util . getRole ( msg , response ) ;
404440
405441 if ( response . toLowerCase ( ) === 'cancel' )
@@ -545,6 +581,7 @@ class Setup extends Command {
545581 await db . set ( `servers.${ msg . guild . id } .tickets.logID` , tixLog . id ) ;
546582
547583 return msg . channel . send ( stripIndents `The ticket system is now fully functional.
584+ To change settings or disable the system re-run the setup.
548585
549586 Log Channel: ${ tixLog }
550587 Ticket Creation Channel: ${ ticketCreationMenu === 'yes' ? ticketCreationChannel : 'Skipped' } ` ) ;
@@ -710,7 +747,7 @@ class Setup extends Command {
710747 name : 'Tickets' ,
711748 value : stripIndents `
712749 To setup the ticket system please use:
713- \`${ msg . settings . prefix } Setup Ticket \`` ,
750+ \`${ msg . settings . prefix } Setup Tickets \`` ,
714751 } ,
715752 {
716753 name : 'Logging' ,
0 commit comments