@@ -296,12 +296,12 @@ client.on("interactionCreate", async (interaction) => {
296296 config . userErrors . guildOnly ( interaction , uInter , other ) ;
297297 return ;
298298 }
299-
300- if ( typeof uInter . coolDown == "number" ) uInter . coolDown = {
299+
300+ if ( typeof uInter . coolDown == "number" ) uInter . coolDown = [ {
301301 type : "user" ,
302302 amount : uInter . coolDown ,
303- }
304-
303+ } ] ;
304+ if ( typeof uInter . coolDown == "object" && ! Array . isArray ( uInter . coolDown ) ) uInter . coolDown = [ uInter . coolDown ]
305305 let converter = {
306306 "user" : interaction . user . id ,
307307 "member" : interaction . user . id + "_" + interaction . guild ?. id ,
@@ -310,18 +310,17 @@ client.on("interactionCreate", async (interaction) => {
310310 "any" : "any"
311311 }
312312
313- if ( uInter . coolDown && ! uInter . coolDown . amount ) uInter . coolDown . amount = 0 ;
314313 let now = Date . now ( ) ;
315314
316315 for ( let k in converter ) {
317316 let key = converter [ k ] ;
318317 let keyCooldown = uInter . coolDowns . get ( key ) ;
319- if ( uInter . coolDown ?. amount && ( now < keyCooldown ) ) {
318+ if ( now < keyCooldown ) {
320319 config . userErrors . coolDown ( interaction , uInter , keyCooldown - now , other , k ) ;
321320 return ;
322321 }
323322 }
324-
323+
325324 function setCoolDown ( duration = 0 , type = "user" ) {
326325 let ckey = converter [ type ] || interaction . user . id ;
327326 if ( typeof duration == "number" && duration > 0 ) {
@@ -330,12 +329,19 @@ client.on("interactionCreate", async (interaction) => {
330329 return uInter . coolDowns . delete ( ckey ) ;
331330 }
332331 }
333-
332+
334333 other . setCoolDown = setCoolDown ;
334+ for ( let index = 0 ; index < uInter . coolDown . length ; index ++ ) {
335335
336- if ( uInter . coolDown ?. amount > 0 ) {
337- setCoolDown ( uInter . coolDown ?. amount , uInter . coolDown ?. type ) ;
336+ let cld = uInter . coolDown [ index ]
337+ if ( cld && ! cld . amount ) cld . amount = 0 ;
338+
339+ if ( cld ?. amount > 0 ) {
340+ setCoolDown ( cld ?. amount , cld ?. type ) ;
341+ }
342+
338343 }
344+
339345
340346 if ( uInter . guildOnly && uInter . perms . bot . length != 0 && ! uInter . perms . bot . every ( perm => interaction . guild . me . permissions . has ( perm ) ) ) {
341347 config . userErrors . botPermsRequired ( interaction , uInter , uInter . perms . bot , other ) ;
0 commit comments