Migrate to TypeScript #1

Merged
ihatenodejs merged 2 commits from typescript into main 2025-04-29 19:52:20 +00:00
2 changed files with 7 additions and 7 deletions
Showing only changes of commit 3ecd084d44 - Show all commits

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,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 };