Skip to content

Commit

Permalink
Merge pull request #428 from bettersg/develop
Browse files Browse the repository at this point in the history
3.2.7
  • Loading branch information
sarge1989 authored Aug 23, 2024
2 parents 4af7712 + d6911c9 commit b4cc360
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 16 deletions.
5 changes: 2 additions & 3 deletions functions/src/definitions/common/genAI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,8 @@ async function anonymiseMessage(
const responseObj = JSON.parse(response)
const redactions: redaction[] = responseObj.redacted
redactions.forEach((redaction) => {
let regex = new RegExp(redaction.text, "g")
returnMessage = returnMessage.replace(
regex,
returnMessage = returnMessage.replaceAll(
redaction.text,
redaction.replaceWith
)
})
Expand Down
28 changes: 16 additions & 12 deletions functions/src/definitions/eventHandlers/checkerHandlerTelegram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,13 @@ bot.on(message("text"), async (ctx) => {
.where("telegramId", "==", checkerId)
.get()

if (userQuerySnap.empty) {
await ctx.reply(
`You have not onboarded as a CheckMate Checker yet. Type /onboard to begin your journey.`
)
return
}

const userSnap = userQuerySnap.docs[0]
let currentStep = userSnap.data().onboardingStatus
const expectingRepliesTo = ["name", "number", "verify"]
Expand Down Expand Up @@ -550,10 +557,9 @@ const sendQuizPrompt = async (
const linkURL = `${TYPEFORM_URL}#name=${name}&phone=${whatsappId}`
await bot.telegram.sendMessage(
chatId,
`${
isFirstPrompt
? "Thank you for verifying your WhatsApp number"
: "We noticed you have not completed the quiz yet"
`${isFirstPrompt
? "Thank you for verifying your WhatsApp number"
: "We noticed you have not completed the quiz yet"
}. Please proceed to complete the onboarding quiz <a href="${linkURL}">here</a>. This will equip you with the skills and knowledge to be a better checker!
${progressBars(2)}`,
Expand Down Expand Up @@ -587,10 +593,9 @@ const sendWABotPrompt = async (
}
await bot.telegram.sendMessage(
chatId,
`${
isFirstPrompt
? "Next, try out our CheckMate WhatsApp service"
: "We noticed you haven't tried out the WhatsApp service yet. Please try out the CheckMate WhatsApp service"
`${isFirstPrompt
? "Next, try out our CheckMate WhatsApp service"
: "We noticed you haven't tried out the WhatsApp service yet. Please try out the CheckMate WhatsApp service"
} as a user <a href="${WHATSAPP_BOT_LINK}?utm_source=checkersonboarding&utm_medium=telegram&utm_campaign=${chatId}">here</a>, and send in the pre-populated message.
This Whatsapp service is where people send in the messages that you'll be checking. Part of your role will also be to report suspicious messages here!
Expand Down Expand Up @@ -622,10 +627,9 @@ const sendTGGroupPrompt = async (
}
await bot.telegram.sendMessage(
chatId,
`${
isFirstPrompt
? "Next, p"
: "We noticed you have not joined the groupchat yet. P"
`${isFirstPrompt
? "Next, p"
: "We noticed you have not joined the groupchat yet. P"
}lease join the <a href="${CHECKERS_GROUP_LINK}">CheckMate Checker's groupchat</a>. This group chat is important as it will be used to:
1) Inform checkers of any downtime in the system, updates/improvements being deployed to the bots
Expand Down
3 changes: 2 additions & 1 deletion functions/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"moduleResolution": "node",
"sourceMap": true,
"strict": true,
"target": "es2017",
"target": "ES2021",
"lib": ["ES2021", "DOM"],
"noErrorTruncation": true,
"esModuleInterop": true,
"resolveJsonModule": true
Expand Down

0 comments on commit b4cc360

Please sign in to comment.