Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.2.7 #428

Merged
merged 4 commits into from
Aug 23, 2024
Merged

3.2.7 #428

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading