File tree Expand file tree Collapse file tree 3 files changed +16
-8
lines changed
Expand file tree Collapse file tree 3 files changed +16
-8
lines changed Original file line number Diff line number Diff line change 3333 "scripts" : {
3434 "start" : " ts-node-dev --respawn src" ,
3535 "build" : " tsc" ,
36- "lint" : " prettier --check ' src/**/*.ts' " ,
37- "lint:fix" : " prettier ' src/**/*.ts' --write "
36+ "lint" : " prettier --check \" src/**/*.ts\" " ,
37+ "lint:fix" : " prettier \" src/**/*.ts\" --write "
3838 }
3939}
Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ export class HelpChanModule extends Module {
6060
6161 private getChannelName ( guild : Guild ) {
6262 const takenChannelNames = guild . channels . cache
63- . filter ( channel => channel . name . startsWith ( 'help-' ) )
63+ . filter ( channel => channel . name . startsWith ( this . CHANNEL_PREFIX ) )
6464 . map ( channel => channel . name . replace ( this . CHANNEL_PREFIX , '' ) ) ;
6565 let decidedChannel = channelNames [ 0 ] ;
6666
@@ -174,10 +174,16 @@ export class HelpChanModule extends Module {
174174 if ( dormant && dormant instanceof TextChannel ) {
175175 await this . moveChannel ( dormant , categories . ask ) ;
176176
177- const lastMessage = dormant . messages . cache
177+ let lastMessage = dormant . messages . cache
178178 . array ( )
179179 . reverse ( )
180180 . find ( m => m . author . id === this . client . user ?. id ) ;
181+
182+ if ( ! lastMessage )
183+ lastMessage = ( await dormant . messages . fetch ( { limit : 5 } ) )
184+ . array ( )
185+ . find ( m => m . author . id === this . client . user ?. id ) ;
186+
181187 if ( lastMessage ) {
182188 // If there is a last message (the dormant message) by the bot, just edit it
183189 await lastMessage . edit ( this . AVAILABLE_EMBED ) ;
Original file line number Diff line number Diff line change @@ -19,8 +19,7 @@ export class RepModule extends Module {
1919
2020 MAX_REP = 3 ;
2121
22- // all messages have to be fully lowercase
23- THANKS_REGEX = / \b (?: t h a n k s | t h x | c h e e r s | t h a n x | t y | t k s | t k x ) \b / i;
22+ THANKS_REGEX = / \b (?: t h a n k s | t h x | c h e e r s | t h a n x | t h n k s | t y | t k s | t k x ) \b / i;
2423
2524 async getOrMakeUser ( user : User ) {
2625 let ru = await RepUser . findOne (
@@ -158,6 +157,7 @@ export class RepModule extends Module {
158157 description : 'See who has the most reputation' ,
159158 } )
160159 async leaderboard ( msg : Message ) {
160+ const topEmojis = [ ':first_place:' , ':second_place:' , ':third_place:' ] ;
161161 const data = ( ( await RepGive . createQueryBuilder ( 'give' )
162162 . select ( [ 'give.to' , 'COUNT(*)' ] )
163163 . groupBy ( 'give.to' )
@@ -173,8 +173,10 @@ export class RepModule extends Module {
173173 . setDescription (
174174 data
175175 . map (
176- x =>
177- `:white_small_square: **<@${ x . id } >** with **${ x . count } ** points.` ,
176+ ( x , index ) =>
177+ `${
178+ topEmojis [ index ] || ':white_small_square:'
179+ } **<@${ x . id } >** with **${ x . count } ** points.`,
178180 )
179181 . join ( '\n' ) ,
180182 ) ;
You can’t perform that action at this time.
0 commit comments