Merge d316acd393d0c022faf85333d8d77ae85fcbb6e9 into 2f532fdd0d83566c27d22ad7ca2dfbcf4680786d

This commit is contained in:
Aidan 2025-04-24 19:07:12 -04:00 committed by GitHub
commit 4cfc861745
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 7 deletions

View File

@ -1,4 +1,4 @@
module.exports = (isOnSpamWatch) => {
export default (isOnSpamWatch) => {
return async (ctx, next) => {
if (await isOnSpamWatch(ctx.from.id)) {
console.log(`User ${ctx.from.id} is banned on SpamWatch. Blocking command.`);

View File

@ -1,2 +1,6 @@
# TelegramBot-SpamWatch
[![GitHub License](https://img.shields.io/github/license/abocn/TelegramBot)](https://github.com/abocn/TelegramBot/blob/main/LICENSE)
[![TypeScript](https://img.shields.io/badge/TypeScript-3178C6?logo=typescript&logoColor=fff)](https://www.typescriptlang.org)
Kowalski integration with the SpamWatch API (WIP)

View File

@ -1,9 +1,9 @@
const fs = require('fs');
const path = require('path');
import fs from 'fs';
import path from 'path';
const blocklistPath = path.join(__dirname, 'sw_blocklist.txt');
let blocklist = [];
let blocklist: string[] = [];
const readBlocklist = () => {
try {
@ -19,10 +19,10 @@ const readBlocklist = () => {
}
};
const isOnSpamWatch = (userId) => {
return blocklist.includes(String(userId));
const isOnSpamWatch = (userId: string) => {
return blocklist.includes(userId);
};
readBlocklist();
module.exports = { isOnSpamWatch };
export { isOnSpamWatch };