It's really simple and stupid, but it works like a charm for me. When a new message appears, a bot will check its sender ID. If the sender ID is in ./src/data/users.json, it will not do any checks because this file stores verified users. If the sender ID is NOT in the file, the bot will check message content if it has some "banned keywords". If it doesn't have, the sender ID will be written to the file. If it does have, the user will be kicked out of the chat, and the message will be deleted.
Unfortunately, the telegram bot api doesn't fire new_chat_member events in supergroups. And somehow this shitty api doesn't even provide a method to fetch all chat members. I was too lazy to write a better workaround for this.
Create a .env file based on .env.example and paste your bot token there.
Start the bot:
pnpm run devRun project in production mode on Linux:
pnpm run deployRun project in production mode on Windows:
pnpm run start