@@ -3,7 +3,8 @@ import { EmbedType } from "discord.js";
33
44import { CHANNELS } from "../constants/channels.js" ;
55import { EMBED_COLOR } from "./commands.js" ;
6- import { isStaff } from "../helpers/discord.js" ;
6+ import { isStaff , isHelpful } from "../helpers/discord.js" ;
7+ import { logger } from "./log.js" ;
78
89const jobKeywords = [
910 "looking for work" ,
@@ -47,7 +48,7 @@ const hasCodeBlockWithDollarSign = (content: string): boolean => {
4748
4849export const jobScanner : ChannelHandlers = {
4950 handleMessage : async ( { msg } ) => {
50- if ( msg . author . bot || isStaff ( msg . member ) ) return ;
51+ if ( msg . author . bot || isStaff ( msg . member ) || isHelpful ( msg . member ) ) return ;
5152
5253 const content = msg . content . toLowerCase ( ) ;
5354 const ignoreDollar = hasCodeBlockWithDollarSign ( content ) ;
@@ -70,9 +71,19 @@ export const jobScanner: ChannelHandlers = {
7071 } ,
7172 ] ,
7273 } ) ;
73- await msg . delete ( ) . catch ( console . error ) ;
74+ logger . log (
75+ "job keyword detected" ,
76+ `${ msg . author . username } in <#${ msg . channel . id } > \n${ msg . content } ` ,
77+ ) ;
78+ await msg
79+ . delete ( )
80+ . catch ( ( e ) => logger . log ( "failed to delete job posting message" , e ) ) ;
7481 setTimeout ( ( ) => {
75- sentMsg . delete ( ) . catch ( console . error ) ;
76- } , 300_000 ) ;
82+ sentMsg
83+ . delete ( )
84+ . catch ( ( e ) =>
85+ logger . log ( "failed to delete auto reply to a job posting message" , e ) ,
86+ ) ;
87+ } , 30_000 ) ;
7788 } ,
7889} ;
0 commit comments