File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,9 @@ export class RepModule extends Module {
3636
3737 @listener ( { event : 'message' } )
3838 async onThank ( msg : Message ) {
39- const GAVE = '✅' ;
39+ const GIVE = '✅' ;
40+ const PARTIAL_GIVE = '🤔' ;
41+ const NO_GIVE = '❌' ;
4042
4143 // Check for thanks or thx
4244 const THANKS_REGEX = / ( t h a n k s | t h x ) + / gi;
@@ -48,10 +50,16 @@ export class RepModule extends Module {
4850 if ( ! mentionUsers . length ) return ;
4951
5052 const senderRU = await this . getOrMakeUser ( msg . author ) ;
51- if ( ( await senderRU . sent ( ) ) >= this . MAX_REP ) return ;
53+ // track how much rep the author has sent
54+ // 3 possible outcomes: NO_GIVE, PARTIAL_GIVE and GAVE
55+ let currentSent = await senderRU . sent ( ) ;
56+
57+ if ( currentSent >= this . MAX_REP ) return await msg . react ( NO_GIVE ) ;
5258
5359 for ( const user of mentionUsers ) {
5460 if ( user . id === msg . member ?. id ) continue ;
61+ if ( currentSent >= this . MAX_REP )
62+ return await msg . react ( PARTIAL_GIVE ) ;
5563
5664 // give rep
5765 const targetRU = await this . getOrMakeUser ( user ) ;
@@ -60,9 +68,11 @@ export class RepModule extends Module {
6068 from : senderRU ,
6169 to : targetRU ,
6270 } ) . save ( ) ;
71+
72+ currentSent ++ ;
6373 }
6474
65- await msg . react ( GAVE ) ;
75+ await msg . react ( GIVE ) ;
6676 }
6777
6878 @command ( {
You can’t perform that action at this time.
0 commit comments