Skip to content

Commit c5bf7d6

Browse files
authored
Merge pull request #51 from velog-io/feat/handle-spam-filter
feat: handle spam to vn lang
2 parents a176bb7 + b8c9dec commit c5bf7d6

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

apps/cron/src/services/PostService/index.mts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,18 @@ export class PostService implements Service {
179179
): Promise<{ isSpam: boolean; reason: string }> {
180180
const includesCN = /[\u4e00-\u9fa5]/.test(text)
181181
const includesKR = /[-|-|-]/.test(text)
182+
const includesVN = /[àáâãèéêìíòóôõùúýăđĩũơưế]/.test(
183+
text,
184+
)
182185

183186
if (includesCN && !includesKR) {
184187
return { isSpam: true, reason: 'includesCN' }
185188
}
186189

190+
if (includesVN && !includesKR) {
191+
return { isSpam: true, reason: 'includesVN' }
192+
}
193+
187194
let replaced = text.replace(/```([\s\S]*?)```/g, '') // remove code blocks
188195
// replace image markdown
189196
replaced = replaced.replace(/!\[([\s\S]*?)\]\(([\s\S]*?)\)/g, '')

0 commit comments

Comments
 (0)