File tree Expand file tree Collapse file tree 1 file changed +18
-10
lines changed Expand file tree Collapse file tree 1 file changed +18
-10
lines changed Original file line number Diff line number Diff line change @@ -364,19 +364,27 @@ export class HelpChanModule extends Module {
364
364
else askHelpChannel . send ( newMessageText ) ;
365
365
}
366
366
367
+ private async getChannelMember ( channel : TextChannel ) {
368
+ return (
369
+ HelpUser . findOneOrFail ( {
370
+ channelId : channel . id ,
371
+ } )
372
+ . then ( helpUser => {
373
+ // Clear from the cache in case they've left the server
374
+ channel . guild . members . cache . delete ( helpUser . userId ) ;
375
+ return channel . guild . members . fetch ( {
376
+ user : helpUser . userId ,
377
+ } ) ;
378
+ } )
379
+ // Do nothing, member left the guild
380
+ . catch ( ( ) => undefined )
381
+ ) ;
382
+ }
383
+
367
384
private async markChannelAsDormant ( channel : TextChannel ) {
368
385
this . busyChannels . add ( channel . id ) ;
369
386
370
- const memberPromise = HelpUser . findOneOrFail ( {
371
- channelId : channel . id ,
372
- } )
373
- . then ( helpUser =>
374
- channel . guild . members . fetch ( {
375
- user : helpUser . userId ,
376
- } ) ,
377
- )
378
- // Do nothing, member left the guild
379
- . catch ( ( ) => undefined ) ;
387
+ const memberPromise = this . getChannelMember ( channel ) ;
380
388
381
389
const pinnedPromise = channel . messages . fetchPinned ( ) ;
382
390
You can’t perform that action at this time.
0 commit comments