mirror of
https://github.com/abocn/TelegramBot-SpamWatch.git
synced 2025-04-28 17:55:57 +00:00
rf: js -> ts
This commit is contained in:
parent
2f532fdd0d
commit
3ecd084d44
@ -1,4 +1,4 @@
|
|||||||
module.exports = (isOnSpamWatch) => {
|
export default (isOnSpamWatch) => {
|
||||||
return async (ctx, next) => {
|
return async (ctx, next) => {
|
||||||
if (await isOnSpamWatch(ctx.from.id)) {
|
if (await isOnSpamWatch(ctx.from.id)) {
|
||||||
console.log(`User ${ctx.from.id} is banned on SpamWatch. Blocking command.`);
|
console.log(`User ${ctx.from.id} is banned on SpamWatch. Blocking command.`);
|
@ -1,9 +1,9 @@
|
|||||||
const fs = require('fs');
|
import fs from 'fs';
|
||||||
const path = require('path');
|
import path from 'path';
|
||||||
|
|
||||||
const blocklistPath = path.join(__dirname, 'sw_blocklist.txt');
|
const blocklistPath = path.join(__dirname, 'sw_blocklist.txt');
|
||||||
|
|
||||||
let blocklist = [];
|
let blocklist: string[] = [];
|
||||||
|
|
||||||
const readBlocklist = () => {
|
const readBlocklist = () => {
|
||||||
try {
|
try {
|
||||||
@ -19,10 +19,10 @@ const readBlocklist = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const isOnSpamWatch = (userId) => {
|
const isOnSpamWatch = (userId: string) => {
|
||||||
return blocklist.includes(String(userId));
|
return blocklist.includes(userId);
|
||||||
};
|
};
|
||||||
|
|
||||||
readBlocklist();
|
readBlocklist();
|
||||||
|
|
||||||
module.exports = { isOnSpamWatch };
|
export { isOnSpamWatch };
|
Loading…
x
Reference in New Issue
Block a user