@@ -12,11 +12,13 @@ import {
1212  Collection , 
1313  MessageSelectMenu , 
1414}  from  'discord.js' ; 
15+ 
16+ import  {  POINT_LIMITER_IN_MINUTES  }  from  '../../env.js' ; 
1517import  {  asyncCatch  }  from  '../../utils/asyncCatch.js' ; 
16- import  {  createResponse  }  from  './createResponse.js' ; 
17- import  {  ThanksInteraction ,  ThanksInteractionType  }  from  './db_model.js' ; 
1818import  {  _  }  from  '../../utils/pluralize.js' ; 
19- import  {  POINT_LIMITER_IN_MINUTES  }  from  '../../env.js' ; 
19+ import  {  createResponse  }  from  './createResponse.js' ; 
20+ import  type  {  ThanksInteractionType  }  from  './db_model.js' ; 
21+ import  {  ThanksInteraction  }  from  './db_model.js' ; 
2022
2123const  memoryCache  =  new  Map < string ,  Message > ( ) ; 
2224
@@ -28,7 +30,7 @@ export async function handleThreadThanks(msg: Message): Promise<void> {
2830
2931  const  oldResponseId  =  [ msg . author . id ,  msg . channel . id ] . join ( '|' ) ; 
3032  if  ( memoryCache . has ( oldResponseId ) )  { 
31-     await  memoryCache . get ( oldResponseId ) . delete ( ) . catch ( e  =>  console . error ( "message already deleted" ) ) . finally ( ( )  =>  {  memoryCache . delete ( oldResponseId )  } ) ; 
33+     await  memoryCache . get ( oldResponseId ) . delete ( ) . catch ( error  =>  {   console . error ( "message already deleted" ) ;   } ) . finally ( ( )  =>  {  memoryCache . delete ( oldResponseId )  } ) ; 
3234  } 
3335  // channel.members.fetch should return a collection 
3436  const  [ members ,  previousInteractions ] : [ 
@@ -41,7 +43,7 @@ export async function handleThreadThanks(msg: Message): Promise<void> {
4143    ThanksInteraction . find ( { 
4244      thanker : msg . author . id , 
4345      createdAt : { 
44-         $gte : Date . now ( )  -  Number . parseInt ( POINT_LIMITER_IN_MINUTES )  *  60000 , 
46+         $gte : Date . now ( )  -  Number . parseInt ( POINT_LIMITER_IN_MINUTES )  *  60_000 , 
4547      } , 
4648    } ) , 
4749  ] ) ; 
@@ -69,7 +71,7 @@ export async function handleThreadThanks(msg: Message): Promise<void> {
6971  const  response  =  await  msg . reply ( { 
7072    content : [ 
7173      "Hey, it looks like you're trying to thank one or many users, but haven't specified who. Who would you like to thank?" , 
72-       alreadyThanked . length 
74+       alreadyThanked . length   >   0 
7375        ? _ `There ${ _ . mapper ( {  1 : 'is'  } ,  'are' ) } ${ _ . n } ${  
7476            _ . s  
7577          }   that you can't thank as you've thanked them recently**, so they won't show up as an option.`( 
@@ -113,7 +115,7 @@ export function attachThreadThanksHandler(client: Client): void {
113115      if  ( ! ( interaction . isSelectMenu ( )  ||  interaction . isButton ( ) ) )  { 
114116        return ; 
115117      } 
116-       const  channel  =  interaction . channel ; 
118+       const  { channel}  =  interaction ; 
117119      const  [ category ,  msgId ,  type ,  userId ]  =  interaction . customId . split ( '🤔' ) ; 
118120
119121      if  ( category  !==  'threadThanks' )  { 
@@ -219,7 +221,7 @@ export function attachThreadClose(client: Client) {
219221
220222      const  channel  =  activeThreads . threads . get ( channelId ) ; 
221223
222-       if  ( ! channel  ||  channel . archived   ===   true )  { 
224+       if  ( ! channel  ||  channel . archived )  { 
223225        interaction . reply ( {  content : ''  } ) ; 
224226      } 
225227
0 commit comments