Skip to content

Commit a494a78

Browse files
committed
refactor: renamed feature to job scanner
1 parent 59433cc commit a494a78

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/features/message-scanner.ts renamed to src/features/job-scanner.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { ChannelHandlers } from "../types/index.d.ts";
1+
import type { ChannelHandlers } from "../types/index.js";
22
import { EmbedType } from "discord.js";
33

44
import { CHANNELS } from "../constants/channels.js";
@@ -44,7 +44,7 @@ const hasCodeBlockWithDollarSign = (content: string): boolean => {
4444
return codeBlockRegex.test(content);
4545
};
4646

47-
export const messageScanner: ChannelHandlers = {
47+
export const jobScanner: ChannelHandlers = {
4848
handleMessage: async ({ msg }) => {
4949
if (msg.author.bot) return;
5050

@@ -58,7 +58,7 @@ export const messageScanner: ChannelHandlers = {
5858
const containsJobKeyword = keywordRegex.test(content);
5959
if (!containsJobKeyword && !hasCurrencyKeyword) return;
6060

61-
const warningMsg = `Oops <@${msg.author.id}>! This message looks more like a job/collaboration/advice post. Mind sharing that in <#${CHANNELS.jobsLog}> or <#${CHANNELS.lookingForGroup}> or <#${CHANNELS.jobsAdvice}> instead? If this was a mistake, please try again and ask your question. Appreciate you helping us keep channels on-topic 🙌`;
61+
const warningMsg = `Oops <@${msg.author.id}>! This message looks more like a job/collaboration/advice post. Mind sharing that in <#${CHANNELS.jobsLog}> or <#${CHANNELS.lookingForGroup}> or <#${CHANNELS.jobsAdvice}> instead? If this was a mistake, please try again and ask your question. Appreciate you helping us keep channels on-topic.`;
6262
const sentMsg = await msg.reply({
6363
embeds: [
6464
{
@@ -69,7 +69,7 @@ export const messageScanner: ChannelHandlers = {
6969
},
7070
],
7171
});
72-
await msg.delete();
72+
await msg.delete().catch(console.error);
7373
setTimeout(() => {
7474
sentMsg.delete().catch(console.error);
7575
}, 300_000);

src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
ActivityType,
1111
IntentsBitField,
1212
} from "discord.js";
13-
import { messageScanner } from "./features/message-scanner.js";
13+
import { jobScanner } from "./features/job-scanner.js";
1414
import { logger, channelLog } from "./features/log.js";
1515
// import codeblock from './features/codeblock';
1616
import jobsMod, { resetJobCacheCommand } from "./features/jobs-moderation.js";
@@ -216,7 +216,7 @@ addHandler(
216216
CHANNELS.generalReact,
217217
CHANNELS.generalTech,
218218
],
219-
messageScanner,
219+
jobScanner,
220220
);
221221

222222
const threadChannels = [CHANNELS.helpJs, CHANNELS.helpThreadsReact];

0 commit comments

Comments
 (0)