Node.js Telegram Chatbot handling spam messages.
npm install
Set your telegram bot token in a src/config/index.ts
.
(How do I get a token?: see Telegram bot api guide.)
export const BOT_TOKEN = ${your_telegram_bot_token};
Set the word that the bot will delete to src/config/black-list.json
.
{
"rules":[
"aaa", // Delete messages containing "aaa"
],
}
You can set it to only allow certain URLs to prevent sharing of dangerous links.
Set the URL in a src/config/white-list.json
{
"rules":[
"www.safesite.com"
]
}
And change ENABLE_KICK_URL
to true. (src/config/index.ts
)
export const ENABLE_KICK_URL = true; // default -> false
npm run start
The bot must have administrator privileges.